1dnl ************************************************************************ 2dnl 3dnl This file is part of the Cal3D library/package 4dnl Copyright (C) 2002 Bruno 'Beosil' Heidelberger (beosil@swileys.com) 5dnl 6dnl This library is free software; you can redistribute it and/or modify it 7dnl under the terms of the GNU Lesser General Public License as published by 8dnl the Free Software Foundation; either version 2.1 of the License, or (at 9dnl your option) any later version. 10dnl 11dnl ************************************************************************ 12 13AC_DEFUN([CAL3D_CHECK_USER_CXX_FLAGS], 14[ 15 AC_MSG_CHECKING(whether user defined C++ flags overwrite the default Cal3D ones) 16 if test -z "$CXXFLAGS"; then 17 cal3d_user_cxx_flags="no" 18 else 19 cal3d_user_cxx_flags="yes" 20 fi 21 AC_MSG_RESULT($cal3d_user_cxx_flags) 22]) 23 24dnl ************************************************************************ 25 26AC_DEFUN([CAL3D_CHECK_BUILD], 27[ 28 AC_MSG_CHECKING(whether to build Cal3D in debug mode) 29 AC_ARG_ENABLE(debug,[ --enable-debug build Cal3D in debug mode [default=no]], 30 [ 31 if test $enableval = "no"; then 32 cal3d_debug_mode="no" 33 else 34 cal3d_debug_mode="yes" 35 fi 36 ], [ 37 cal3d_debug_mode="no" 38 ]) 39 AC_MSG_RESULT($cal3d_debug_mode) 40 41 if test "$cal3d_user_cxx_flags" = "no"; then 42 if test "$cal3d_debug_mode" = "yes"; then 43 if test $ac_cv_prog_cxx_g = yes; then 44 CXXFLAGS="-g" 45 fi 46 else 47 if test "$GXX" = "yes"; then 48 CXXFLAGS="-O2" 49 fi 50 fi 51 fi 52 53 CAL_INDICES_SIZE="" 54 AC_ARG_ENABLE(16bit-indices,[ --enable-16bit-indices use 16-bit indices (default 32-bit)], 55 [ 56 if test $enableval = "no"; then 57 CAL_INDICES_SIZE="" 58 else 59 CAL_INDICES_SIZE=-DCAL_16BIT_INDICES 60 CXXFLAGS="$CXXFLAGS -DCAL_16BIT_INDICES" 61 fi 62 ],) 63 AC_SUBST(CAL_INDICES_SIZE) 64 65 AC_ARG_ENABLE(profile,[ --enable-profile enable profile building (disabled by default)], 66 [ 67 CXXFLAGS="$CXXFLAGS -pg" 68 ],) 69 70 71 AC_ARG_ENABLE(rtti, [ --enable-rtti allow runtime type identification (disabled by default)], 72 , 73 [ 74 CAL3D_CHECK_CXX_FLAG(fno-rtti, 75 [ 76 CXXFLAGS="$CXXFLAGS -fno-rtti" 77 ]) 78 ]) 79 80 if test "x$CXX" = "xCC"; then 81 CXXFLAGS="$CXXFLAGS -LANG:std -n32 -mips3" 82 fi 83 84 85]) 86 87dnl ************************************************************************ 88 89AC_DEFUN([CAL3D_CHECK_CXX_FLAG], 90[ 91 AC_MSG_CHECKING(whether $CXX supports -$1) 92 cal3d_cache=`echo $1 | sed 'y%.=/+-%___p_%'` 93 AC_CACHE_VAL(cal3d_cv_prog_cxx_$cal3d_cache, 94 [ 95 echo 'void f(){}' >conftest.cc 96 if test -z "`$CXX -$1 -c conftest.cc 2>&1`"; then 97 eval "cal3d_cv_prog_cxx_$cal3d_cache=yes" 98 else 99 eval "cal3d_cv_prog_cxx_$cal3d_cache=no" 100 fi 101 rm -f conftest* 102 ]) 103 if eval "test \"`echo '$cal3d_cv_prog_cxx_'$cal3d_cache`\" = yes"; then 104 AC_MSG_RESULT(yes) 105 : 106 $2 107 else 108 AC_MSG_RESULT(no) 109 : 110 $3 111 fi 112]) 113