1 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
2 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
3 m4_define([v_maj], [4])
4 m4_define([v_min], [99])
5 m4_define([v_mic], [99])
6 m4_define([v_rev], m4_esyscmd([(git rev-list --count HEAD 2>/dev/null || echo 0) | tr -d '\n']))dnl
7 ##-- When released, remove the dnl on the below line
8 dnl m4_undefine([v_rev])
9 ##-- When doing snapshots - change soname. remove dnl on below line
10 dnl m4_define([relname], [ver-pre-svn-07])
11 dnl m4_define([v_rel], [-release relname])
12 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
13 m4_ifdef([v_rev], [m4_define([v_ver], [v_maj.v_min.v_mic.v_rev])], [m4_define([v_ver], [v_maj.v_min.v_mic])])
14 m4_define([lt_cur], m4_eval(v_maj + v_min))
15 m4_define([lt_rev], v_mic)
16 m4_define([lt_age], v_min)
17 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
18 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
21 AC_INIT([hkl],[v_ver],[picca@synchrotron-soleil.fr])
22 AC_CONFIG_SRCDIR([config.h.in])
23 AC_CONFIG_HEADERS([config.h])
24 AC_CONFIG_MACRO_DIR([m4])
25 AC_CONFIG_AUX_DIR(config)
27 AM_INIT_AUTOMAKE([silent-rules tar-ustar -Wno-portability subdir-objects])
29 # Checks for programs.
40 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
41 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
42 m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
43 m4_ifdef([v_rel], , [m4_define([v_rel], [])])
44 AC_DEFINE_UNQUOTED(VMAJ, [v_maj], [Major version])
45 AC_DEFINE_UNQUOTED(VMIN, [v_min], [Minor version])
46 AC_DEFINE_UNQUOTED(VMIC, [v_mic], [Micro version])
47 AC_DEFINE_UNQUOTED(VREV, [v_rev], [Revison])
48 version_info="lt_cur:lt_rev:lt_age"
50 AC_SUBST(version_info)
51 AC_SUBST(release_info)
52 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
53 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
57 # Checks for libraries.
61 # Checks for header files.
65 AC_CHECK_HEADERS([float.h limits.h malloc.h memory.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])
67 # Checks for typedefs, structures, and compiler characteristics.
80 # Checks for library functions.
85 AC_CHECK_FUNCS([floor getcwd gettimeofday memmove memset pow select sqrt strchr strdup strstr])
87 dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
88 dnl Create a new --enable option that defaults to being disabled.
89 dnl NAME is the base name of the option. The shell variable enable_NAME
90 dnl will be set to either the user's value (if the option is
91 dnl specified; 'yes' for a plain --enable-NAME) or to 'no' (if the
92 dnl option is not specified). Note that the shell variable name is
93 dnl constructed as autoconf does, by replacing non-alphanumeric
94 dnl characters with "_".
95 dnl HELP-STRING is the help text for the option.
96 AC_DEFUN([OPTION_DEFAULT_OFF], [dnl
97 AC_ARG_ENABLE([$1],[AS_HELP_STRING([--enable-$1],[$2])],[],[dnl
98 m4_bpatsubst([enable_$1], [[^0-9a-z]], [_])=no])dnl
101 dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
102 dnl Create a new --enable option that defaults to being enabled.
103 dnl NAME is the base name of the option. The shell variable enable_NAME
104 dnl will be set to either the user's value (if the option is
105 dnl specified; 'no' for a plain --enable-NAME) or to 'yes' (if the
106 dnl option is not specified). Note that the shell variable name is
107 dnl constructed as autoconf does, by replacing non-alphanumeric
108 dnl characters with "_".
109 dnl HELP-STRING is the help text for the option.
110 AC_DEFUN([OPTION_DEFAULT_ON], [dnl
111 AC_ARG_ENABLE([$1],[AS_HELP_STRING([--disable-$1],[$2])],[],[dnl
112 m4_bpatsubst([enable_$1], [[^0-9a-z]], [_])=yes])dnl
119 OPTION_DEFAULT_OFF([logging], [enable the glib logging])
120 AM_CONDITIONAL([LOGGING], [test x$enable_logging != xno])
121 AM_COND_IF([LOGGING],
122 AC_DEFINE([LOGGING], [1], [activate the logging or not])
129 GTK_DOC_CHECK([1.9],[--flavour no-tmpl])
135 AC_PATH_PROG([ASY], [asy], [echo])
137 dnl *******************************
138 dnl *** add an option for hkl3d ***
139 dnl *******************************
141 OPTION_DEFAULT_OFF([hkl3d], [compile the hkl3d library])
143 AM_CONDITIONAL([HKL3D], [test x$enable_hkl3d != xno])
145 [PKG_CHECK_MODULES([G3D], [libg3d >= 0.0.8])
146 PKG_CHECK_MODULES([BULLET], [bullet >= 2.82])
148 AC_SEARCH_LIBS([yaml_get_version], [yaml],
149 [AC_CHECK_HEADERS([yaml.h], [],
150 [AC_MSG_ERROR([Could not find the yaml headers, please install yaml developement files])]
152 [AC_MSG_ERROR([Could not find the libyaml runtime, please install yaml])]
155 AC_SUBST(YAML_CFLAGS)
160 dnl ****************************************
161 dnl *** add an option for the ghkl build ***
162 dnl ****************************************
164 OPTION_DEFAULT_ON([gui], [do not compile the gui interface])
166 AM_CONDITIONAL([GUI], [test x$enable_gui = xyes])
168 [PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.0])
170 [PKG_CHECK_MODULES([GLU], [glu >= 7.7.1])
171 PKG_CHECK_MODULES([GTKGLEXT], [gtkglext-1.0 >= 1.2.0])
175 dnl ************************************
176 dnl *** Enable lcov coverage reports ***
177 dnl ************************************
180 AS_HELP_STRING([--enable-gcov],
182 [use_gcov=$enableval],
185 if test "x$use_gcov" = "xyes"; then
187 if test "$GCC" != "yes"; then
188 AC_MSG_ERROR([GCC is required for --enable-gcov])
191 dnl Check if ccache is being used
192 AC_CHECK_PROG(SHTOOL, shtool, shtool)
193 case `$SHTOOL path $CC` in
194 *ccache*[)] gcc_ccache=yes;;
198 if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
199 AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
202 ltp_version_list="1.6 1.7 1.8 1.9"
203 AC_CHECK_PROG(LTP, lcov, lcov)
204 AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
207 AC_CACHE_CHECK([for ltp version], glib_cv_ltp_version, [
208 glib_cv_ltp_version=invalid
209 ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
210 for ltp_check_version in $ltp_version_list; do
211 if test "$ltp_version" = "$ltp_check_version"; then
212 glib_cv_ltp_version="$ltp_check_version (ok)"
217 ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
218 AC_MSG_ERROR([$ltp_msg])
221 case $glib_cv_ltp_version in
223 ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
224 AC_MSG_ERROR([$ltp_msg])
229 if test -z "$LTP_GENHTML"; then
230 AC_MSG_ERROR([Could not find genhtml from the LTP package])
233 AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
235 dnl Remove all optimization flags from CFLAGS
237 CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
238 CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9]*//g'`
241 dnl Add the special gcc flags
242 CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
243 CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage"
244 LDFLAGS="$LDFLAGS -lgcov"
247 dnl *********************
248 dnl *** introspection ***
249 dnl *********************
251 GOBJECT_INTROSPECTION_CHECK([0.6.7])
253 AM_COND_IF([HAVE_INTROSPECTION],
254 [PKG_CHECK_MODULES([GOBJECT], [gobject-2.0])])
261 AC_DEFINE([HAVE_SECTION_START_STOP], [1], ["do we support section or not"])
262 AC_DEFINE([HAVE_TYPEOF], [1], ["do we have typeof"])
263 AC_DEFINE([HAVE_STATEMENT_EXPR], [1], ["do we have typeof"])
264 AC_DEFINE([HAVE_ATTRIBUTE_COLD], [1], ["do we have typeof"])
265 AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1], ["do we have typeof"])
266 AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1], ["do we have typeof"])
267 AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1], ["do we have typeof"])
268 AC_DEFINE([HAVE_BUILTIN_CONSTANT_P], [1], ["do we have typeof"])
269 AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1], ["do we have typeof"])
270 AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1], ["do we have typeof"])
271 AC_DEFINE([HAVE_ATTRIBUTE_USED], [1], ["do we have typeof"])
272 AC_DEFINE([HAVE_BUILTIN_TYPES_COMPATIBLE_P], [1], ["do we have typeof"])
274 AC_CONFIG_FILES([Makefile
281 tests/bindings/Makefile
283 Documentation/Makefile
284 Documentation/hkl.org
285 Documentation/api/Makefile
286 Documentation/figures/Makefile
287 Documentation/sphinx/Makefile
288 Documentation/sphinx/source/conf.py