1dnl
2dnl Additional macros for configure.in packaged up for easier theft.
3dnl tjs@andrew.cmu.edu 6-may-1998
4dnl
5
6dnl It would be good if ANDREW_ADD_LIBPATH could detect if something was
7dnl already there and not redundantly add it if it is.
8
9dnl add -L(arg), and possibly (runpath switch)(arg), to LDFLAGS
10dnl (so the runpath for shared libraries is set).
11AC_DEFUN([CMU_ADD_LIBPATH], [
12  # this is CMU ADD LIBPATH
13  if test "$andrew_cv_runpath_switch" = "none" ; then
14        LDFLAGS="-L$1 ${LDFLAGS}"
15  else
16        LDFLAGS="-L$1 $andrew_cv_runpath_switch$1 ${LDFLAGS}"
17  fi
18])
19
20dnl add -L(1st arg), and possibly (runpath switch)(1st arg), to (2nd arg)
21dnl (so the runpath for shared libraries is set).
22AC_DEFUN([CMU_ADD_LIBPATH_TO], [
23  # this is CMU ADD LIBPATH TO
24  if test "$andrew_cv_runpath_switch" = "none" ; then
25        $2="-L$1 ${$2}"
26  else
27        $2="-L$1 ${$2} $andrew_cv_runpath_switch$1"
28  fi
29])
30
31dnl runpath initialization
32AC_DEFUN([CMU_GUESS_RUNPATH_SWITCH], [
33   # CMU GUESS RUNPATH SWITCH
34  AC_CACHE_CHECK(for runpath switch, andrew_cv_runpath_switch, [
35    # first, try -R
36    SAVE_LDFLAGS="${LDFLAGS}"
37    LDFLAGS="-R /usr/lib"
38    AC_TRY_LINK([],[],[andrew_cv_runpath_switch="-R"], [
39        LDFLAGS="-Wl,-rpath,/usr/lib"
40    AC_TRY_LINK([],[],[andrew_cv_runpath_switch="-Wl,-rpath,"],
41    [andrew_cv_runpath_switch="none"])
42    ])
43  LDFLAGS="${SAVE_LDFLAGS}"
44  ])])
45