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