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.3 2002/12/21 18:44:25 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_ARG_WITH(restrict, |
33 |
[ --with-restrict=PREFIX Compile with RESTRICT support], |
34 |
[if test "X$with_restrict" = "X"; then |
35 |
with_restrict=yes |
36 |
fi]) |
37 |
|
38 |
if test "X$with_restrict" != "X"; then |
39 |
if test "$with_restrict" != "yes"; then |
40 |
ac_cv_restrict_where_lib=$with_restrict/lib |
41 |
fi |
42 |
fi |
43 |
|
44 |
if test "X$with_restrict_lib" != "X"; then |
45 |
ac_cv_restrict_where_lib=$with_restrict_lib |
46 |
fi |
47 |
if test "X$ac_cv_restrict_where_lib" = "X"; then |
48 |
CMU_RESTRICT_LIB_WHERE(/usr/lib /usr/local/lib) |
49 |
fi |
50 |
|
51 |
AC_MSG_CHECKING(whether to include restrict) |
52 |
if test "X$ac_cv_restrict_where_lib" = "X"; then |
53 |
ac_cv_found_restrict=no |
54 |
AC_MSG_RESULT(no) |
55 |
else |
56 |
ac_cv_found_restrict=yes |
57 |
AC_DEFINE(HAVE_RESTRICT) |
58 |
AC_MSG_RESULT(yes) |
59 |
RESTRICT_LIB_DIR=$ac_cv_restrict_where_lib |
60 |
RESTRICT_LIB_FLAGS="-L${RESTRICT_LIB_DIR} -lrestrict" |
61 |
if test "X$RPATH" = "X"; then |
62 |
RPATH="" |
63 |
fi |
64 |
case "${host}" in |
65 |
*-*-linux*) |
66 |
if test "X$RPATH" = "X"; then |
67 |
RPATH="-Wl,-rpath,${RESTRICT_LIB_DIR}" |
68 |
else |
69 |
RPATH="${RPATH}:${RESTRICT_LIB_DIR}" |
70 |
fi |
71 |
;; |
72 |
*-*-hpux*) |
73 |
if test "X$RPATH" = "X"; then |
74 |
RPATH="-Wl,+b${RESTRICT_LIB_DIR}" |
75 |
else |
76 |
RPATH="${RPATH}:${RESTRICT_LIB_DIR}" |
77 |
fi |
78 |
;; |
79 |
*-*-irix*) |
80 |
if test "X$RPATH" = "X"; then |
81 |
RPATH="-Wl,-rpath,${RESTRICT_LIB_DIR}" |
82 |
else |
83 |
RPATH="${RPATH}:${RESTRICT_LIB_DIR}" |
84 |
fi |
85 |
;; |
86 |
*-*-solaris2*) |
87 |
if test "$ac_cv_prog_gcc" = yes; then |
88 |
if test "X$RPATH" = "X"; then |
89 |
RPATH="-Wl,-R${RESTRICT_LIB_DIR}" |
90 |
else |
91 |
RPATH="${RPATH}:${RESTRICT_LIB_DIR}" |
92 |
fi |
93 |
else |
94 |
RPATH="${RPATH} -R${RESTRICT_LIB_DIR}" |
95 |
fi |
96 |
;; |
97 |
esac |
98 |
AC_SUBST(RPATH) |
99 |
fi |
100 |
]) |