| 1 |
AC_DEFUN(AC_CHECK_QHULL_VERSION, |
| 2 |
[AC_MSG_CHECKING([for qh_qhull in -lqhull with qh_version]) |
| 3 |
AC_CACHE_VAL(ac_cv_lib_qhull_version, |
| 4 |
[changequote(, )dnl |
| 5 |
cat > conftest.c <<EOF |
| 6 |
#include <stdio.h> |
| 7 |
char qh_version[] = "version"; |
| 8 |
char qh_qhull(); |
| 9 |
int |
| 10 |
main(argc, argv) |
| 11 |
int argc; |
| 12 |
char *argv[]; |
| 13 |
{ |
| 14 |
qh_qhull(); |
| 15 |
return 0; |
| 16 |
} |
| 17 |
EOF |
| 18 |
changequote([, ])dnl |
| 19 |
ac_try="${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS conftest.c -o conftest -lqhull $LIBS" |
| 20 |
if AC_TRY_EVAL(ac_try) && test -s conftest ; then |
| 21 |
ac_cv_lib_qhull_version=yes |
| 22 |
else |
| 23 |
ac_cv_lib_qhull_version=no |
| 24 |
fi |
| 25 |
rm -f conftest.c conftest.o conftest |
| 26 |
])dnl |
| 27 |
if test "$ac_cv_lib_qhull_version" = "yes"; then |
| 28 |
AC_MSG_RESULT(yes) |
| 29 |
ifelse([$1], , , [$1]) |
| 30 |
else |
| 31 |
AC_MSG_RESULT(no) |
| 32 |
ifelse([$2], , , [$2]) |
| 33 |
fi |
| 34 |
]) |
| 35 |
|
| 36 |
dnl Do we have libqhull? |
| 37 |
AC_SUBST(have_qhull) |
| 38 |
AC_SUBST(need_qhull_version) |
| 39 |
AC_CHECK_HEADER(qhull/qhull_a.h, have_qhull=yes, have_qhull=no) |
| 40 |
if test $have_qhull = yes ; then |
| 41 |
OF_CHECK_LIB(qhull, qh_qhull, have_qhull=yes, have_qhull=no) |
| 42 |
if test $have_qhull = yes ; then |
| 43 |
need_qhull_version=no |
| 44 |
else |
| 45 |
AC_CHECK_QHULL_VERSION(have_qhull=yes, have_qhull=no) |
| 46 |
need_qhull_version=yes |
| 47 |
fi |
| 48 |
fi |
| 49 |
if test $have_qhull = yes ; then |
| 50 |
QHULLSTATUS=yes |
| 51 |
else |
| 52 |
QHULLSTATUS="Qhull not found --- see docs/README.geometry" |
| 53 |
fi |