GSS_S_PROMPTING_NEEDED is a bit
[cyrus-sasl.git] / cmulocal / librestrict.m4
1 dnl librestrict.m4--restrict libraries and includes
2 dnl Derrick Brashear
3 dnl from KTH krb and Arla
4 dnl $Id: librestrict.m4,v 1.6 2006/02/25 18:26:22 cg2v Exp $
5
6 AC_DEFUN([CMU_RESTRICT_LIB_WHERE1], [
7 saved_LIBS=$LIBS
8 LIBS="$saved_LIBS -L$1 -lrestrict"
9 AC_TRY_LINK(,
10 [ConsoleInUse();],
11 [ac_cv_found_restrict_lib=yes],
12 ac_cv_found_restrict_lib=no)
13 LIBS=$saved_LIBS
14 ])
15
16 AC_DEFUN([CMU_RESTRICT_LIB_WHERE], [
17    for i in $1; do
18       AC_MSG_CHECKING(for restrict library in $i)
19       CMU_RESTRICT_LIB_WHERE1($i)
20       CMU_TEST_LIBPATH($i, restrict)
21       if test "$ac_cv_found_restrict_lib" = "yes" ; then
22         ac_cv_restrict_where_lib=$i
23         AC_MSG_RESULT(found)
24         break
25       else
26         AC_MSG_RESULT(no found)
27       fi
28     done
29 ])
30
31 AC_DEFUN([CMU_RESTRICT], [
32 AC_REQUIRE([CMU_FIND_LIB_SUBDIR])
33 AC_ARG_WITH(restrict,
34         [  --with-restrict=PREFIX      Compile with RESTRICT support],
35         [if test "X$with_restrict" = "X"; then
36                 with_restrict=yes
37         fi])
38
39         if test "X$with_restrict" != "X"; then
40           if test "$with_restrict" != "yes"; then
41             ac_cv_restrict_where_lib=$with_restrict/$CMU_LIB_SUBDIR
42           fi
43         fi
44
45         if test "X$with_restrict_lib" != "X"; then
46           ac_cv_restrict_where_lib=$with_restrict_lib
47         fi
48         if test "X$ac_cv_restrict_where_lib" = "X"; then
49           CMU_RESTRICT_LIB_WHERE(/usr/$CMU_LIB_SUBDIR /usr/local/$CMU_LIB_SUBDIR)
50         fi
51
52         AC_MSG_CHECKING(whether to include restrict)
53         if test "X$ac_cv_restrict_where_lib" = "X"; then
54           ac_cv_found_restrict=no
55           AC_MSG_RESULT(no)
56         else
57           ac_cv_found_restrict=yes
58           AC_DEFINE(HAVE_RESTRICT,, [Use librestrict])
59           AC_MSG_RESULT(yes)
60           RESTRICT_LIB_DIR=$ac_cv_restrict_where_lib
61           RESTRICT_LIB_FLAGS="-L${RESTRICT_LIB_DIR} -lrestrict"
62           if test "X$RPATH" = "X"; then
63                 RPATH=""
64           fi
65           case "${host}" in
66             *-*-linux*)
67               if test "X$RPATH" = "X"; then
68                 RPATH="-Wl,-rpath,${RESTRICT_LIB_DIR}"
69               else 
70                 RPATH="${RPATH}:${RESTRICT_LIB_DIR}"
71               fi
72               ;;
73             *-*-hpux*)
74               if test "X$RPATH" = "X"; then
75                 RPATH="-Wl,+b${RESTRICT_LIB_DIR}"
76               else 
77                 RPATH="${RPATH}:${RESTRICT_LIB_DIR}"
78               fi
79               ;;
80             *-*-irix*)
81               if test "X$RPATH" = "X"; then
82                 RPATH="-Wl,-rpath,${RESTRICT_LIB_DIR}"
83               else 
84                 RPATH="${RPATH}:${RESTRICT_LIB_DIR}"
85               fi
86               ;;
87             *-*-solaris2*)
88               if test "$ac_cv_prog_gcc" = yes; then
89                 if test "X$RPATH" = "X"; then
90                   RPATH="-Wl,-R${RESTRICT_LIB_DIR}"
91                 else 
92                   RPATH="${RPATH}:${RESTRICT_LIB_DIR}"
93                 fi
94               else
95                 RPATH="${RPATH} -R${RESTRICT_LIB_DIR}"
96               fi
97               ;;
98           esac
99           AC_SUBST(RPATH)
100         fi
101         ])
102