view main/geometry/configure.add @ 32:7f4ee8a03ea5 octave-forge

Correctly check for libqhull and make sure that it builds
author pkienzle
date Wed, 31 Oct 2001 19:05:28 +0000
parents 6b33357c7561
children 72ebc0355436
line wrap: on
line source

dnl Do we have libqhull?
AC_SUBST(DEFHAVE_LIBQHULL)
HAVE_LIBQHULL=1
AC_CHECK_HEADERS(qhull/qhull_a.h,, HAVE_LIBQHULL=0)

dnl The following check fails because qhull wants qh_version to be
dnl defined by the user!?!
dnl    AC_CHECK_LIB(qhull,qh_qhull,, HAVE_LIBQHULL=0)
dnl Instead we use the following mess cribbed from acgeneral.m4:
dnl
dnl AC_CHECK_QHULL(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
dnl              [, OTHER-LIBRARIES]]])
AC_DEFUN(AC_CHECK_QHULL,
[AC_MSG_CHECKING([for $2 in -l$1])
dnl Use a cache variable name containing both the library and function name,
dnl because the test really is for library $1 defining function $2, not
dnl just for library $1.  Separate tests with the same $1 and different $2s
dnl may have different results.
ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
AC_CACHE_VAL(ac_cv_lib_$ac_lib_var,
[ac_save_LIBS="$LIBS"
LIBS="-l$1 $5 $LIBS"
AC_TRY_LINK(dnl
ifelse(AC_LANG, [FORTRAN77], ,
ifelse([$2], [main], , dnl Avoid conflicting decl of main.
[/* Override any gcc2 internal prototype to avoid an error.  */
]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
extern "C"
#endif
])dnl
[/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char qh_version;
char $2();
])),
            [$2()],
            eval "ac_cv_lib_$ac_lib_var=yes",
            eval "ac_cv_lib_$ac_lib_var=no")
LIBS="$ac_save_LIBS"
])dnl
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  AC_MSG_RESULT(yes)
  ifelse([$3], ,
[changequote(, )dnl
  ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
changequote([, ])dnl
  AC_DEFINE_UNQUOTED($ac_tr_lib)
  LIBS="-l$1 $LIBS"
], [$3])
else
  AC_MSG_RESULT(no)
ifelse([$4], , , [$4
])dnl
fi
])


AC_CHECK_QHULL(qhull,qh_qhull,, HAVE_LIBQHULL=0)

if test $HAVE_LIBQHULL = 1 ; then
	DEFHAVE_LIBQHULL="HAVE_LIBQHULL=1"
else
	DEFHAVE_LIBQHULL=
	AC_MSG_WARN([Qhull not found; geometry toolbox not built])
fi