2 # Process this file with autoconf to produce a configure script.
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])
13 # Checks for programs.
25 # Checks for libraries.
27 AC_CHECK_LIB([glut], [glutMainLoop])
29 # Checks for header files.
34 AC_CHECK_HEADERS([float.h limits.h malloc.h memory.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])
36 # Checks for typedefs, structures, and compiler characteristics.
49 # Checks for library functions.
54 AC_CHECK_FUNCS([floor getcwd gettimeofday memmove memset pow select sqrt strchr strdup strstr])
66 AC_PATH_PROG([POVRAY], [povray])
68 dnl *********************************************
69 dnl *** took from the bullet configure script ***
70 dnl *********************************************
74 *-*-mingw*|*-*-cygwin*)
75 AC_DEFINE(PLATFORM_WIN32, 1, [Platform is Win32])
76 opengl_LIBS="-lunsupported_platform"
77 PLATFORM_STRING="Win32"
80 AC_DEFINE(PLATFORM_LINUX, 1, [Platform is Linux])
81 opengl_LIBS="-lGL -lGLU -lglut"
82 PLATFORM_STRING="Linux"
85 AC_DEFINE(PLATFORM_APPLE, 1, [Platform is Apple])
86 opengl_LIBS="-framework AGL -framework OpenGL -framework GLUT"
87 PLATFORM_STRING="Apple"
90 AC_MSG_WARN([*** Please add $host to configure.ac checks!])
96 i?86-* | k?-* | athlon-* | pentium*-)
97 AC_DEFINE(ARCH_X86, 1, [Architecture is x86])
98 ARCH_SPECIFIC_CFLAGS=""
102 AC_DEFINE(ARCH_X86_64, 1, [Architecture is x86-64])
103 ARCH_SPECIFIC_CFLAGS="-DUSE_ADDR64"
107 AC_DEFINE(ARCH_PPC, 1, [Architecture is PowerPC])
108 ARCH_SPECIFIC_CFLAGS=""
109 ARCH_STRING="PowerPC"
112 AC_MSG_ERROR([Unknown Architecture])
117 #----------------------------------------------------------------------------
118 # Package configuration switches.
119 #----------------------------------------------------------------------------
120 AC_ARG_ENABLE([multithreaded],
121 [AS_HELP_STRING([--enable-multithreaded],[build BulletMultiThreaded (default NO)])],
122 [disable_multithreaded=no], [disable_multithreaded=yes])
123 AC_MSG_CHECKING([BulletMultiThreaded])
124 AS_IF([test "$disable_multithreaded" = yes], [build_multithreaded=no], [build_multithreaded=yes])
125 AC_MSG_RESULT([$build_multithreaded])
126 AM_CONDITIONAL([CONDITIONAL_BUILD_MULTITHREADED], [test "$build_multithreaded" = yes])
128 AC_ARG_ENABLE([demos],
129 [AS_HELP_STRING([--disable-demos],
130 [disable Bullet demos])],
133 AM_CONDITIONAL([CONDITIONAL_BUILD_DEMOS], [false])
134 if test "x$enable_demos" != xno; then
135 AC_MSG_NOTICE([Building Bullet demos])
136 AM_CONDITIONAL([CONDITIONAL_BUILD_DEMOS],[true])
141 AC_ARG_ENABLE([debug],
142 [AS_HELP_STRING([--enable-debug],[build with debugging information (default NO)])],
143 [], [enable_debug=no])
145 AC_MSG_CHECKING([build mode])
146 AS_IF([test $enable_debug = yes], [build_mode=debug], [build_mode=optimize])
147 AC_MSG_RESULT([$build_mode])
149 CFLAGS="$ARCH_SPECIFIC_CFLAGS $CFLAGS"
150 CXXFLAGS="$ARCH_SPECIFIC_CFLAGS $CXXFLAGS $CFLAGS"
152 ### end bullet configure script
154 dnl *******************************
155 dnl *** add an option for hkl3d ***
156 dnl *******************************
158 AC_ARG_ENABLE([hkl3d],
159 AS_HELP_STRING([--disable-hkl3d],
160 [turn off the hkl3d library [[default=yes]]]),
163 AM_CONDITIONAL([HKL3D], [test x$enable_hkl3d = xyes])
165 [PKG_CHECK_MODULES([G3D], [libg3d >= 0.0.8])
167 AC_CHECK_LIB(yaml, yaml_get_version,
168 [AC_CHECK_HEADERS(yaml.h, , yaml_found=no)])
169 if test x$yaml_found = xno; then
170 AC_MSG_ERROR([Could not find yaml.h])
173 AC_SUBST(YAML_CFLAGS)
178 dnl ****************************************
179 dnl *** add an option for the ghkl build ***
180 dnl ****************************************
182 AC_ARG_ENABLE([ghkl],
183 AS_HELP_STRING([--disable-ghkl],
184 [do not compile the ghkl gui [[default=yes]]]),
187 AM_CONDITIONAL([GHKL], [test x$enable_ghkl = xyes])
189 [PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.18])
191 [PKG_CHECK_MODULES([GLU], [glu >= 7.7.1])
192 PKG_CHECK_MODULES([GTKGLEXTMM], [gtkglextmm-1.2])
196 dnl ************************************
197 dnl *** Enable lcov coverage reports ***
198 dnl ************************************
201 AS_HELP_STRING([--enable-gcov],
203 [use_gcov=$enableval],
206 if test "x$use_gcov" = "xyes"; then
208 if test "$GCC" != "yes"; then
209 AC_MSG_ERROR([GCC is required for --enable-gcov])
212 dnl Check if ccache is being used
213 AC_CHECK_PROG(SHTOOL, shtool, shtool)
214 case `$SHTOOL path $CC` in
215 *ccache*[)] gcc_ccache=yes;;
219 if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
220 AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
223 ltp_version_list="1.6 1.7 1.8"
224 AC_CHECK_PROG(LTP, lcov, lcov)
225 AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
228 AC_CACHE_CHECK([for ltp version], glib_cv_ltp_version, [
229 glib_cv_ltp_version=invalid
230 ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
231 for ltp_check_version in $ltp_version_list; do
232 if test "$ltp_version" = "$ltp_check_version"; then
233 glib_cv_ltp_version="$ltp_check_version (ok)"
238 ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
239 AC_MSG_ERROR([$ltp_msg])
242 case $glib_cv_ltp_version in
244 ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
245 AC_MSG_ERROR([$ltp_msg])
250 if test -z "$LTP_GENHTML"; then
251 AC_MSG_ERROR([Could not find genhtml from the LTP package])
254 AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
256 dnl Remove all optimization flags from CFLAGS
258 CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
259 CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9]*//g'`
262 dnl Add the special gcc flags
263 CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
264 CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage"
265 LDFLAGS="$LDFLAGS -lgcov"
268 AC_CONFIG_FILES([Makefile
272 hkl3d/bullet/Makefile
273 hkl3d/bullet/src/Makefile
279 Documentation/Makefile
280 Documentation/api/Makefile
281 Documentation/figures/Makefile