~ubuntu-branches/ubuntu/gutsy/cyrus-sasl2/gutsy-201105300151

« back to all changes in this revision

Viewing changes to cmulocal/com_err_link.m4

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2006-11-27 12:59:40 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20061127125940-na3q3g3tkydvyvgl
Tags: 2.1.22.dfsg1-4ubuntu1
* Merge from debian unstable, remaining changes:
  - remove stop links from rc0 and rc6
  - build against db4.3 instead of 4.2
  - build against heimdal-dev instead of libkrb5-dev
  - depend on, don't recommend, modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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...
 
4
dnl Derrick Brashear
 
5
dnl $Id: com_err_link.m4,v 1.9 2006/02/25 18:32:46 cg2v Exp $
 
6
 
 
7
 
 
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>],
 
12
[int foo;],
 
13
ac_cv_found_com_err_inc=yes,
 
14
ac_cv_found_com_err_inc=no)
 
15
CPPFLAGS=$saved_CPPFLAGS
 
16
])
 
17
 
 
18
AC_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
 
 
37
AC_DEFUN([CMU_COMERR_LIB_WHERE1], [
 
38
saved_LIBS=$LIBS
 
39
LIBS="$saved_LIBS -L$1 -lcom_err"
 
40
AC_TRY_LINK(,
 
41
[com_err();],
 
42
[ac_cv_found_com_err_lib=yes],
 
43
ac_cv_found_com_err_lib=no)
 
44
LIBS=$saved_LIBS
 
45
])
 
46
 
 
47
AC_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
 
 
62
AC_DEFUN([CMU_USE_COMERR], [
 
63
AC_REQUIRE([CMU_FIND_LIB_SUBDIR])
 
64
AC_ARG_WITH(comerr,
 
65
        [  --with-comerr=PREFIX      Compile with com_err support],
 
66
        [if test "X$with_comerr" = "X"; then
 
67
                with_comerr=yes
 
68
        fi])
 
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])
 
73
        fi])
 
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])
 
78
        fi])
 
79
 
 
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
 
84
          fi
 
85
        fi
 
86
 
 
87
        if test "X$with_comerr_lib" != "X"; then
 
88
          ac_cv_comerr_where_lib=$with_comerr_lib
 
89
        fi
 
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)
 
92
        fi
 
93
 
 
94
        if test "X$with_comerr_include" != "X"; then
 
95
          ac_cv_comerr_where_inc=$with_comerr_include
 
96
        fi
 
97
        if test "X$ac_cv_comerr_where_inc" = "X"; then
 
98
          CMU_COMERR_INC_WHERE(/usr/athena/include /usr/local/include)
 
99
        fi
 
100
 
 
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
 
104
          AC_MSG_RESULT(no)
 
105
        else
 
106
          ac_cv_found_com_err=yes
 
107
          AC_MSG_RESULT(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
 
118
                RPATH=""
 
119
          fi
 
120
          case "${host}" in
 
121
            *-*-linux*)
 
122
              if test "X$RPATH" = "X"; then
 
123
                RPATH="-Wl,-rpath,${COMERR_LIB_DIR}"
 
124
              else 
 
125
                RPATH="${RPATH}:${COMERR_LIB_DIR}"
 
126
              fi
 
127
              ;;
 
128
            *-*-hpux*)
 
129
              if test "X$RPATH" = "X"; then
 
130
                RPATH="-Wl,+b${COMERR_LIB_DIR}"
 
131
              else 
 
132
                RPATH="${RPATH}:${COMERR_LIB_DIR}"
 
133
              fi
 
134
              ;;
 
135
            *-*-irix*)
 
136
              if test "X$RPATH" = "X"; then
 
137
                RPATH="-Wl,-rpath,${COMERR_LIB_DIR}"
 
138
              else 
 
139
                RPATH="${RPATH}:${COMERR_LIB_DIR}"
 
140
              fi
 
141
              ;;
 
142
            *-*-solaris2*)
 
143
              if test "$ac_cv_prog_gcc" = yes; then
 
144
                if test "X$RPATH" = "X"; then
 
145
                  RPATH="-Wl,-R${COMERR_LIB_DIR}"
 
146
                else 
 
147
                  RPATH="${RPATH}:${COMERR_LIB_DIR}"
 
148
                fi
 
149
              else
 
150
                RPATH="${RPATH} -R${COMERR_LIB_DIR}"
 
151
              fi
 
152
              ;;
 
153
          esac
 
154
          AC_SUBST(RPATH)
 
155
        fi
 
156
        ])
 
157