1 dnl damnit, i don't want to figure out if I need to build an integral com_err
2 dnl library with the collection, I just want to know where it's installed,
3 dnl so don't bitch, Rob...
5 dnl $Id: com_err_link.m4,v 1.9 2006/02/25 18:32:46 cg2v Exp $
8 AC_DEFUN([CMU_COMERR_INC_WHERE1], [
9 saved_CPPFLAGS=$CPPFLAGS
10 CPPFLAGS="$saved_CPPFLAGS -I$1"
11 AC_TRY_COMPILE([#include <com_err.h>],
13 ac_cv_found_com_err_inc=yes,
14 ac_cv_found_com_err_inc=no)
15 CPPFLAGS=$saved_CPPFLAGS
18 AC_DEFUN([CMU_COMERR_INC_WHERE], [
20 AC_MSG_CHECKING(for com_err headers in $i)
21 CMU_COMERR_INC_WHERE1($i)
22 CMU_TEST_INCPATH($i, com_err)
23 if test "$ac_cv_found_com_err_inc" = "yes"; then
24 ac_cv_comerr_where_inc=$i
28 AC_MSG_RESULT(not found)
37 AC_DEFUN([CMU_COMERR_LIB_WHERE1], [
39 LIBS="$saved_LIBS -L$1 -lcom_err"
42 [ac_cv_found_com_err_lib=yes],
43 ac_cv_found_com_err_lib=no)
47 AC_DEFUN([CMU_COMERR_LIB_WHERE], [
49 AC_MSG_CHECKING(for com_err libraries in $i)
50 CMU_COMERR_LIB_WHERE1($i)
51 CMU_TEST_LIBPATH($i, com_err)
52 if test "$ac_cv_found_com_err_lib" = "yes" ; then
53 ac_cv_comerr_where_lib=$i
57 AC_MSG_RESULT(not found)
62 AC_DEFUN([CMU_USE_COMERR], [
63 AC_REQUIRE([CMU_FIND_LIB_SUBDIR])
65 [ --with-comerr=PREFIX Compile with com_err support],
66 [if test "X$with_comerr" = "X"; then
69 AC_ARG_WITH(comerr-lib,
70 [ --with-comerr-lib=dir use com_err libraries in dir],
71 [if test "$withval" = "yes" -o "$withval" = "no"; then
72 AC_MSG_ERROR([No argument for --with-comerr-lib])
74 AC_ARG_WITH(comerr-include,
75 [ --with-comerr-include=dir use com_err headers in dir],
76 [if test "$withval" = "yes" -o "$withval" = "no"; then
77 AC_MSG_ERROR([No argument for --with-comerr-include])
80 if test "X$with_comerr" != "X"; then
81 if test "$with_comerr" != "yes"; then
82 ac_cv_comerr_where_lib=$with_comerr/$CMU_LIB_SUBDIR
83 ac_cv_comerr_where_inc=$with_comerr/include
87 if test "X$with_comerr_lib" != "X"; then
88 ac_cv_comerr_where_lib=$with_comerr_lib
90 if test "X$ac_cv_comerr_where_lib" = "X"; then
91 CMU_COMERR_LIB_WHERE(/usr/athena/$CMU_LIB_SUBDIR /usr/$CMU_LIB_SUBDIR /usr/local/$CMU_LIB_SUBDIR)
94 if test "X$with_comerr_include" != "X"; then
95 ac_cv_comerr_where_inc=$with_comerr_include
97 if test "X$ac_cv_comerr_where_inc" = "X"; then
98 CMU_COMERR_INC_WHERE(/usr/athena/include /usr/local/include)
101 AC_MSG_CHECKING(whether to include com_err)
102 if test "X$ac_cv_comerr_where_lib" = "X" -a "X$ac_cv_comerr_where_inc" = "X"; then
103 ac_cv_found_com_err=no
106 ac_cv_found_com_err=yes
108 COMERR_INC_DIR=$ac_cv_comerr_where_inc
109 COMERR_LIB_DIR=$ac_cv_comerr_where_lib
110 test "$COMERR_INC_DIR" && COMERR_INC_FLAGS="-I${COMERR_INC_DIR}"
111 COMERR_LIB_FLAGS="-lcom_err"
112 test "$COMERR_LIB_DIR" && COMERR_LIB_FLAGS="-L${COMERR_LIB_DIR} -lcom_err"
113 dnl Do not force configure.in to put these in CFLAGS and LIBS unconditionally
114 dnl Allow makefile substitutions....
115 AC_SUBST(COMERR_INC_FLAGS)
116 AC_SUBST(COMERR_LIB_FLAGS)
117 if test "X$RPATH" = "X"; then
122 if test "X$RPATH" = "X"; then
123 RPATH="-Wl,-rpath,${COMERR_LIB_DIR}"
125 RPATH="${RPATH}:${COMERR_LIB_DIR}"
129 if test "X$RPATH" = "X"; then
130 RPATH="-Wl,+b${COMERR_LIB_DIR}"
132 RPATH="${RPATH}:${COMERR_LIB_DIR}"
136 if test "X$RPATH" = "X"; then
137 RPATH="-Wl,-rpath,${COMERR_LIB_DIR}"
139 RPATH="${RPATH}:${COMERR_LIB_DIR}"
143 if test "$ac_cv_prog_gcc" = yes; then
144 if test "X$RPATH" = "X"; then
145 RPATH="-Wl,-R${COMERR_LIB_DIR}"
147 RPATH="${RPATH}:${COMERR_LIB_DIR}"
150 RPATH="${RPATH} -R${COMERR_LIB_DIR}"