1 dnl $Id: check-compile-et.m4,v 1.6 2001/09/02 17:08:48 assar Exp $
4 AC_DEFUN([CHECK_COMPILE_ET], [
6 AC_CHECK_PROG(COMPILE_ET, compile_et, [compile_et])
9 if test "${COMPILE_ET}" = "compile_et"; then
11 dnl We have compile_et. Now let's see if it supports `prefix' and `index'.
12 AC_MSG_CHECKING(whether compile_et has the features we need)
13 cat > conftest_et.et <<'EOF'
17 error_code CODE1, "CODE1"
19 error_code CODE2, "CODE2"
22 if ${COMPILE_ET} conftest_et.et >/dev/null 2>&1; then
23 dnl XXX Some systems have <et/com_err.h>.
24 save_CPPFLAGS="${save_CPPFLAGS}"
25 if test -d "/usr/include/et"; then
26 CPPFLAGS="-I/usr/include/et ${CPPFLAGS}"
28 dnl Check that the `prefix' and `index' directives were honored.
32 #include "conftest_et.h"
33 int main(){return (CONFTEST_CODE2 - CONFTEST_CODE1) != 127;}
34 ], [krb_cv_compile_et="yes"],[CPPFLAGS="${save_CPPFLAGS}"])
36 AC_MSG_RESULT(${krb_cv_compile_et})
40 if test "${krb_cv_compile_et}" = "yes"; then
41 dnl Since compile_et seems to work, let's check libcom_err
42 krb_cv_save_LIBS="${LIBS}"
43 LIBS="${LIBS} -lcom_err"
44 AC_MSG_CHECKING(for com_err)
45 AC_TRY_LINK([#include <com_err.h>],[
48 ],[krb_cv_com_err="yes"],[krb_cv_com_err="no"; CPPFLAGS="${save_CPPFLAGS}"])
49 AC_MSG_RESULT(${krb_cv_com_err})
50 LIBS="${krb_cv_save_LIBS}"
52 dnl Since compile_et doesn't work, forget about libcom_err
56 dnl Only use the system's com_err if we found compile_et, libcom_err, and
58 if test "${krb_cv_com_err}" = "yes"; then
60 LIB_com_err="-lcom_err"
63 AC_MSG_NOTICE(Using the already-installed com_err)
65 COMPILE_ET="\$(top_builddir)/lib/com_err/compile_et"
67 LIB_com_err="\$(top_builddir)/lib/com_err/libcom_err.la"
68 LIB_com_err_a="\$(top_builddir)/lib/com_err/.libs/libcom_err.a"
69 LIB_com_err_so="\$(top_builddir)/lib/com_err/.libs/libcom_err.so"
70 AC_MSG_NOTICE(Using our own com_err)
74 AC_SUBST(LIB_com_err_a)
75 AC_SUBST(LIB_com_err_so)