remove gcc34
[dragonfly.git] / crypto / heimdal-0.6.3 / cf / check-compile-et.m4
1 dnl $Id: check-compile-et.m4,v 1.7.2.1 2003/08/15 14:40:42 lha Exp $
2 dnl
3 dnl CHECK_COMPILE_ET
4 AC_DEFUN([CHECK_COMPILE_ET], [
5
6 AC_CHECK_PROG(COMPILE_ET, compile_et, [compile_et])
7
8 krb_cv_compile_et="no"
9 krb_cv_com_err_need_r=""
10 if test "${COMPILE_ET}" = "compile_et"; then
11
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'
15 error_table test conf
16 prefix CONFTEST
17 index 1
18 error_code CODE1, "CODE1"
19 index 128
20 error_code CODE2, "CODE2"
21 end
22 EOF
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}"
28   fi
29   dnl Check that the `prefix' and `index' directives were honored.
30   AC_TRY_RUN([
31 #include <com_err.h>
32 #include <string.h>
33 #include "conftest_et.h"
34 int main(){
35 #ifndef ERROR_TABLE_BASE_conf
36 #error compile_et does not handle error_table N M
37 #endif
38 return (CONFTEST_CODE2 - CONFTEST_CODE1) != 127;}
39   ], [krb_cv_compile_et="yes"],[CPPFLAGS="${save_CPPFLAGS}"])
40 fi
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
47     AC_MSG_RESULT(no)
48   else
49     AC_MSG_RESULT(yes)
50   fi
51 fi
52 rm -fr conftest*
53 fi
54
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>],[
61     const char *p;
62     p = error_message(0);
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}"
67 else
68   dnl Since compile_et doesn't work, forget about libcom_err
69   krb_cv_com_err="no"
70 fi
71
72 dnl Only use the system's com_err if we found compile_et, libcom_err, and
73 dnl com_err.h.
74 if test "${krb_cv_com_err}" = "yes"; then
75     DIR_com_err=""
76     LIB_com_err="-lcom_err"
77     LIB_com_err_a=""
78     LIB_com_err_so=""
79     AC_MSG_NOTICE(Using the already-installed com_err)
80 else
81     COMPILE_ET="\$(top_builddir)/lib/com_err/compile_et"
82     DIR_com_err="com_err"
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)
87 fi
88 AC_SUBST(DIR_com_err)
89 AC_SUBST(LIB_com_err)
90 AC_SUBST(LIB_com_err_a)
91 AC_SUBST(LIB_com_err_so)
92
93 ])