1ebfedea0SLionel Sambucdnl Id 2ebfedea0SLionel Sambucdnl 3ebfedea0SLionel Sambucdnl CHECK_COMPILE_ET 4ebfedea0SLionel SambucAC_DEFUN([CHECK_COMPILE_ET], [ 5ebfedea0SLionel Sambuc 6ebfedea0SLionel SambucAC_CHECK_PROG(COMPILE_ET, compile_et, [compile_et]) 7ebfedea0SLionel Sambuc 8ebfedea0SLionel Sambuckrb_cv_compile_et="no" 9ebfedea0SLionel Sambuckrb_cv_com_err_need_r="" 10ebfedea0SLionel Sambuckrb_cv_compile_et_cross=no 11ebfedea0SLionel Sambucif test "${COMPILE_ET}" = "compile_et"; then 12ebfedea0SLionel Sambuc 13ebfedea0SLionel Sambucdnl We have compile_et. Now let's see if it supports `prefix' and `index'. 14ebfedea0SLionel SambucAC_MSG_CHECKING(whether compile_et has the features we need) 15ebfedea0SLionel Sambuccat > conftest_et.et <<'EOF' 16ebfedea0SLionel Sambucerror_table test conf 17ebfedea0SLionel Sambucprefix CONFTEST 18ebfedea0SLionel Sambucindex 1 19ebfedea0SLionel Sambucerror_code CODE1, "CODE1" 20ebfedea0SLionel Sambucindex 128 21ebfedea0SLionel Sambucerror_code CODE2, "CODE2" 22ebfedea0SLionel Sambucend 23ebfedea0SLionel SambucEOF 24ebfedea0SLionel Sambucif ${COMPILE_ET} conftest_et.et >/dev/null 2>&1; then 25ebfedea0SLionel Sambuc dnl XXX Some systems have <et/com_err.h>. 26ebfedea0SLionel Sambuc save_CPPFLAGS="${CPPFLAGS}" 27ebfedea0SLionel Sambuc if test -d "/usr/include/et"; then 28ebfedea0SLionel Sambuc CPPFLAGS="-I/usr/include/et ${CPPFLAGS}" 29ebfedea0SLionel Sambuc fi 30ebfedea0SLionel Sambuc dnl Check that the `prefix' and `index' directives were honored. 31ebfedea0SLionel Sambuc AC_RUN_IFELSE([ 32ebfedea0SLionel Sambuc#include <com_err.h> 33ebfedea0SLionel Sambuc#include <string.h> 34ebfedea0SLionel Sambuc#include "conftest_et.h" 35ebfedea0SLionel Sambucint main(int argc, char **argv){ 36ebfedea0SLionel Sambuc#ifndef ERROR_TABLE_BASE_conf 37ebfedea0SLionel Sambuc#error compile_et does not handle error_table N M 38ebfedea0SLionel Sambuc#endif 39ebfedea0SLionel Sambucreturn (CONFTEST_CODE2 - CONFTEST_CODE1) != 127;} 40ebfedea0SLionel Sambuc ], [krb_cv_compile_et="yes"],[CPPFLAGS="${save_CPPFLAGS}"], 41ebfedea0SLionel Sambuc [krb_cv_compile_et="yes" krb_cv_compile_et_cross=yes] ) 42ebfedea0SLionel Sambucfi 43ebfedea0SLionel SambucAC_MSG_RESULT(${krb_cv_compile_et}) 44ebfedea0SLionel Sambucif test "${krb_cv_compile_et}" = "yes" -a "${krb_cv_compile_et_cross}" = no; then 45ebfedea0SLionel Sambuc AC_MSG_CHECKING([for if com_err generates a initialize_conf_error_table_r]) 46ebfedea0SLionel Sambuc AC_EGREP_CPP([initialize_conf_error_table_r.*struct et_list], 47ebfedea0SLionel Sambuc [#include "conftest_et.h"], 48ebfedea0SLionel Sambuc [krb_cv_com_err_need_r="ok"]) 49ebfedea0SLionel Sambuc if test X"$krb_cv_com_err_need_r" = X ; then 50ebfedea0SLionel Sambuc AC_MSG_RESULT(no) 51ebfedea0SLionel Sambuc krb_cv_compile_et=no 52ebfedea0SLionel Sambuc else 53ebfedea0SLionel Sambuc AC_MSG_RESULT(yes) 54ebfedea0SLionel Sambuc fi 55ebfedea0SLionel Sambucfi 56ebfedea0SLionel Sambucrm -fr conftest* 57ebfedea0SLionel Sambucfi 58ebfedea0SLionel Sambuc 59ebfedea0SLionel Sambucif test "${krb_cv_compile_et_cross}" = yes ; then 60ebfedea0SLionel Sambuc krb_cv_com_err="cross" 61ebfedea0SLionel Sambucelif test "${krb_cv_compile_et}" = "yes"; then 62ebfedea0SLionel Sambuc dnl Since compile_et seems to work, let's check libcom_err 63ebfedea0SLionel Sambuc krb_cv_save_LIBS="${LIBS}" 64ebfedea0SLionel Sambuc LIBS="${LIBS} -lcom_err" 65ebfedea0SLionel Sambuc AC_MSG_CHECKING(for com_err) 66ebfedea0SLionel Sambuc AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <com_err.h>]],[[ 67ebfedea0SLionel Sambuc const char *p; 68ebfedea0SLionel Sambuc p = error_message(0); 69ebfedea0SLionel Sambuc initialize_error_table_r(0,0,0,0); 70ebfedea0SLionel Sambuc com_right_r(0, 0, 0, 0); 71ebfedea0SLionel Sambuc ]])],[krb_cv_com_err="yes"],[krb_cv_com_err="no"; CPPFLAGS="${save_CPPFLAGS}"]) 72ebfedea0SLionel Sambuc AC_MSG_RESULT(${krb_cv_com_err}) 73ebfedea0SLionel Sambuc LIBS="${krb_cv_save_LIBS}" 74ebfedea0SLionel Sambucelse 75ebfedea0SLionel Sambuc dnl Since compile_et doesn't work, forget about libcom_err 76ebfedea0SLionel Sambuc krb_cv_com_err="no" 77ebfedea0SLionel Sambucfi 78ebfedea0SLionel Sambuc 79ebfedea0SLionel Sambucdnl Only use the system's com_err if we found compile_et, libcom_err, and 80ebfedea0SLionel Sambucdnl com_err.h. 81ebfedea0SLionel Sambucif test "${krb_cv_com_err}" = "yes"; then 82ebfedea0SLionel Sambuc DIR_com_err="" 83ebfedea0SLionel Sambuc LIB_com_err="-lcom_err" 84ebfedea0SLionel Sambuc LIB_com_err_a="" 85ebfedea0SLionel Sambuc LIB_com_err_so="" 86ebfedea0SLionel Sambuc AC_MSG_NOTICE(Using the already-installed com_err) 87*0a6a1f1dSLionel Sambuc COMPILE_ET="${ac_cv_prog_COMPILE_ET}" 88ebfedea0SLionel Sambuc localcomerr=no 89ebfedea0SLionel Sambucelif test "${krb_cv_com_err}" = "cross"; then 90ebfedea0SLionel Sambuc DIR_com_err="com_err" 91ebfedea0SLionel Sambuc LIB_com_err="\$(top_builddir)/lib/com_err/libcom_err.la" 92ebfedea0SLionel Sambuc LIB_com_err_a="\$(top_builddir)/lib/com_err/.libs/libcom_err.a" 93ebfedea0SLionel Sambuc LIB_com_err_so="\$(top_builddir)/lib/com_err/.libs/libcom_err.so" 94ebfedea0SLionel Sambuc AC_MSG_NOTICE(Using our own com_err with toolchain compile_et) 95*0a6a1f1dSLionel Sambuc COMPILE_ET="${ac_cv_prog_COMPILE_ET}" 96ebfedea0SLionel Sambuc localcomerr=yes 97ebfedea0SLionel Sambucelse 98ebfedea0SLionel Sambuc COMPILE_ET="\$(top_builddir)/lib/com_err/compile_et" 99ebfedea0SLionel Sambuc DIR_com_err="com_err" 100ebfedea0SLionel Sambuc LIB_com_err="\$(top_builddir)/lib/com_err/libcom_err.la" 101ebfedea0SLionel Sambuc LIB_com_err_a="\$(top_builddir)/lib/com_err/.libs/libcom_err.a" 102ebfedea0SLionel Sambuc LIB_com_err_so="\$(top_builddir)/lib/com_err/.libs/libcom_err.so" 103ebfedea0SLionel Sambuc AC_MSG_NOTICE(Using our own com_err) 104ebfedea0SLionel Sambuc localcomerr=yes 105ebfedea0SLionel Sambucfi 106ebfedea0SLionel SambucAM_CONDITIONAL(COM_ERR, test "$localcomerr" = yes)dnl 107*0a6a1f1dSLionel SambucAC_SUBST(COMPILE_ET) 108ebfedea0SLionel SambucAC_SUBST(DIR_com_err) 109ebfedea0SLionel SambucAC_SUBST(LIB_com_err) 110ebfedea0SLionel SambucAC_SUBST(LIB_com_err_a) 111ebfedea0SLionel SambucAC_SUBST(LIB_com_err_so) 112ebfedea0SLionel Sambuc 113ebfedea0SLionel Sambuc]) 114