source: trunk/third/cyrus-sasl/cmulocal/com_err_link.m4 @ 18842

Revision 18842, 4.0 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18841, which included commits to RCS files with non-trunk default branches.
Line 
1dnl damnit, i don't want to figure out if I need to build an integral com_err
2dnl library with the collection, I just want to know where it's installed,
3dnl so don't bitch, Rob...
4dnl Derrick Brashear
5dnl $Id: com_err_link.m4,v 1.1.1.2 2003-02-12 22:33:57 ghudson Exp $
6
7
8AC_DEFUN(CMU_COMERR_INC_WHERE1, [
9saved_CPPFLAGS=$CPPFLAGS
10CPPFLAGS="$saved_CPPFLAGS -I$1"
11AC_TRY_COMPILE([#include <com_err.h>],
12[int foo;],
13ac_cv_found_com_err_inc=yes,
14ac_cv_found_com_err_inc=no)
15CPPFLAGS=$saved_CPPFLAGS
16])
17
18AC_DEFUN(CMU_COMERR_INC_WHERE, [
19   for i in $1; do
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
25        AC_MSG_RESULT(found)
26        break
27      else
28        AC_MSG_RESULT(not found)
29      fi
30    done
31])
32
33#
34# Test for lib files
35#
36
37AC_DEFUN(CMU_COMERR_LIB_WHERE1, [
38saved_LIBS=$LIBS
39LIBS="$saved_LIBS -L$1 -lcom_err"
40AC_TRY_LINK(,
41[com_err();],
42[ac_cv_found_com_err_lib=yes],
43ac_cv_found_com_err_lib=no)
44LIBS=$saved_LIBS
45])
46
47AC_DEFUN(CMU_COMERR_LIB_WHERE, [
48   for i in $1; do
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
54        AC_MSG_RESULT(found)
55        break
56      else
57        AC_MSG_RESULT(not found)
58      fi
59    done
60])
61
62AC_DEFUN(CMU_USE_COMERR, [
63AC_ARG_WITH(comerr,
64        [  --with-comerr=PREFIX      Compile with com_err support],
65        [if test "X$with_comerr" = "X"; then
66                with_comerr=yes
67        fi])
68AC_ARG_WITH(comerr-lib,
69        [  --with-comerr-lib=dir     use com_err libraries in dir],
70        [if test "$withval" = "yes" -o "$withval" = "no"; then
71                AC_MSG_ERROR([No argument for --with-comerr-lib])
72        fi])
73AC_ARG_WITH(comerr-include,
74        [  --with-comerr-include=dir use com_err headers in dir],
75        [if test "$withval" = "yes" -o "$withval" = "no"; then
76                AC_MSG_ERROR([No argument for --with-comerr-include])
77        fi])
78
79        if test "X$with_comerr" != "X"; then
80          if test "$with_comerr" != "yes"; then
81            ac_cv_comerr_where_lib=$with_comerr/lib
82            ac_cv_comerr_where_inc=$with_comerr/include
83          fi
84        fi
85
86        if test "X$with_comerr_lib" != "X"; then
87          ac_cv_comerr_where_lib=$with_comerr_lib
88        fi
89        if test "X$ac_cv_comerr_where_lib" = "X"; then
90          CMU_COMERR_LIB_WHERE(/usr/athena/lib /usr/lib /usr/local/lib)
91        fi
92
93        if test "X$with_comerr_include" != "X"; then
94          ac_cv_comerr_where_inc=$with_comerr_include
95        fi
96        if test "X$ac_cv_comerr_where_inc" = "X"; then
97          CMU_COMERR_INC_WHERE(/usr/athena/include /usr/local/include)
98        fi
99
100        AC_MSG_CHECKING(whether to include com_err)
101        if test "X$ac_cv_comerr_where_lib" = "X" -a "X$ac_cv_comerr_where_inc" = "X"; then
102          ac_cv_found_com_err=no
103          AC_MSG_RESULT(no)
104        else
105          ac_cv_found_com_err=yes
106          AC_MSG_RESULT(yes)
107          COMERR_INC_DIR=$ac_cv_comerr_where_inc
108          COMERR_LIB_DIR=$ac_cv_comerr_where_lib
109          COMERR_INC_FLAGS="-I${COMERR_INC_DIR}"
110          COMERR_LIB_FLAGS="-L${COMERR_LIB_DIR} -lcom_err"
111          dnl Do not force configure.in to put these in CFLAGS and LIBS unconditionally
112          dnl Allow makefile substitutions....
113          AC_SUBST(COMERR_INC_FLAGS)
114          AC_SUBST(COMERR_LIB_FLAGS)
115          if test "X$RPATH" = "X"; then
116                RPATH=""
117          fi
118          case "${host}" in
119            *-*-linux*)
120              if test "X$RPATH" = "X"; then
121                RPATH="-Wl,-rpath,${COMERR_LIB_DIR}"
122              else
123                RPATH="${RPATH}:${COMERR_LIB_DIR}"
124              fi
125              ;;
126            *-*-hpux*)
127              if test "X$RPATH" = "X"; then
128                RPATH="-Wl,+b${COMERR_LIB_DIR}"
129              else
130                RPATH="${RPATH}:${COMERR_LIB_DIR}"
131              fi
132              ;;
133            *-*-irix*)
134              if test "X$RPATH" = "X"; then
135                RPATH="-Wl,-rpath,${COMERR_LIB_DIR}"
136              else
137                RPATH="${RPATH}:${COMERR_LIB_DIR}"
138              fi
139              ;;
140            *-*-solaris2*)
141              if test "$ac_cv_prog_gcc" = yes; then
142                if test "X$RPATH" = "X"; then
143                  RPATH="-Wl,-R${COMERR_LIB_DIR}"
144                else
145                  RPATH="${RPATH}:${COMERR_LIB_DIR}"
146                fi
147              else
148                RPATH="${RPATH} -R${COMERR_LIB_DIR}"
149              fi
150              ;;
151          esac
152          AC_SUBST(RPATH)
153        fi
154        ])
155
Note: See TracBrowser for help on using the repository browser.