[hkl] fix the test suite due to binoculars new projection signature.
[hkl.git] / configure.ac
blob0c9a0bd9c0ee184d7a1f83e99865ac3cf885a431
1 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
2 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
3 m4_define([v_maj], [5])
4 m4_define([v_min], [0])
5 m4_define([v_mic], [0])
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 #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 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
20 AC_PREREQ([2.69])
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.
30 AC_PROG_AWK
31 AC_PROG_CC_C99
32 AC_PROG_CXX
33 AC_PROG_CPP
34 AC_PROG_INSTALL
35 AC_PROG_LN_S
36 AC_PROG_MAKE_SET
37 AC_PROG_RANLIB
38 LT_INIT
39 AM_SILENT_RULES
41 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
42 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
43 m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
44 m4_ifdef([v_rel], , [m4_define([v_rel], [])])
45 AC_DEFINE_UNQUOTED(VMAJ, [v_maj], [Major version])
46 AC_DEFINE_UNQUOTED(VMIN, [v_min], [Minor version])
47 AC_DEFINE_UNQUOTED(VMIC, [v_mic], [Micro version])
48 AC_DEFINE_UNQUOTED(VREV, [v_rev], [Revison])
49 version_info="lt_cur:lt_rev:lt_age"
50 release_info="v_rel"
51 AC_SUBST(version_info)
52 AC_SUBST(release_info)
53 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
54 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
55 VMAJ=v_maj
56 AC_SUBST(VMAJ)
58 # activate all the warnings
59 AX_CFLAGS_WARN_ALL
60 AX_CXXFLAGS_WARN_ALL
62 # Checks for libraries.
63 AX_PATH_GSL
64 AM_PATH_GLIB_2_0
66 # Checks for header files.
67 AC_HEADER_STDC
68 AC_HEADER_TIME
69 AC_FUNC_ALLOCA
70 AC_CHECK_HEADERS([fcntl.h float.h limits.h malloc.h memory.h stddef.h stdint.h stdlib.h string.h sys/param.h sys/time.h unistd.h])
72 # Checks for typedefs, structures, and compiler characteristics.
73 AC_C_CONST
74 AC_C_INLINE
75 AC_TYPE_INT16_T
76 AC_TYPE_INT32_T
77 AC_TYPE_INT64_T
78 AC_TYPE_INT8_T
79 AC_TYPE_PID_T
80 AC_TYPE_SIZE_T
81 AC_TYPE_UINT16_T
82 AC_TYPE_UINT32_T
83 AC_TYPE_UINT64_T
84 AC_TYPE_UINT8_T
86 # Checks for library functions.
87 AC_FUNC_ERROR_AT_LINE
88 AC_FUNC_MALLOC
89 AC_FUNC_REALLOC
90 AC_FUNC_VPRINTF
91 AC_FUNC_FORK
92 AC_CHECK_FUNCS([atexit dup2 fchdir floor getcwd getpagesize gettimeofday isascii memchr memmove memset mkdir pow putenv rmdir select sqrt strchr strcasecmp strdup strerror strncasecmp strrchr strstr strtol strtoul])
94 dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
95 dnl Create a new --enable option that defaults to being disabled.
96 dnl NAME is the base name of the option.  The shell variable enable_NAME
97 dnl   will be set to either the user's value (if the option is
98 dnl   specified; 'yes' for a plain --enable-NAME) or to 'no' (if the
99 dnl   option is not specified).  Note that the shell variable name is
100 dnl   constructed as autoconf does, by replacing non-alphanumeric
101 dnl   characters with "_".
102 dnl HELP-STRING is the help text for the option.
103 AC_DEFUN([OPTION_DEFAULT_OFF], [dnl
104   AC_ARG_ENABLE([$1],[AS_HELP_STRING([--enable-$1],[$2])],[],[dnl
105     m4_bpatsubst([enable_$1], [[^0-9a-z]], [_])=no])dnl
106 ])dnl
108 dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
109 dnl Create a new --enable option that defaults to being enabled.
110 dnl NAME is the base name of the option.  The shell variable enable_NAME
111 dnl   will be set to either the user's value (if the option is
112 dnl   specified; 'no' for a plain --enable-NAME) or to 'yes' (if the
113 dnl   option is not specified).  Note that the shell variable name is
114 dnl   constructed as autoconf does, by replacing non-alphanumeric
115 dnl   characters with "_".
116 dnl HELP-STRING is the help text for the option.
117 AC_DEFUN([OPTION_DEFAULT_ON], [dnl
118   AC_ARG_ENABLE([$1],[AS_HELP_STRING([--disable-$1],[$2])],[],[dnl
119     m4_bpatsubst([enable_$1], [[^0-9a-z]], [_])=yes])dnl
120 ])dnl
122 dnl ****************
123 dnl *** analyzer ***
124 dnl ****************
126 OPTION_DEFAULT_OFF([analyzer], [enable gcc-10 -fanalyzer])
127 AM_CONDITIONAL([ANALYZER], [test x$enable_analyzer != xno])
128 AM_COND_IF([ANALYZER],
129         AX_CHECK_COMPILE_FLAG([-fanalyzer], [CFLAGS="$CFLAGS -fanalyzer"], [], [])
132 dnl ***************
133 dnl *** logging ***
134 dnl ***************
136 OPTION_DEFAULT_OFF([logging], [enable the glib logging])
137 AM_CONDITIONAL([LOGGING], [test x$enable_logging != xno])
138 AM_COND_IF([LOGGING],
139         AC_DEFINE([LOGGING], [1], [activate the logging or not])
140         )
142 dnl ***********
143 dnl *** doc ***
144 dnl ***********
146 OPTION_DEFAULT_ON([hkl-doc], [build documentation])
147 AM_CONDITIONAL([HKL_DOC], [test x$enable_hkl_doc = xyes])
148 AM_COND_IF([HKL_DOC],
149            [dnl *** asymptote ***
150             AC_PATH_PROG([ASY], [asy], [echo])
151             dnl *** emacs ***
152             AC_PATH_PROG([EMACS], [emacs], [no])
153             dnl *** gnuplot ***
154             AC_PATH_PROG([GNUPLOT], [gnuplot], [echo])
155            ])
157 dnl *** mathkjax ***
158 AC_ARG_WITH([mathjax],
159             [AS_HELP_STRING([--with-mathjax],[use mathjax (default is "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML")])],
160             [use_mathjax=$withval],
161             [use_mathjax="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"])
163 MATHJAX_PATH=$use_mathjax
164 AC_SUBST(MATHJAX_PATH)
166 dnl *** gtk-doc ***
167 GTK_DOC_CHECK([1.9],[--flavour no-tmpl])
169 dnl **********************************************
170 dnl *** add an option for the binoculars build ***
171 dnl **********************************************
173 OPTION_DEFAULT_ON([binoculars], [do not compile the binoculars API])
175 AM_CONDITIONAL([BINOCULARS], [test x$enable_binoculars = xyes])
176 AM_COND_IF([BINOCULARS],
177            [PKG_CHECK_MODULES([HDF5], [hdf5-serial >= 1.8.13])
178             PKG_CHECK_MODULES([CGLM], [cglm >= 0.7])
181 dnl *******************************
182 dnl *** add an option for hkl3d ***
183 dnl *******************************
185 OPTION_DEFAULT_OFF([hkl3d], [compile the hkl3d library])
187 AM_CONDITIONAL([HKL3D], [test x$enable_hkl3d != xno])
188 AM_COND_IF([HKL3D],
189            [PKG_CHECK_MODULES([G3D], [libg3d >= 0.0.8])
190             PKG_CHECK_MODULES([BULLET], [bullet >= 2.82])
191            dnl check for yaml
192            AC_SEARCH_LIBS([yaml_get_version], [yaml],
193                           [AC_CHECK_HEADERS([yaml.h], [],
194                                             [AC_MSG_ERROR([Could not find the yaml headers, please install yaml developement files])]
195                           )],
196                           [AC_MSG_ERROR([Could not find the libyaml runtime, please install yaml])]
197            )
198            YAML_CFLAGS=""
199            AC_SUBST(YAML_CFLAGS)
200            YAML_LIBS="-lyaml"
201            AC_SUBST(YAML_LIBS)
204 dnl ****************************************
205 dnl *** add an option for the ghkl build ***
206 dnl ****************************************
208 OPTION_DEFAULT_ON([gui], [do not compile the gui interface])
210 AM_CONDITIONAL([GUI], [test x$enable_gui = xyes])
211 AM_COND_IF([GUI],
212         [PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.22])
213         AM_COND_IF([HKL3D],
214                    [PKG_CHECK_MODULES([GL], [gl >= 1.0.0])
215                     PKG_CHECK_MODULES([GLU], [glu >= 7.7.1])
216         ])
219 dnl *********************
220 dnl *** introspection ***
221 dnl *********************
223 GOBJECT_INTROSPECTION_CHECK([0.6.7])
225 AM_COND_IF([HAVE_INTROSPECTION],
226         [PKG_CHECK_MODULES([GOBJECT], [gobject-2.0])])
229 dnl ***************
230 dnl *** contrib ***
231 dnl ***************
233 OPTION_DEFAULT_OFF([contrib], [compile the contrib part])
235 AM_CONDITIONAL([CONTRIB], [test x$enable_contrib != xno])
237 AC_CONFIG_FILES([Makefile
238                  binoculars/Makefile
239                  hkl/Makefile
240                  hkl/api2/Makefile
241                  hkl/ccan/Makefile
242                  hkl.pc
243                  hkl-binoculars.pc
244                  hkl3d/Makefile
245                  hkl3d.pc
246                  tests/Makefile
247                  tests/bindings/Makefile
248                  tests/tap/Makefile
249                  third-party/Makefile
250                  Documentation/Makefile
251                  Documentation/hkl.org
252                  Documentation/api/Makefile
253                  Documentation/figures/Makefile
254                  Documentation/sphinx/Makefile
255                  Documentation/sphinx/source/conf.py
256                  gui/Makefile
257                  data/Makefile
258                  contrib/Makefile
259                  contrib/cristal/Makefile
260                  contrib/cristal/xrays/Makefile
261                  contrib/haskell/Makefile
262                  contrib/sixs/Makefile
263                  contrib/petra3/Makefile
266 AC_OUTPUT