remove hkl_axis_get/set_changed
[hkl.git] / configure.ac
blob6bbb2c8b649183cee15de37c9be6b4b7a11fddba
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ([2.69])
5 AC_INIT([hkl],[5.0.0],[picca@synchrotron-soleil.fr])
6 AC_CONFIG_SRCDIR([config.h.in])
7 AC_CONFIG_HEADERS([config.h])
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_AUX_DIR(config)
11 AM_INIT_AUTOMAKE([silent-rules tar-ustar -Wno-portability])
13 # Checks for programs.
14 AC_PROG_CXX
15 AC_PROG_AWK
16 AC_PROG_CC_C99
17 AC_PROG_CPP
18 AC_PROG_INSTALL
19 AC_PROG_LN_S
20 AC_PROG_MAKE_SET
21 LT_INIT
22 AM_SILENT_RULES
24 # Checks for libraries.
25 AX_PATH_GSL
27 # Checks for header files.
28 AC_HEADER_STDBOOL
29 AC_HEADER_STDC
30 AC_HEADER_TIME
31 AC_FUNC_ALLOCA
32 AC_CHECK_HEADERS([float.h limits.h malloc.h memory.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])
34 # Checks for typedefs, structures, and compiler characteristics.
35 AC_C_CONST
36 AC_C_INLINE
37 AC_TYPE_INT16_T
38 AC_TYPE_INT32_T
39 AC_TYPE_INT64_T
40 AC_TYPE_INT8_T
41 AC_TYPE_SIZE_T
42 AC_TYPE_UINT16_T
43 AC_TYPE_UINT32_T
44 AC_TYPE_UINT64_T
45 AC_TYPE_UINT8_T
47 # Checks for library functions.
48 AC_FUNC_ERROR_AT_LINE
49 AC_FUNC_MALLOC
50 AC_FUNC_REALLOC
51 AC_FUNC_VPRINTF
52 AC_CHECK_FUNCS([floor getcwd gettimeofday memmove memset pow select sqrt strchr strdup strstr])
54 dnl ***************
55 dnl *** gtk-doc ***
56 dnl ***************
58 GTK_DOC_CHECK([1.9],[--flavour no-tmpl])
60 dnl ***********
61 dnl *** asy ***
62 dnl ***********
64 AC_PATH_PROG([ASY], [asy], [echo])
66 dnl *********************************************
67 dnl *** took from the bullet configure script ***
68 dnl *********************************************
70 AC_CANONICAL_HOST
71 case "$host" in
72         *-*-mingw*|*-*-cygwin*)
73                 AC_DEFINE(PLATFORM_WIN32, 1, [Platform is Win32])
74                 opengl_LIBS="-lunsupported_platform"
75                 PLATFORM_STRING="Win32"
76                 ;;
77         *-*-linux*)
78                 AC_DEFINE(PLATFORM_LINUX, 1, [Platform is Linux])
79                 opengl_LIBS="-lGL -lGLU"
80                 PLATFORM_STRING="Linux"
81                 ;;
82         *-*-darwin*)
83                 AC_DEFINE(PLATFORM_APPLE, 1, [Platform is Apple])
84                 opengl_LIBS="-framework AGL -framework OpenGL -framework GLUT"
85                 PLATFORM_STRING="Apple"
86                 ;;
87         *)
88                 AC_MSG_WARN([*** Please add $host to configure.ac checks!])
89                 ;;
90 esac
91 AC_SUBST(opengl_LIBS)
93 case "$host" in
94         i?86-* | k?-* | athlon-* | pentium*-)
95                 AC_DEFINE(ARCH_X86, 1, [Architecture is x86])
96                 ARCH_SPECIFIC_CFLAGS=""
97                 ARCH_STRING="X86"
98                 ;;
99         x86_64-*)
100                 AC_DEFINE(ARCH_X86_64, 1, [Architecture is x86-64])
101                 ARCH_SPECIFIC_CFLAGS="-DUSE_ADDR64"
102                 ARCH_STRING="X86-64"
103                 ;;
104         ppc-* | powerpc-*)
105                 AC_DEFINE(ARCH_PPC, 1, [Architecture is PowerPC])
106                 ARCH_SPECIFIC_CFLAGS=""
107                 ARCH_STRING="PowerPC"
108                 ;;
109         *)
110                 AC_MSG_ERROR([Unknown Architecture])
111                 ;;
112 esac
113 AC_C_BIGENDIAN
115 #----------------------------------------------------------------------------
116 # Package configuration switches.
117 #----------------------------------------------------------------------------
118 AC_ARG_ENABLE([multithreaded],
119         [AS_HELP_STRING([--enable-multithreaded],[build BulletMultiThreaded (default NO)])],
120         [disable_multithreaded=no], [disable_multithreaded=yes])
121 AC_MSG_CHECKING([BulletMultiThreaded])
122 AS_IF([test "$disable_multithreaded" = yes], [build_multithreaded=no], [build_multithreaded=yes])
123 AC_MSG_RESULT([$build_multithreaded])
124 AM_CONDITIONAL([CONDITIONAL_BUILD_MULTITHREADED], [test "$build_multithreaded" = yes])
126 AC_ARG_ENABLE([demos],
127     [AS_HELP_STRING([--disable-demos],
128             [disable Bullet demos])],
129     [],
130     [enable_demos=yes])
131 AM_CONDITIONAL([CONDITIONAL_BUILD_DEMOS], [false])
132 if test "x$enable_demos" != xno; then
133     AC_MSG_NOTICE([Building Bullet demos])
134     AM_CONDITIONAL([CONDITIONAL_BUILD_DEMOS],[true])
139 AC_ARG_ENABLE([debug],
140     [AS_HELP_STRING([--enable-debug],[build with debugging information (default NO)])],
141     [], [enable_debug=no])
143 AC_MSG_CHECKING([build mode])
144 AS_IF([test $enable_debug = yes], [build_mode=debug], [build_mode=optimize])
145 AC_MSG_RESULT([$build_mode])
147 CFLAGS="$ARCH_SPECIFIC_CFLAGS $CFLAGS"
148 CXXFLAGS="$ARCH_SPECIFIC_CFLAGS $CXXFLAGS $CFLAGS"
150 ### end bullet configure script
152 dnl *******************************
153 dnl *** add an option for hkl3d ***
154 dnl *******************************
156 AC_ARG_ENABLE([hkl3d],
157         AS_HELP_STRING([--disable-hkl3d],
158                 [do not compile the hkl3d library]),
159         [],
160         [enable_hkl3d=yes])
161 AM_CONDITIONAL([HKL3D], [test x$enable_hkl3d = xyes])
162 AM_COND_IF([HKL3D],
163            [PKG_CHECK_MODULES([G3D], [libg3d >= 0.0.8])
164            dnl check for yaml
165            AC_SEARCH_LIBS([yaml_get_version], [yaml],
166                           [AC_CHECK_HEADERS([yaml.h], [],
167                                             [AC_MSG_ERROR([Could not find the yaml headers, please install yaml developement files])]
168                           )],
169                           [AC_MSG_ERROR([Could not find the libyaml runtime, please install yaml])]
170            )
171            YAML_CFLAGS=""
172            AC_SUBST(YAML_CFLAGS)
173            YAML_LIBS="-lyaml"
174            AC_SUBST(YAML_LIBS)
177 dnl ****************************************
178 dnl *** add an option for the ghkl build ***
179 dnl ****************************************
181 AC_ARG_ENABLE([gui],
182         AS_HELP_STRING([--disable-gui],
183                 [do not compile the gui interface]),
184         [],
185         [enable_gui=yes])
186 AM_CONDITIONAL([GUI], [test x$enable_gui = xyes])
187 AM_COND_IF([GUI],
188         [PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.18])
189         AM_COND_IF([HKL3D],
190                    [PKG_CHECK_MODULES([GLU], [glu >= 7.7.1])
191                     PKG_CHECK_MODULES([GTKGLEXTMM], [gtkglextmm-1.2])
192         ])
195 dnl ************************************
196 dnl *** Enable lcov coverage reports ***
197 dnl ************************************
199 AC_ARG_ENABLE(gcov,
200         AS_HELP_STRING([--enable-gcov],
201                 [Enable gcov]),
202         [use_gcov=$enableval],
203         [use_gcov=no])
205 if test "x$use_gcov" = "xyes"; then
206    dnl we need gcc:
207    if test "$GCC" != "yes"; then
208       AC_MSG_ERROR([GCC is required for --enable-gcov])
209    fi
211   dnl Check if ccache is being used
212   AC_CHECK_PROG(SHTOOL, shtool, shtool)
213   case `$SHTOOL path $CC` in
214     *ccache*[)] gcc_ccache=yes;;
215     *[)] gcc_ccache=no;;
216   esac
218   if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
219     AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
220   fi
222   ltp_version_list="1.6 1.7 1.8 1.9"
223   AC_CHECK_PROG(LTP, lcov, lcov)
224   AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
226   if test "$LTP"; then
227     AC_CACHE_CHECK([for ltp version], glib_cv_ltp_version, [
228       glib_cv_ltp_version=invalid
229       ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
230       for ltp_check_version in $ltp_version_list; do
231         if test "$ltp_version" = "$ltp_check_version"; then
232           glib_cv_ltp_version="$ltp_check_version (ok)"
233         fi
234       done
235     ])
236   else
237     ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
238     AC_MSG_ERROR([$ltp_msg])
239   fi
241   case $glib_cv_ltp_version in
242     ""|invalid[)]
243       ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
244       AC_MSG_ERROR([$ltp_msg])
245       LTP="exit 0;"
246       ;;
247   esac
249   if test -z "$LTP_GENHTML"; then
250     AC_MSG_ERROR([Could not find genhtml from the LTP package])
251   fi
253   AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
255   dnl Remove all optimization flags from CFLAGS
256   changequote({,})
257   CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
258   CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9]*//g'`
259   changequote([,])
261   dnl Add the special gcc flags
262   CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
263   CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage"
264   LDFLAGS="$LDFLAGS -lgcov"
267 dnl *********************
268 dnl *** introspection ***
269 dnl *********************
271 GOBJECT_INTROSPECTION_CHECK([0.6.7])
273 AM_COND_IF([HAVE_INTROSPECTION],
274         [PKG_CHECK_MODULES([GOBJECT], [gobject-2.0])
275         AM_PATH_GLIB_2_0])
277 AC_CONFIG_FILES([Makefile
278                  ccan/Makefile
279                  hkl/Makefile
280                  hkl.pc
281                  hkl3d/Makefile
282                  hkl3d/bullet/Makefile
283                  hkl3d/bullet/src/Makefile
284                  hkl3d.pc
285                  test/Makefile
286                  test/hkl/Makefile
287                  test/hkl3d/Makefile
288                  test/bindings/Makefile
289                  test/tap/Makefile
290                  Documentation/Makefile
291                  Documentation/api/Makefile
292                  Documentation/figures/Makefile
293                  Documentation/sphinx/Makefile
294                  Documentation/sphinx/source/conf.py
295                  gui/Makefile
296                  gui/hkl3d/Makefile
297                  data/Makefile
300 AC_OUTPUT