[contrib] add a compute method
[hkl.git] / configure.ac
blob6f668ea08be1a63e80f6aa2a44af170babb1b6c1
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 *** logging ***
124 dnl ***************
126 OPTION_DEFAULT_OFF([logging], [enable the glib logging])
127 AM_CONDITIONAL([LOGGING], [test x$enable_logging != xno])
128 AM_COND_IF([LOGGING],
129         AC_DEFINE([LOGGING], [1], [activate the logging or not])
130         )
132 dnl ***********
133 dnl *** doc ***
134 dnl ***********
136 OPTION_DEFAULT_ON([hkl-doc], [build documentation])
137 AM_CONDITIONAL([HKL_DOC], [test x$enable_hkl_doc = xyes])
138 AM_COND_IF([HKL_DOC],
139            [dnl *** asymptote ***
140             AC_PATH_PROG([ASY], [asy], [echo])
141             dnl *** emacs ***
142             AC_PATH_PROG([EMACS], [emacs], [no])
143            ])
145 dnl *** gtk-doc ***
146 GTK_DOC_CHECK([1.9],[--flavour no-tmpl])
148 dnl *******************************
149 dnl *** add an option for hkl3d ***
150 dnl *******************************
152 OPTION_DEFAULT_OFF([hkl3d], [compile the hkl3d library])
154 AM_CONDITIONAL([HKL3D], [test x$enable_hkl3d != xno])
155 AM_COND_IF([HKL3D],
156            [PKG_CHECK_MODULES([G3D], [libg3d >= 0.0.8])
157             PKG_CHECK_MODULES([BULLET], [bullet >= 2.82])
158            dnl check for yaml
159            AC_SEARCH_LIBS([yaml_get_version], [yaml],
160                           [AC_CHECK_HEADERS([yaml.h], [],
161                                             [AC_MSG_ERROR([Could not find the yaml headers, please install yaml developement files])]
162                           )],
163                           [AC_MSG_ERROR([Could not find the libyaml runtime, please install yaml])]
164            )
165            YAML_CFLAGS=""
166            AC_SUBST(YAML_CFLAGS)
167            YAML_LIBS="-lyaml"
168            AC_SUBST(YAML_LIBS)
171 dnl ****************************************
172 dnl *** add an option for the ghkl build ***
173 dnl ****************************************
175 OPTION_DEFAULT_ON([gui], [do not compile the gui interface])
177 AM_CONDITIONAL([GUI], [test x$enable_gui = xyes])
178 AM_COND_IF([GUI],
179         [PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.0])
180         AM_COND_IF([HKL3D],
181                    [PKG_CHECK_MODULES([GLU], [glu >= 7.7.1])
182                     PKG_CHECK_MODULES([GTKGLEXT], [gtkglext-1.0 >= 1.2.0])
183         ])
186 dnl *********************
187 dnl *** introspection ***
188 dnl *********************
190 GOBJECT_INTROSPECTION_CHECK([0.6.7])
192 AM_COND_IF([HAVE_INTROSPECTION],
193         [PKG_CHECK_MODULES([GOBJECT], [gobject-2.0])])
196 dnl ***************
197 dnl *** contrib ***
198 dnl ***************
200 OPTION_DEFAULT_OFF([contrib], [compile the contrib part])
202 AM_CONDITIONAL([CONTRIB], [test x$enable_contrib != xno])
203 AM_COND_IF([CONTRIB],
204            [PKG_CHECK_MODULES([HDF5], [hdf5 >= 1.8.13])
207 AC_CONFIG_FILES([Makefile
208                  hkl/Makefile
209                  hkl/ccan/Makefile
210                  hkl.pc
211                  hkl3d/Makefile
212                  hkl3d.pc
213                  tests/Makefile
214                  tests/bindings/Makefile
215                  tests/tap/Makefile
216                  Documentation/Makefile
217                  Documentation/hkl.org
218                  Documentation/api/Makefile
219                  Documentation/figures/Makefile
220                  Documentation/sphinx/Makefile
221                  Documentation/sphinx/source/conf.py
222                  gui/Makefile
223                  data/Makefile
224                  contrib/Makefile
225                  contrib/sixs/Makefile
228 AC_OUTPUT