[binoculars-ng] added an old sixs test file
[hkl.git] / configure.ac
blob1ef459dbe8eb20743094415ce3f718a1112c4344
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             dnl *** xvfb-run ***
156             AC_PATH_PROG([XVFB_RUN], [xvfb-run], [echo])
157            ])
159 dnl *** mathkjax ***
160 AC_ARG_WITH([mathjax],
161             [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")])],
162             [use_mathjax=$withval],
163             [use_mathjax="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"])
165 MATHJAX_PATH=$use_mathjax
166 AC_SUBST(MATHJAX_PATH)
168 dnl *** gtk-doc ***
169 GTK_DOC_CHECK([1.9],[--flavour no-tmpl])
171 dnl **********************************************
172 dnl *** add an option for the binoculars build ***
173 dnl **********************************************
175 OPTION_DEFAULT_ON([binoculars], [do not compile the binoculars API])
177 AM_CONDITIONAL([BINOCULARS], [test x$enable_binoculars = xyes])
178 AM_COND_IF([BINOCULARS],
179            [PKG_CHECK_MODULES([HDF5], [hdf5-serial >= 1.8.13])
180             PKG_CHECK_MODULES([CGLM], [cglm >= 0.7])
181             PKG_CHECK_MODULES([INIH], [inih >= 55])
182             AC_PATH_PROG([GHC], [ghc])
183             if test -z "$GHC" ; then
184                AC_MSG_ERROR([ghc was not found])
185             fi
186             AC_PATH_PROG([HSC2HS], [hsc2hs])
187             if test -z "$HSC2HS" ; then
188                AC_MSG_ERROR([hsc2hs was not found])
189             fi
190             AC_PATH_PROG([GHCPKG], [ghc-pkg])
191             if test -z "$GHCPKG" ; then
192                AC_MSG_ERROR([ghc-pkg was not found])
193             fi
196 dnl *******************************
197 dnl *** add an option for hkl3d ***
198 dnl *******************************
200 OPTION_DEFAULT_OFF([hkl3d], [compile the hkl3d library])
202 AM_CONDITIONAL([HKL3D], [test x$enable_hkl3d != xno])
203 AM_COND_IF([HKL3D],
204            [PKG_CHECK_MODULES([G3D], [libg3d >= 0.0.8])
205             PKG_CHECK_MODULES([BULLET], [bullet >= 2.82])
206            dnl check for yaml
207            AC_SEARCH_LIBS([yaml_get_version], [yaml],
208                           [AC_CHECK_HEADERS([yaml.h], [],
209                                             [AC_MSG_ERROR([Could not find the yaml headers, please install yaml developement files])]
210                           )],
211                           [AC_MSG_ERROR([Could not find the libyaml runtime, please install yaml])]
212            )
213            YAML_CFLAGS=""
214            AC_SUBST(YAML_CFLAGS)
215            YAML_LIBS="-lyaml"
216            AC_SUBST(YAML_LIBS)
219 dnl ****************************************
220 dnl *** add an option for the ghkl build ***
221 dnl ****************************************
223 OPTION_DEFAULT_ON([gui], [do not compile the gui interface])
225 AM_CONDITIONAL([GUI], [test x$enable_gui = xyes])
226 AM_COND_IF([GUI],
227         [PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.22])
228         AM_COND_IF([HKL3D],
229                    [PKG_CHECK_MODULES([GL], [gl >= 1.0.0])
230                     PKG_CHECK_MODULES([GLU], [glu >= 7.7.1])
231         ])
234 dnl *********************
235 dnl *** introspection ***
236 dnl *********************
238 GOBJECT_INTROSPECTION_CHECK([0.6.7])
240 AM_COND_IF([HAVE_INTROSPECTION],
241         [PKG_CHECK_MODULES([GOBJECT], [gobject-2.0])])
244 dnl ***************
245 dnl *** contrib ***
246 dnl ***************
248 OPTION_DEFAULT_OFF([contrib], [compile the contrib part])
250 AM_CONDITIONAL([CONTRIB], [test x$enable_contrib != xno])
253 dnl ******************
254 dnl *** datatype99 ***
255 dnl ******************
257 OPTION_DEFAULT_OFF([datatype99], [use the system datatype99])
258 AC_CHECK_HEADERS([datatype99.h], [], [enable_datatype99=no])
260 DATATYPE99_CFLAGS="-ftrack-macro-expansion=0"
261 AM_CONDITIONAL([DATATYPE99], [test x$enable_datatype99 != xno])
262 AM_COND_IF([DATATYPE99],
263         [],
264         [DATATYPE99_CFLAGS=$DATATYPE99_CFLAGS' -I$(top_srcdir)/third-party/']
265         )
266 AC_SUBST(DATATYPE99_CFLAGS)
269 AC_CONFIG_FILES([Makefile
270                  binoculars-ng/binoculars/Makefile
271                  binoculars-ng/Makefile
272                  hkl/Makefile
273                  hkl/api2/Makefile
274                  hkl/ccan/Makefile
275                  hkl.pc
276                  hkl3d/Makefile
277                  hkl3d.pc
278                  tests/Makefile
279                  tests/bindings/Makefile
280                  tests/tap/Makefile
281                  third-party/Makefile
282                  Documentation/Makefile
283                  Documentation/hkl.org
284                  Documentation/api/Makefile
285                  Documentation/figures/Makefile
286                  Documentation/sphinx/Makefile
287                  Documentation/sphinx/source/conf.py
288                  gui/Makefile
289                  data/Makefile
290                  contrib/Makefile
291                  contrib/cristal/Makefile
292                  contrib/cristal/xrays/Makefile
293                  contrib/sixs/Makefile
294                  contrib/petra3/Makefile
297 AC_OUTPUT