1dnl 2dnl 3dnl GEOM_LOG_MSG(MESSAGE) 4define(GEOM_LOG_MSG, 5[echo "configure:__oline__: $1" >&AC_FD_CC]) 6dnl 7dnl GEOM_FIND_L_OPTION(LIB, FUNC, DIRS, OTHERLIBS) 8dnl 9dnl Figure out what -L option might be needed to link with the library 10dnl LIB. FUNC should be some function from that library. DIRS should be a 11dnl list of directories to try, one of them can be "" which means use no 12dnl -L option. OTHERLIBS, if present, can be a list of other libraries to 13dnl link with. Upon return: 14dnl 15dnl * If linking was successful, then the shell variable GEOM_L_OPTION 16dnl is set to the first -L option (including the "-L") that worked, 17dnl unless what worked was linking with no -L option, in which case 18dnl GEOM_L_OPTION is the empty string. 19dnl 20dnl * If linking didn't work with any of the dirs in DIRS, then 21dnl GEOM_L_OPTION is 0. 22dnl 23AC_DEFUN([GEOM_FIND_L_OPTION],[ 24geom_lib=$1 25geom_func=$2 26geom_dirs='$3' 27geom_otherlibs=$4 28geom_saved_LIBS=$LIBS 29#AC_MSG_CHECKING([how to link with $geom_lib]) 30 31GEOM_L_OPTION=0 32for geom_z in $geom_dirs ; do 33 geom_z=`eval echo $geom_z` 34 geom_l_option= 35 test -n "$geom_z" && geom_l_option="-L$geom_z" 36 LIBS="$geom_l_option $geom_lib $geom_otherlibs" 37 GEOM_LOG_MSG([checking for $geom_func with $geom_l_option]) 38 AC_TRY_LINK_FUNC($geom_func, 39 [ GEOM_L_OPTION="$geom_l_option" 40 break ] 41 ) 42done 43LIBS=$geom_saved_LIBS 44#if test "$GEOM_L_OPTION" != "0" ; then 45# AC_MSG_RESULT([$geom_l_option $geom_lib]) 46#else 47# AC_MSG_RESULT([not found]) 48#fi 49]) 50dnl 51dnl 52dnl 53dnl 54dnl 55dnl 56dnl 57dnl GEOM_FIND_I_OPTION(HEADER, DIRS) 58dnl 59# Find out what -I argument we need in order to get the header file HEADER. 60# DIRS should be a list of strings to use as -I arguments; the empty 61# string corresponds to no -I option at all. If we're successful, return 62# with GEOM_I_OPTION set to the relevant -I option (including the "-I" itself). 63# Note that this might be the empty string, which corresponds to no -I 64# option at all. If we don't find HEADER in any of the dirs listed in DIRS, 65# return with GEOM_I_OPTION = "0". 66AC_DEFUN([GEOM_FIND_I_OPTION],[ 67geom_header=$1 68geom_dirs='$2' 69geom_saved_CPPFLAGS=$CPPFLAGS 70GEOM_I_OPTION="0" 71#AC_MSG_CHECKING([for $geom_header]) 72for geom_z in $geom_dirs ; do 73 geom_z=`eval echo $geom_z` 74 geom_i_option= 75 test -n "$geom_z" && geom_i_option="-I$geom_z" 76 CPPFLAGS="$geom_i_option $geom_saved_CPPFLAGS" 77 GEOM_LOG_MSG([checking for $geom_header with $geom_i_option]) 78 AC_TRY_CPP([ #include <$geom_header> ], 79 [ GEOM_I_OPTION="$geom_i_option" 80 break ] 81 ) 82done 83CPPFLAGS=$geom_saved_CPPFLAGS 84#if test "$GEOM_I_OPTION" = "0" ; then 85# AC_MSG_RESULT([not found]) 86#else 87# if test "$GEOM_I_OPTION" != "" ; then 88# AC_MSG_RESULT($GEOM_I_OPTION) 89# else 90# AC_MSG_RESULT([(found with no -I required)]) 91# fi 92#fi 93]) 94dnl 95dnl 96dnl GEOM_FIND_LIBC_VERSION 97dnl 98dnl Try to figure out which version of the libc library is installed on 99dnl a linux system. Return with GEOM_LIBC_VERSION set to: 100dnl 101dnl 5 for the old libc (libc.so.5) 102dnl 6 for glibc (i.e., libc.so.6) (RedHat 5.0 and later) 103dnl 104dnl default to 6 if we can't figure it out. Note that this test is 105dnl not really correct; I think there is yet another version of libc 106dnl that we probably need to distinguish, but I'm not sure and I don't 107dnl know how to detect it, so this'll have to do for now. If you know 108dnl more about this, please email me at mbp@geomtech.com. 109dnl 110AC_DEFUN([GEOM_FIND_LIBC_VERSION],[ 111if test -e "/lib/libc.so.6" ; then 112 GEOM_LIBC_VERSION="6" 113else 114 if test -e "/lib/libc.so.5" ; then 115 GEOM_LIBC_VERSION="5" 116 else 117 GEOM_LIBC_VERSION="6" 118 fi 119fi 120]) 121dnl 122dnl GEOM_AC_PROG_CXX (and its internally used GEOM_AC_PROG_CXX_WORKS) is a 123dnl replacement that I wrote for the standard AC_PROG_CXX (and 124dnl AC_PROG_CXX_WORKS). It differs from the standard one only in that it 125dnl does not abort if a C++ compiler isn't found --- it just sets CXX to 126dnl the empty string. If anyone knows a better way to test for the 127dnl presense of a C++ compiler without exiting if it isn't found, let me 128dnl know! [mbp@geomtech.com, Sat Oct 14 00:33:38 2000] 129dnl 130AC_DEFUN([GEOM_AC_PROG_CXX_WORKS], 131[AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works]) 132AC_LANG_SAVE 133AC_LANG_CPLUSPLUS 134AC_TRY_COMPILER([int main(){return(0);}], ac_cv_prog_cxx_works, ac_cv_prog_cxx_cross) 135AC_LANG_RESTORE 136AC_MSG_RESULT($ac_cv_prog_cxx_works) 137AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler]) 138AC_MSG_RESULT($ac_cv_prog_cxx_cross) 139cross_compiling=$ac_cv_prog_cxx_cross 140]) 141 142AC_DEFUN([GEOM_AC_PROG_CXX], 143[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl 144AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, gcc) 145 146GEOM_AC_PROG_CXX_WORKS 147 148if test $ac_cv_prog_cxx_works = no; then 149 CXX= 150else 151 152 AC_PROG_CXX_GNU 153 154 if test $ac_cv_prog_gxx = yes; then 155 GXX=yes 156 else 157 GXX= 158 fi 159 160 dnl Check whether -g works, even if CXXFLAGS is set, in case the package 161 dnl plays around with CXXFLAGS (such as to build both debugging and 162 dnl normal versions of a library), tasteless as that idea is. 163 ac_test_CXXFLAGS="${CXXFLAGS+set}" 164 ac_save_CXXFLAGS="$CXXFLAGS" 165 CXXFLAGS= 166 AC_PROG_CXX_G 167 if test "$ac_test_CXXFLAGS" = set; then 168 CXXFLAGS="$ac_save_CXXFLAGS" 169 elif test $ac_cv_prog_cxx_g = yes; then 170 if test "$GXX" = yes; then 171 CXXFLAGS="-g -O2" 172 else 173 CXXFLAGS="-g" 174 fi 175 else 176 if test "$GXX" = yes; then 177 CXXFLAGS="-O2" 178 else 179 CXXFLAGS= 180 fi 181 fi 182 183fi 184]) 185dnl 186dnl 187AC_DEFUN([GEOM_GET_CACHED_VALUE],[ 188AC_MSG_CHECKING([for $1]) 189AC_CACHE_VAL(ac_cv_$1,[ 190AC_MSG_ERROR([ 191 192Can't find cached value for $1. You're not trying to run 'configure' 193from $PACKAGE's source directory, are you? You should only run 194Geomview's top-level 'configure' script, not this one directly. See 195the file INSTALL in $PACKAGE's source directory for details. 196 197])]) 198eval $ac_cv_$1 199AC_MSG_RESULT([done.]) 200]) 201dnl 202dnl 203AC_DEFUN([GEOM_REQUIRE_XFORMS],[ 204AC_MSG_CHECKING([for xforms]) 205AC_CACHE_VAL(ac_cv_have_xforms,[:]) 206eval $ac_cv_have_xforms 207 208if test "$have_xforms" != "yes" ; then 209 AC_MSG_RESULT([no]) 210 AC_MSG_ERROR([ 211 212$PACKAGE requires the xforms library, but I can't find it in 213Geomview's top-level config.cache. Please install an xforms 214distribution appropriate to your machine in the 'xforms' directory 215under the top-level Geomview directory, delete any existing 216'config.cache' file in that directory, and re-run 'configure' in that 217directory. You should only run Geomview's top-level 'configure' 218script, not this one directly. See the file INSTALL in $PACKAGE's 219source directory for details. 220 221]) 222else 223 XFORMSINCLUDE=$ac_xforms_include 224 XFORMSLIBS=$ac_xforms_libs 225 AC_MSG_RESULT([headers '$ac_xforms_include', libraries '$ac_xforms_libs']) 226fi 227]) 228 229dnl Less severe version of the above: just check and WARN 230dnl 231AC_DEFUN([GEOM_CHECK_XFORMS],[ 232AC_MSG_CHECKING([for xforms]) 233AC_CACHE_VAL(ac_cv_have_xforms,[:]) 234eval $ac_cv_have_xforms 235 236if test "$have_xforms" != "yes" ; then 237 AC_MSG_RESULT([no]) 238 AC_MSG_WARN([ 239 240$PACKAGE requires the xforms library, but I can't find it in 241Geomview's top-level config.cache. Please install an xforms 242distribution appropriate to your machine in the 'xforms' directory 243under the top-level Geomview directory, delete any existing 244'config.cache' file in that directory, and re-run 'configure' in that 245directory. You should only run Geomview's top-level 'configure' 246script, not this one directly. See the file INSTALL in $PACKAGE's 247source directory for details. 248 249]) 250else 251 XFORMSINCLUDE=$ac_xforms_include 252 XFORMSLIBS=$ac_xforms_libs 253 AC_MSG_RESULT([headers '$ac_xforms_include', libraries '$ac_xforms_libs']) 254fi 255]) 256dnl 257dnl GEOM_REQUIRE_GEOMVIEW_VERSION(TOPDIR,MAJOR_OP,MAJOR,MINOR_OP,MINOR_COND) 258dnl $1 $2 $3, $4, $5 259dnl 260AC_DEFUN([GEOM_REQUIRE_GEOMVIEW_VERSION],[ 261if test -f "$1/configure.in"; then 262 GVCFGFILE="$1/configure.in" 263else test -f "$1/configure.ac" 264 GVCFGFILE="$1/configure.ac" 265fi 266if test "z${GVCFGFILE}" = "z"; then 267 AC_MSG_ERROR([Geomview configure file not found ("$1/configure.in/ac")]) 268fi 269changequote(<<, >>)dnl 270if test "z${GVCFGFILE}" = "zconfigure.in"; then 271 gv_version=`sed -e 's/#.*$//' ${GVCFGFILE} | grep AM_INIT_AUTOMAKE | sed -e 's/^.*geomview,//' | sed -e 's/)//'` 272else 273 gv_version=`grep <<AC_INIT>> ${GVCFGFILE}|cut -d ',' -f 2| sed -e 's/[][]//g'` 274changequote([,])dnl 275AC_MSG_NOTICE(version: $gv_version) 276changequote(<<, >>)dnl 277fi 278gv_major=`echo $gv_version | sed -e 's/\..*//'` 279gv_rest=`echo $gv_version | sed -e 's/^[^\.]\.//'` 280gv_minor=`echo $gv_rest | sed -e 's/\..*//'` 281gv_rev=`echo $gv_rest | sed -e 's/^[^\.]\.//'` 282changequote([,])dnl 283gv_major_ok=`expr $gv_major '$2' $3` 284gv_minor_ok=`expr $gv_minor '$4' $5` 285if test "$gv_major_ok" != "1" -o "$gv_minor_ok" != "1" ; then 286 AC_MSG_ERROR([ 287 288$PACKAGE requires Geomview version N.M, where N$2$3 and M$4$5. 289Your version of Geomview seems to be $gv_major.$gv_minor.$gv_rev. 290 291]) 292fi 293]) 294 295