*** empty log message ***
[arla.git] / cf / check-roken.m4
blobf189ad78db069a46665aa5ef081007a6a33d5542
1 dnl
2 dnl $Id$
3 dnl
5 AC_DEFUN([AC_CHECK_ROKEN],[
7 ROKEN_H=roken.h
8 DIR_roken=roken
9 LIB_roken='$(top_builddir)/lib/roken/libroken.a'
10 INC_roken='-I$(top_builddir)/include'
11 ac_cv_arla_with_roken=yes
14 AC_ARG_WITH(roken,
15 [  --with-roken=dir        make with roken in dir],
16 [if test "$with_roken" != "no"; then
17    ROKEN_H=
18    DIR_roken=
19    if test "X$withval" != "Xyes"; then
20         LIB_roken="-L$withval/lib -lroken"
21         INC_roken="-I$withval/include"
23    else
24         LIB_roken='-lroken'
25         INC_roken=
26    fi
27    ac_cv_arla_with_roken=no
28 fi])
30 AC_ARG_WITH(roken-include,
31 [  --with-roken-include=dir make with roken headers in dir],
32 [if test "$with_roken" != "no"; then
33    ROKEN_H=
34    DIR_roken=
35    if test "X$withval" != "Xyes"; then
36         INC_roken="-I$withval"
37    else
38         INC_roken=
39    fi
40    ac_cv_arla_with_roken=no
41 fi])
43 AC_ARG_WITH(roken-lib,
44 [  --with-roken-lib=dir    make with roken lib in dir],
45 [if test "$with_roken" != "no"; then
46    ROKEN_H=
47    DIR_roken=
48    if test "X$withval" != "X"; then
49         LIB_roken="-L$withval -lroken"
50    else
51         LIB_roken="-lroken"
52    fi
53    ac_cv_arla_with_roken=no
54 fi])
56 dnl kerberos may include a roken, lets use that if available
58 if test "X$ac_cv_arla_with_roken" = "Xyes"; then
59   if expr "x$KRB5_LIB_FLAGS" : ".*-lroken" > /dev/null ; then
61     old_CFLAGS="$CFLAGS"
62     CFLAGS="$KRB5_INC_DIR $CFLAGS"
64     AC_CHECK_HEADERS([getarg.h],
65     [working_krb_getarg=yes],[working_krb_getarg=no])
67     CFLAGS="$old_CFLAGS"
69     if test "X$working_krb_getarg" = "Xyes"; then
70       ROKEN_H=
71       DIR_roken=
72       LIB_roken="$KRB5_LIB_DIR -lroken"
73       INC_roken="$KRB5_INC_DIR"
74       ac_cv_arla_with_roken=no
75     fi
76   fi
79 if test "X$ROKEN_H" = "X"; then
81 AC_CACHE_CHECK([what roken depends on ],[ac_cv_roken_deps],[
82 ac_cv_roken_deps="error"
83 saved_LIBS="$LIBS"
84 for a in "" "-lcrypt" ; do
85   LIBS="$saved_LIBS $LIB_roken $a"
86   AC_TRY_LINK([],[getarg()],[
87     if test "X$a" = "X"; then
88       ac_cv_roken_deps="nothing"
89     else
90       ac_cv_roken_deps="$a"
91     fi],[])
92   LIBS="$saved_LIBS"
93   if test $ac_cv_roken_deps != "error"; then break; fi
94 done
95 LIBS="$saved_LIBS"
98 if test "$ac_cv_roken_deps" = "error"; then
99   AC_MSG_ERROR([failed to figure out libroken depencies])
102 if test "$ac_cv_roken_deps" != "nothing"; then
103   LIB_roken="$LIB_roken $ac_cv_roken_deps"
108 AC_SUBST(INC_roken)
109 AC_SUBST(LIB_roken)
110 AC_SUBST(DIR_roken)
111 AC_SUBST(ROKEN_H)