2 AC_INIT([centerim5], [m4_esyscmd([misc/git-version-gen version])],
3 [centerim-devel@centerim.org], [centerim5], [http://www.centerim.org/])
4 # Prevent AC_PROG_CC, AC_PROG_CXX from initializing CFLAGS and CXXFLAGS.
7 AC_CONFIG_SRCDIR([config.h.in])
8 AC_CONFIG_AUX_DIR([config])
9 AC_CONFIG_HEADER([config.h])
10 AC_CONFIG_MACRO_DIR([m4])
11 AM_INIT_AUTOMAKE([-Wall subdir-objects])
12 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
16 # Checks for programs.
20 AX_CXX_COMPILE_STDCXX([11], [noext])
23 LT_INIT([disable-static])
27 AC_ARG_ENABLE([strict], [AC_HELP_STRING([--enable-strict],
28 [enable extra compiler warnings during build])])
29 AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug],
30 [compile with debugging support])])
32 # If not --enable-debug then try to set -O2 as default.
33 AS_IF([test "$enable_debug" != yes],
34 [save_cflags="$CFLAGS"]
36 [AC_MSG_CHECKING([whether CC supports -O2])]
38 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
39 [AC_MSG_RESULT([yes])]
40 [AM_CFLAGS="$AM_CFLAGS -O2"],
41 [AC_MSG_RESULT([no])])]
43 [CFLAGS="$save_cflags"]
45 [save_cxxflags="$CXXFLAGS"]
47 [AC_MSG_CHECKING([whether CXX supports -O2])]
49 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
50 [AC_MSG_RESULT([yes])]
51 [AM_CXXFLAGS="$AM_CXXFLAGS -O2"],
52 [AC_MSG_RESULT([no])])]
54 [CXXFLAGS="$save_cxxflags"])
56 # If --enable-strict is specified then enable compilation warnings.
57 AS_IF([test "$enable_strict" = yes],
58 [save_cflags="$CFLAGS"]
59 [CFLAGS="-Wall -Wextra -pedantic"]
60 [AC_MSG_CHECKING([whether CC supports -Wall -Wextra -pedantic])]
62 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
63 [AC_MSG_RESULT([yes])],
65 [AC_MSG_ERROR([the C compiler does not recognize options -Wall -Wextra -pedantic that are needed by --enable-strict])])]
67 [CFLAGS="$save_cflags"]
68 [AM_CFLAGS="$AM_CFLAGS -Wall -Wextra -pedantic"]
70 [save_cxxflags="$CXXFLAGS"]
71 [CXXFLAGS="-Wall -Wextra -pedantic -Wno-long-long -Wsuggest-override"]
72 [AC_MSG_CHECKING([whether CXX supports -Wall -Wextra -pedantic -Wno-long-long -Wsuggest-override])]
74 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
75 [AC_MSG_RESULT([yes])],
77 [AC_MSG_ERROR([the C++ compiler does not recognize options -Wall -Wextra -pedantic -Wno-long-long -Wsuggest-override that are needed by --enable-strict])])]
79 [CXXFLAGS="$save_cxxflags"]
80 [AM_CXXFLAGS="$AM_CXXFLAGS -Wall -Wextra -pedantic -Wno-long-long -Wsuggest-override"])
82 # If --enable-debug is specified then compile with -g -O0.
83 AS_IF([test "$enable_debug" = yes],
84 [save_cflags="$CFLAGS"]
86 [AC_MSG_CHECKING([whether CC supports -g -O0])]
88 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
89 [AC_MSG_RESULT([yes])],
91 [AC_MSG_ERROR([the C compiler does not recognize options -g -O0 that are needed by --enable-debug])])]
93 [CFLAGS="$save_cflags"]
94 [AM_CFLAGS="$AM_CFLAGS -g -O0"]
96 [save_cxxflags="$CXXFLAGS"]
98 [AC_MSG_CHECKING([whether CXX supports -g -O0])]
100 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
101 [AC_MSG_RESULT([yes])],
102 [AC_MSG_RESULT([no])]
103 [AC_MSG_ERROR([the C++ compiler does not recognize options -g -O0 that are needed by --enable-debug])])]
105 [CXXFLAGS="$save_cxxflags"]
106 [AM_CXXFLAGS="$AM_CXXFLAGS -g -O0"])
107 AC_SUBST([AM_CFLAGS])
108 AC_SUBST([AM_CXXFLAGS])
109 AS_IF([test "$enable_debug" = yes],
110 [AC_DEFINE([DEBUG], [1], [Define if debugging is enabled.])])
112 # Checks for libraries.
115 AS_IF([test "$am_cv_func_iconv" != yes],
116 [AC_MSG_ERROR([iconv not found])])
118 # gettext -- v0.19.3 was released on 2014-10-16.
119 AM_GNU_GETTEXT([external])
120 AM_GNU_GETTEXT_VERSION([0.19.3])
122 # libpurple -- v2.9.0 is needed because of PurpleConvChatBuddy::ui_data, this
123 # version was released on 2011-06-23.
124 # find . \( -name \*.c -or -name \*.cpp -o -name \*.h \) -print0 | xargs -0 sed -n 's/.*\(purple_[^( ]*\)(.*/\1/p' | sort -u | less
125 PKG_CHECK_MODULES([PURPLE], [purple >= 2.7.0])
127 # glib -- v2.32.0 is needed because of g_environ_setenv(), this version was
128 # released on 2012-03-24.
129 # find . \( -name \*.c -o -name \*.cpp -o -name \*.h \) -print0 | xargs -0 sed -n 's/.*\(g_[^ (]*\)(.*/\1/p' | sort -u | less
130 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.32.0])
132 # libsigc++ -- v2.2.0 was released on 2008-02-22.
133 PKG_CHECK_MODULES([SIGC], [sigc++-2.0 >= 2.2.0])
135 # ncursesw -- v5.8 was released on 2011-02-26.
136 PKG_CHECK_MODULES([NCURSESW], [ncursesw >= 5.8])
138 # libtermkey -- v0.18 was released on 2015-10-06.
139 PKG_CHECK_MODULES([TERMKEY], [termkey >= 0.18])
141 # Checks for tools needed by the termex test framework. Only warn about these
142 # missing dependencies.
145 AC_PATH_PROG([TIC], [tic])
146 AC_ARG_VAR([TIC], [path to tic])
147 AS_IF([test -z "$TIC"],
148 [AC_MSG_WARN([tic was not found, running tests will not be possible])])
150 # python -- v3.5 is needed for termex.py (see the script for details), this
151 # version was released on 2015-09-13.
152 AC_PATH_PROG([PYTHON], [python3])
153 AC_ARG_VAR([PYTHON], [path to python3])
154 AS_IF([test -n "$PYTHON"],
155 [AC_MSG_CHECKING([python3 is at least version 3.5])]
156 [python_version_ok=`$PYTHON -c 'import sys; print(sys.hexversion >= 0x03050000)'`]
157 [AS_IF([test "$python_version_ok" == True],
158 [AC_MSG_RESULT([yes])],
159 [AC_MSG_RESULT([no])])])
160 AS_IF([test -z "$PYTHON" -o "$python_version_ok" != True],
161 [AC_MSG_WARN([python >= 3.5 was not found, running tests will not be possible])])
163 AM_CONDITIONAL([TERMEX_TESTS],
164 [test -n "$TIC" -a -n "$PYTHON" -a "$python_version_ok" == True])
166 # CIM_RECURSIVE_EVAL(VALUE, RESULT)
167 # =================================
168 # Interpolate the VALUE in loop until it does not change, and set the result
170 # WARNING: It is easy to get an infinite loop with some unsane input.
171 # Taken from http://ac-archive.sourceforge.net/adl/relpaths.html.
172 AC_DEFUN([CIM_RECURSIVE_EVAL],
174 $2=`(test "$prefix" = NONE && prefix="$ac_default_prefix"
175 test "$exec_prefix" = NONE && exec_prefix="$prefix"
177 while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
178 _lcl_receval_old="[$]_lcl_receval"
179 eval _lcl_receval="\"[$]_lcl_receval\""
181 echo "[$]_lcl_receval")`])
183 # Define locale and pkgdir directories. It would be nicer to do this in
184 # Makefile.ams by adding appropriate '-D' compiler options to respective
185 # CPPFLAGS, which is a common solution that can be seen in other projects. In
186 # that case, it is not needed to resolve the paths at the configure time using
187 # the CIM_RECURSIVE_EVAL function. However this solution unfortunately does not
188 # work correctly when values of the defines are changed, the source files that
189 # use these defines do not get correctly recompiled. To fix this, the defines
190 # have to be put into the config.h file.
191 CIM_RECURSIVE_EVAL([$localedir], [localedir_eval])
192 AC_DEFINE_UNQUOTED([LOCALEDIR], ["$localedir_eval"],
193 [Define to the locale directory.])
195 CIM_RECURSIVE_EVAL([$libdir/AC_PACKAGE_NAME], [pkglibdir_eval])
196 AC_DEFINE_UNQUOTED([PKGLIBDIR], ["$pkglibdir_eval"],
197 [Define to the pkglib directory.])
199 # Create output files.
200 AC_CONFIG_FILES([Makefile
204 doc/doxygen-cppconsui.conf