1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461
|
AC_INIT([3Depict], [0.0.16])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_PROG_CXX
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile src/Makefile])
#Ok, lets try using gcc style precompiled headers.
AM_CONDITIONAL(USE_PRECOMPILED_HEADERS, 1)
#Check sizeof
AC_CHECK_SIZEOF(size_t)
# Support {host_os} variable
AC_CANONICAL_HOST
dnl Test for wx-widgets
dnl ----------
AM_OPTIONS_WXCONFIG
AM_PATH_WXCONFIG(2.6.0, wxWin=1)
if test "$wxWin" != 1; then
AC_MSG_ERROR([
wxWidgets must be installed on your system
but wx-config script couldnt be found.
Please check that wx-config is in path, the directory
where wxWidgets libraries are installed (returned by
'wx-config --libs' command) is in LD_LIBRARY_PATH or
equivalent variable and wxWidgets version is 2.6.0 or above.
])
fi
#Append the --gl-libs flag
WX_LIBS="$WX_LIBS `$WX_CONFIG_PATH --gl-libs`"
WANT_WINDRES="no"
case "${host_os}" in
*w64_mingw*)
#wx-config is a little unreliable in cross-compile mode
# Manually append -DUNICODE to cppflags/cxxflags
WX_CXXFLAGS="$WX_CXXFLAGS -DUNICODE"
WX_CPPFLAGS="$WX_CPPFLAGS -DUNICODE"
WANT_WINDRES="true"
;;
esac
AM_CONDITIONAL([HAVE_WINDRES], [ test x$WANT_WINDRES= xtrue ] )
AC_SUBST(WX_LIBS)
dnl ----------
# Check for xml-config (libxml2 configuration utility)
# ------------
# Test from icecast library (GPL)
AC_ARG_WITH(xml-config,
[ --with-xml-config=PATH use xml-config in PATH to find libxml ])
have_xml="no"
if test "$with_xml_config" != "no"
then
if test -n "$with_xml_config" -a "$with_xml_config" != "yes"
then
XMLCONFIG="$with_xml_config"
if ! test -x "$XMLCONFIG"
then
AC_MSG_ERROR([$with_xml_config cannot be run])
fi
else
AC_CHECK_PROGS(XMLCONFIG, [xml2-config xml-config])
fi
if test -n "$XMLCONFIG"
then
AC_DEFINE(HAVE_LIBXML, 1, [Define if you have the GNOME XML library])
have_xml="yes"
else
AC_MSG_ERROR([Unable to locate the configuration utility xml-config: specify with --with-xml-config, or ensure it is your PATH environment variable])
fi
XML_LIBS="`$XMLCONFIG --libs`"
XML_CFLAGS="`$XMLCONFIG --cflags`"
AC_SUBST(XML_CFLAGS)
AC_SUBST(XML_LIBS)
fi
AM_CONDITIONAL(USE_XML, test "$have_xml" = "yes")
#----------------
# Check for FT2
dnl ----------
#FT2 teset from the graphviz library configure.ac
FREETYPE_DIR="yes"
AC_ARG_WITH(freetype,
[ --with-freetype=DIR where to find the freetype 2.x library],
FREETYPE_DIR=$withval)
if test "x$FREETYPE_DIR" = "xno"; then
AC_MSG_ERROR(FREETYPE2 library disabled)
else
if test "x$FREETYPE_DIR" != "xyes"; then
AC_PATH_PROG(FREETYPE_CONFIG,freetype-config,,[$FREETYPE_DIR/bin:$PATH])
else
AC_PATH_PROG(FREETYPE_CONFIG,freetype-config)
fi
if test -n "$FREETYPE_CONFIG"; then
if test "x$FREETYPE_DIR" != "xyes"; then
FT_INCLUDES="`$FREETYPE_CONFIG --cflags` -I$FREETYPE_DIR/include"
else
FT_INCLUDES=`$FREETYPE_CONFIG --cflags`
fi
ft_libtool=`$FREETYPE_CONFIG --libtool`
# check that it really exists (FreeBSD apparently forgot to insttall it!)
if test -f "$ft_libtool"; then
FT_LIBTOOL="$ft_libtool"
else
FT_LIBTOOL=""
fi
FT_LIBS=`$FREETYPE_CONFIG --libs`
FT_LDFLAGS=`echo " $FT_LIBS" |sed 's/ -l[[^ ]][[^ ]]*//g'`
else
if test "x$FREETYPE_DIR" != "xyes"; then
FT_INCLUDES="-I$FREETYPE_DIR/include/freetype2 -I$FREETYPE_DIR/include"
FT_LDFLAGS="-L$FREETYPE_DIR/lib"
FT_LIBS="-lfreetype"
else
FT_INCLUDES=""
FT_LDFLAGS=""
FT_LIBS=""
fi
FT_LIBTOOL=""
fi
save_CPPFLAGS=$CPPFLAGS
save_LDFLAGS=$LDFLAGS
CPPFLAGS="$CPPFLAGS $FT_INCLUDES"
LDFLAGS="$LDFLAGS $FT_LDFLAGS"
AC_CHECK_HEADERS(ft2build.h)
if test `eval echo '${'$as_ac_Header'}'` = yes; then
AC_CHECK_LIB(freetype,main,
[FT_LIBS="$FT_LIBS"
AC_DEFINE_UNQUOTED(HAVE_LIBFREETYPE,1,[Define if you have the FREETYPE2 library])],
[AC_MSG_ERROR(Error: FREETYPE2 library not available - no libfreetype.)])
else
AC_MSG_ERROR(Required FREETYPE2 library not available - no ft2build.h)
fi
CPPFLAGS=$save_CPPFLAGS
LDFLAGS=$save_LDFLAGS
AC_SUBST(FT_INCLUDES)
AC_SUBST(FT_LIBS)
fi
dnl ----------
#Check for FTGL using custom script.
dnl ----------
AX_CHECK_FTGL() #Not doing anything???
AC_SUBST(FTGL_CFLAGS)
AC_SUBST(FTGL_LIBS)
dnl ----------
#Check for qhull
dnl--------------
AC_ARG_WITH(libqhull-flags,
[ --with-libqhull-flags=PATH : specify compiler flags for libqhull])
AC_ARG_WITH(libqhull-link,
[ --with-libqhull-link=PATH : specify linker flag (library) for libqhull])
if test x"$with_libqhull_flags" != x"" ; then
QHULL_CFLAGS="$with_libqhull_flags"
fi
AC_SUBST([QHULL_CFLAGS])
#Attempt to compile a test program
CFLAGS_ORIG="$CFLAGS"
CFLAGS="$CFLAGS $QHULL_CFLAGS"
AC_CHECK_HEADER([qhull/qhull_a.h],[AC_DEFINE(HAVE_QHULL,[],[Have got libqhull headers])],
[AC_MSG_ERROR([Required libqhull headers not found (looking for qhull/qhull_a.h])])
if test x"$with_libqhull_link" != x"" ;
then
QHULL_LIBS="$with_libqhull_link"
else
QHULL_LIBS="-lqhull"
fi
LIBS_ORIG="$LIBS"
LIBS="$LIBS $QHULL_LIBS $LDFLAGS"
AC_CHECK_LIB(qhull, qh_qhull, [AC_DEFINE(HAVE_QHULL,[],[qhull compilation OK])] , AC_MSG_ERROR([You must have libqhull installed and be able to compile a sample program. compiler flags can be set using the with-libqhull-flags and with-libqhull-link parameters ]))
CFLAGS="$CFLAGS_ORIG"
LIBS="$LIBS_ORIG"
AC_SUBST([QHULL_LIBS])
dnl--------------
#Check for libpng
dnl--------------
AC_ARG_WITH(libpng-flags,
[ --with-libpng-flags=PATH : specify compiler flags for libpng])
AC_ARG_WITH(libpng-link,
[ --with-libpng-link=PATH : specify linker flag (library) for libpng])
#set libpng's compiler flags
if test x"$with_libpng_flags" != x"" ;
then
PNG_CFLAGS="$with_libpng_flags"
fi
AC_SUBST(PNG_CFLAGS)
#set libpng's link flags
if test x"$with_libpng_link" != x"" ;
then
PNG_LIBS="$with_libpng_link"
else
AC_CHECK_LIB([png],[png_create_write_struct_2] ,
[PNG_LIBS=-lpng], [PNG_USE_PKG_CFG=yes],-lm)
if test x"$PNG_USE_PKG_CFG" == x"yes" ; then
PKG_CHECK_MODULES(PNG, libpng >= 1.2)
fi
fi
AC_SUBST(PNG_LIBS)
#Attempt to compile a test program
CFLAGS_ORIG="$CFLAGS"
CFLAGS="$CFLAGS $PNG_CFLAGS"
AC_CHECK_HEADER([png.h],[AC_DEFINE(HAVE_PNG,[],[Have got libpng headers])],
[AC_MSG_ERROR([Required libpng headers not found (looking for png.h])])
LIBS_ORIG="$LIBS"
LIBS="$LIBS $PNG_LIBS $LDFLAGS"
AC_CHECK_LIB(png, png_sig_cmp, [AC_DEFINE(HAVE_PNG,[],[PNG compilation OK])] , AC_MSG_ERROR([You must have libpng installed and be able to compile sample program]), -lz -lm)
CFLAGS="$CFLAGS_ORIG"
LIBS="$LIBS_ORIG"
dnl--------------
#Check for opengl
#------------
#Try linking against gluSphere windows usese -lglu32; mac?? ; linux -lGLU
case "${host_os}" in
mingw*|windows*|winnt)
#win32 opengl names
GL_LIBS="-lglu32 -lopengl32"
#Add GLEW dependency for opengl > 1.1
GL_LIBS="$GL_LIBS -lglew32"
AC_SUBST(GL_LIBS)
;;
darwin*)
#This is handled by the --with-apple-opengl-framework
#option already. Nothing to do here
;;
*)
AC_CHECK_LIB(GLU, gluSphere, GL_LIBS="$GL_LIBS -lglu", [AC_MSG_ERROR([Could not find GLU library])])
GL_LIBS="-lGL -lGLU"
AC_SUBST(GL_LIBS)
;;
esac
#------------
#Check for Mathgl
dnl ----------
CFLAGS_ORIG="$CFLAGS"
LDFLAGS_ORIG="$LDFLAGS"
AC_ARG_ENABLE(mgl2,
[ --enable-mgl2 Enable mathgl 2.x support])
AC_ARG_ENABLE(mgl1,
[ --enable-mgl1 Enable mathgl 1.x support])
if test x"${enable_mgl2}" == x"yes" && test x"${enable_mgl1}" == x"yes"; then
AC_MSG_ERROR(["Can specify mgl1, or mgl2 - not both"])
fi
AC_ARG_WITH(mgl-flags,
[ --with-mgl-flags=PATH : specify compiler flags for mathgl])
if test x"$with_mgl_flags" != x"" ; then
MGL_CFLAGS="$with_mgl_flags"
AC_SUBST(MGL_CFLAGS)
fi
CFLAGS="$CFLAGS $MGL_CFLAGS"
AC_ARG_WITH(mgl-libs,
[ --with-mgl-libs=PATH : specify linker flag (library) for mathgl])
if test x"$with_mgl_libs" != x"" ; then
MGL_LIBS="$with_mgl_libs"
else
MGL_LIBS="-lmgl"
fi
AC_SUBST(MGL_LIBS)
LDFLAGS="$LDFLAGS $MGL_LIBS"
#Note:
# mathgl1.x uses mgl_c.h as c functions.
# mathgl2.x uses mgl_cf.h for c functions.
AC_LANG_PUSH([C++])
if test x"${enable_mgl2}" == x"yes" ; then
AC_DEFINE(USE_MGL2, 1 , ["Enable mgl2 support"])
AC_CHECK_HEADER("mgl2/mgl_cf.h",[],[AC_MSG_ERROR(["mgl2 specified, but header mgl2/mgl_cf.h not found"])],[])
else
if test x"${enable_mgl1}" == x"yes" ; then
AC_DEFINE(USE_MGL1, 0 , ["Enable mgl1 support"])
AC_CHECK_HEADER("mgl/mgl_c.h",[],[AC_MSG_ERROR(["mgl specified, but header mgl/mgl_c.h not found"])],[])
else
#mgl2 is installed into different path (at least under debian)
# /usr/include/mgl2/
MGL_TEST_HEADERS="mgl2/mgl_cf.h mgl/mgl_c.h"
AC_CHECK_HEADERS($MGL_TEST_HEADERS,[HAVE_MGL_H=1; break;], [])
#check our set HAVE_MGL_H for *any* mglh
AS_IF([ test $HAVE_MGL_H -ne 1 ] , [ AC_MSG_ERROR(["MGL headers not found, looking for any of $MGL_TEST_HEADERS"])])
#Check MGL 2:
AS_IF([ test x"$ac_cv_header_mgl2_mgl_cf_h" == x"yes" ], [ AC_DEFINE(USE_MGL2,1) ], [ USE_MGL2=0 ])
AC_CHECK_LIB(mgl, mgl_set_def_param, [AC_DEFINE(HAVE_MGL,[],[MathGL compilation OK])] ,
AC_MSG_ERROR([Required MathGL libraries not found]), -lmgl)
fi
fi
AC_LANG_POP([C++])
CFLAGS="$CFLAGS_ORIG"
LDFLAGS="$LDFLAGS_ORIG"
dnl -------
#Check for gsl
dnl -------
AC_ARG_WITH(gsl-flags,
[ --with-gsl-flags=PATH : specify compiler flags for gsl])
AC_ARG_WITH(gsl-libs,
[ --with-gsl-libs=PATH : specify linker flag (library) for gsl])
if test x"$with_gsl_flags" != x"" ; then
GSL_CFLAGS="$with_gsl_flags"
fi
if test x"$with_gsl_libs" != x"" ; then
GSL_LIBS="$with_gsl_libs"
else
AX_PATH_GSL([1.1],[],[AC_MSG_WARN(["Could not find GNU Scientific Library.. You should install this, as it is needed by mathgl. Otherwise, you can override it with --with-gsl-link and --with-gsl-flags. For example you might use the gsl-config program to spit out the needed libs."])])
fi
dnl -----------
#Check for libintl
dnl -----------------
AC_MSG_CHECKING( [ for libintl ] );
AC_ARG_WITH(intl-libs,
[ --with-intl-libs=FLAGS: specify linker flags (library) for internationalisation libs])
if test x"$with_intl_libs" != x"" ; then
GETTEXT_LIBS="$with_intl_libs"
AC_SUBST(GETTEXT_LIBS)
AC_MSG_RESULT( [ specified ]);
else
case "${host_os}" in
darwin*)
#Darwin requires explicit libintl
GETTEXT_LIBS="-lintl -liconv"
AC_SUBST(GETTEXT_LIBS)
AC_MSG_RESULT( [ $GETTEXT_LIBS ]);
;;
mingw*|windows*|winnt)
GETTEXT_LIBS="-lintl"
AC_SUBST(GETTEXT_LIBS)
AC_MSG_RESULT( [ $GETTEXT_LIBS ]);
;;
*)
#elsewhere it appears to be part of libc. or something.
AC_MSG_RESULT( [ no ]);
;;
esac
fi
dnl -----------------
#Should we compile with openMP?
AC_ARG_ENABLE(openmp-parallel,
[ --enable-openmp-parallel Enable OpenMP multi-CPU usage; requires GCC > 4.2 for parallel STL support ])
#Should we enable or disable debug checking?
AC_ARG_ENABLE(debug-checks,
[ --disable-debug-checks Disable any debug checking, provides faster operation, but less information needed to debug internal problems, or to provide problem reports to developers ],[enable_no_debug_checks="yes"],[enable_no_debug_checks="no"])
if test x"$enable_openmp_parallel" != x"" ;
then
OPENMP_FLAGS="-fopenmp -D_GLIBCXX_PARALLEL"
AC_SUBST(OPENMP_FLAGS)
fi
if test x"$enable_debug_checks" != x"no" ;
then
if test x"$enable_openmp_parallel" != x"" ;
then
#Note that GLIBCXX_DEBUG cannot exist with GLIBCXX_PARALLEL
DEBUG_FLAGS="-DDEBUG"
else
DEBUG_FLAGS="-DDEBUG -D_GLIBCXX_DEBUG"
fi
AC_SUBST(DEBUG_FLAGS)
if test x"$GCC" = xyes; then
# Strip optimsation flags from debug build
changequote({,})
CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9s]*//g'`
CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/-O[0-9s]*//g'`
changequote([,])
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CXXFLAGS -g"
fi
else
if test x"$enable_debug_checks" !=x"yes" ;
then
AC_MSG_ERROR(["Well something isnt right, debug checks should be enabled or disabled (yes/no"])
fi
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
# Checks for library functions.
AC_CHECK_FUNCS([atexit])
AC_CHECK_FUNCS([sqrt])
AC_C_INLINE()
AC_PROG_INSTALL
AC_OUTPUT
|