3 m4_esyscmd([misc/git-version-gen .tarball-version]),
4 [http://bugzilla.centerim.org/], [centerim5],
5 [http://www.centerim.org/])
6 # Prevent AC_PROG_CC, AC_PROG_CXX from initializing CFLAGS and CXXFLAGS.
9 AC_CONFIG_SRCDIR([config.h.in])
10 AC_CONFIG_AUX_DIR([config])
11 AC_CONFIG_HEADER([config.h])
12 AC_CONFIG_MACRO_DIR([m4])
13 AM_INIT_AUTOMAKE([-Wall subdir-objects])
14 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
18 # Checks for programs.
22 AX_CXX_COMPILE_STDCXX_11([noext])
25 LT_INIT([disable-static])
29 AC_ARG_ENABLE([strict], [AC_HELP_STRING([--enable-strict],
30 [enable extra compiler warnings during build])])
31 AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug],
32 [compile with debugging support])])
34 # If not --enable-debug then try to set -O2 as default.
35 AS_IF([test "$enable_debug" != yes],
36 [save_cflags="$CFLAGS"]
38 [AC_MSG_CHECKING([whether CC supports -O2])]
40 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
41 [AC_MSG_RESULT([yes])]
42 [AM_CFLAGS="$AM_CFLAGS -O2"],
43 [AC_MSG_RESULT([no])])]
45 [CFLAGS="$save_cflags"]
47 [save_cxxflags="$CXXFLAGS"]
49 [AC_MSG_CHECKING([whether CXX supports -O2])]
51 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
52 [AC_MSG_RESULT([yes])]
53 [AM_CXXFLAGS="$AM_CXXFLAGS -O2"],
54 [AC_MSG_RESULT([no])])]
56 [CXXFLAGS="$save_cxxflags"])
58 # If --enable-strict is specified then enable compilation warnings.
59 AS_IF([test "$enable_strict" = yes],
60 [save_cflags="$CFLAGS"]
61 [CFLAGS="-Wall -Wextra -pedantic"]
62 [AC_MSG_CHECKING([whether CC supports -Wall -Wextra -pedantic])]
64 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
65 [AC_MSG_RESULT([yes])],
67 [AC_MSG_ERROR([the C compiler does not recognize options -Wall -Wextra -pedantic that are needed by --enable-strict])])]
69 [CFLAGS="$save_cflags"]
70 [AM_CFLAGS="$AM_CFLAGS -Wall -Wextra -pedantic"]
72 [save_cxxflags="$CXXFLAGS"]
73 [CXXFLAGS="-Wall -Wextra -pedantic -Wno-long-long -Wsuggest-override"]
74 [AC_MSG_CHECKING([whether CXX supports -Wall -Wextra -pedantic -Wno-long-long -Wsuggest-override])]
76 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
77 [AC_MSG_RESULT([yes])],
79 [AC_MSG_ERROR([the C++ compiler does not recognize options -Wall -Wextra -pedantic -Wno-long-long -Wsuggest-override that are needed by --enable-strict])])]
81 [CXXFLAGS="$save_cxxflags"]
82 [AM_CXXFLAGS="$AM_CXXFLAGS -Wall -Wextra -pedantic -Wno-long-long -Wsuggest-override"])
84 # If --enable-debug is specified then compile with -g -O0.
85 AS_IF([test "$enable_debug" = yes],
86 [save_cflags="$CFLAGS"]
88 [AC_MSG_CHECKING([whether CC supports -g -O0])]
90 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
91 [AC_MSG_RESULT([yes])],
93 [AC_MSG_ERROR([the C compiler does not recognize options -g -O0 that are needed by --enable-debug])])]
95 [CFLAGS="$save_cflags"]
96 [AM_CFLAGS="$AM_CFLAGS -g -O0"]
98 [save_cxxflags="$CXXFLAGS"]
100 [AC_MSG_CHECKING([whether CXX supports -g -O0])]
101 [AC_LANG_PUSH([C++])]
102 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
103 [AC_MSG_RESULT([yes])],
104 [AC_MSG_RESULT([no])]
105 [AC_MSG_ERROR([the C++ compiler does not recognize options -g -O0 that are needed by --enable-debug])])]
107 [CXXFLAGS="$save_cxxflags"]
108 [AM_CXXFLAGS="$AM_CXXFLAGS -g -O0"])
109 AC_SUBST([AM_CFLAGS])
110 AC_SUBST([AM_CXXFLAGS])
111 AS_IF([test "$enable_debug" = yes],
112 [AC_DEFINE([DEBUG], [1], [Define if debugging is enabled.])])
114 # Checks for libraries.
116 # gettext -- v0.18.1 was released on 2010-06-04.
117 AM_GNU_GETTEXT([external])
118 AM_GNU_GETTEXT_VERSION([0.18.1])
120 # libpurple -- v2.9.0 is needed because of PurpleConvChatBuddy::ui_data, this
121 # version was released on 2011-06-23.
122 # find . \( -name \*.c -or -name \*.cpp -o -name \*.h \) -print0 | xargs -0 sed -n 's/.*\(purple_[^( ]*\)(.*/\1/p' | sort -u | less
123 PKG_CHECK_MODULES([PURPLE], [purple >= 2.7.0])
125 # glib -- v2.32.0 is needed because of g_environ_setenv(), this version was
126 # released on 2012-03-24.
127 # find . \( -name \*.c -o -name \*.cpp -o -name \*.h \) -print0 | xargs -0 sed -n 's/.*\(g_[^ (]*\)(.*/\1/p' | sort -u | less
128 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.32.0])
130 # libsigc++ -- v2.2.0 was released on 2008-02-22.
131 PKG_CHECK_MODULES([SIGC], [sigc++-2.0 >= 2.2.0])
133 # ncursesw -- v5.8 was released on 2011-02-26.
134 PKG_CHECK_MODULES([NCURSESW], [ncursesw >= 5.8])
136 # CIM_RECURSIVE_EVAL(VALUE, RESULT)
137 # =================================
138 # Interpolate the VALUE in loop until it does not change, and set the result
140 # WARNING: It is easy to get an infinite loop with some unsane input.
141 # Taken from http://ac-archive.sourceforge.net/adl/relpaths.html.
142 AC_DEFUN([CIM_RECURSIVE_EVAL],
144 $2=`(test "$prefix" = NONE && prefix="$ac_default_prefix"
145 test "$exec_prefix" = NONE && exec_prefix="$prefix"
147 while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
148 _lcl_receval_old="[$]_lcl_receval"
149 eval _lcl_receval="\"[$]_lcl_receval\""
151 echo "[$]_lcl_receval")`])
153 # Define locale and pkgdir directories. It would be nicer to do this in
154 # Makefile.ams by adding appropriate '-D' compiler options to respective
155 # CPPFLAGS, which is a common solution that can be seen in other projects. In
156 # that case, it is not needed to resolve the paths at the configure time using
157 # the CIM_RECURSIVE_EVAL function. However this solution unfortunately does not
158 # work correctly when values of the defines are changed, the source files that
159 # use these defines do not get correctly recompiled. To fix this, the defines
160 # have to be put into the config.h file.
161 CIM_RECURSIVE_EVAL([$localedir], [localedir_eval])
162 AC_DEFINE_UNQUOTED([LOCALEDIR], ["$localedir_eval"],
163 [Define to the locale directory.])
165 CIM_RECURSIVE_EVAL([$libdir/AC_PACKAGE_NAME], [pkglibdir_eval])
166 AC_DEFINE_UNQUOTED([PKGLIBDIR], ["$pkglibdir_eval"],
167 [Define to the pkglib directory.])
169 # Create output files.
170 AC_CONFIG_FILES([Makefile
174 doc/doxygen-cppconsui.conf