1 dnl $Id: check-compile-et.m4,v 1.7.2.1 2003/08/15 14:40:42 lha Exp $
4 AC_DEFUN([CHECK_COMPILE_ET], [
6 AC_CHECK_PROG(COMPILE_ET, compile_et, [compile_et])
9 krb_cv_com_err_need_r=""
10 if test "${COMPILE_ET}" = "compile_et"; then
12 dnl We have compile_et. Now let's see if it supports `prefix' and `index'.
13 AC_MSG_CHECKING(whether compile_et has the features we need)
14 cat > conftest_et.et <<'EOF'
18 error_code CODE1, "CODE1"
20 error_code CODE2, "CODE2"
23 if ${COMPILE_ET} conftest_et.et >/dev/null 2>&1; then
24 dnl XXX Some systems have <et/com_err.h>.
25 save_CPPFLAGS="${CPPFLAGS}"
26 if test -d "/usr/include/et"; then
27 CPPFLAGS="-I/usr/include/et ${CPPFLAGS}"
29 dnl Check that the `prefix' and `index' directives were honored.
33 #include "conftest_et.h"
35 #ifndef ERROR_TABLE_BASE_conf
36 #error compile_et does not handle error_table N M
38 return (CONFTEST_CODE2 - CONFTEST_CODE1) != 127;}
39 ], [krb_cv_compile_et="yes"],[CPPFLAGS="${save_CPPFLAGS}"])
41 AC_MSG_RESULT(${krb_cv_compile_et})
42 if test "${krb_cv_compile_et}" = "yes"; then
43 AC_MSG_CHECKING(for if com_err needs to have a initialize_error_table_r)
44 AC_EGREP_CPP(initialize_error_table_r,[#include "conftest_et.c"],
45 [krb_cv_com_err_need_r="initialize_error_table_r(0,0,0,0);"])
46 if test X"$krb_cv_com_err_need_r" = X ; then
55 if test "${krb_cv_compile_et}" = "yes"; then
56 dnl Since compile_et seems to work, let's check libcom_err
57 krb_cv_save_LIBS="${LIBS}"
58 LIBS="${LIBS} -lcom_err"
59 AC_MSG_CHECKING(for com_err)
60 AC_TRY_LINK([#include <com_err.h>],[
63 $krb_cv_com_err_need_r
64 ],[krb_cv_com_err="yes"],[krb_cv_com_err="no"; CPPFLAGS="${save_CPPFLAGS}"])
65 AC_MSG_RESULT(${krb_cv_com_err})
66 LIBS="${krb_cv_save_LIBS}"
68 dnl Since compile_et doesn't work, forget about libcom_err
72 dnl Only use the system's com_err if we found compile_et, libcom_err, and
74 if test "${krb_cv_com_err}" = "yes"; then
76 LIB_com_err="-lcom_err"
79 AC_MSG_NOTICE(Using the already-installed com_err)
81 COMPILE_ET="\$(top_builddir)/lib/com_err/compile_et"
83 LIB_com_err="\$(top_builddir)/lib/com_err/libcom_err.la"
84 LIB_com_err_a="\$(top_builddir)/lib/com_err/.libs/libcom_err.a"
85 LIB_com_err_so="\$(top_builddir)/lib/com_err/.libs/libcom_err.so"
86 AC_MSG_NOTICE(Using our own com_err)
90 AC_SUBST(LIB_com_err_a)
91 AC_SUBST(LIB_com_err_so)