summaryrefslogtreecommitdiffstats
path: root/kioslave/http/configure.in.in
blob: a7d1ca7cf4eb182339a042bb37ffb5ef7cf5d3ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
AC_MSG_CHECKING(whether to enable GSSAPI support)
AC_ARG_WITH(gssapi,
[  --with-gssapi=PATH      Set path for GSSAPI files [default=check]],
[ case "$withval" in
  yes)
    with_gssapi=CHECK
    ;;
  esac ],
[ with_gssapi=CHECK ]
)dnl

if test "x$with_gssapi" = "xCHECK" ; then
  with_gssapi=NOTFOUND
  KDE_FIND_PATH(krb5-config, KRB5_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/bin /usr/local/bin /opt/local/bin /usr/lib/mit/bin], [
    AC_MSG_WARN([Could not find krb5-config])
  ])

  if test -n "$KRB5_CONFIG"; then
    kde_save_cflags="$CFLAGS"
    unset CFLAGS
    GSSAPI_INCS="`$KRB5_CONFIG --cflags gssapi`"
    GSSAPI_LIBS="`$KRB5_CONFIG --libs gssapi`"
    CFLAGS="$kde_save_cflags"
    if test "$USE_RPATH" = yes; then
      for args in $GSSAPI_LIBS; do
        case $args in
          -L/usr/lib) ;;
          -L*)
             GSSAPI_RPATH="$GSSAPI_RPATH $args"
             ;;
        esac
      done
      GSSAPI_RPATH=`echo $GSSAPI_RPATH | sed -e "s/-L/-R/g"`
    fi
    gssapi_incdir="$GSSAPI_INCS"
    gssapi_libdir="$GSSAPI_LIBS"
    with_gssapi=FOUND
    if $KRB5_CONFIG --vendor | grep "Massachusetts" > /dev/null; then
      gssapi_flavor=MIT
    else
      gssapi_flavor=HEIMDAL
    fi
  else
    search_incs="$kde_includes /usr/include /usr/local/include"
    AC_FIND_FILE(gssapi.h, $search_incs, gssapi_incdir)
    if test -r $gssapi_incdir/gssapi.h ; then
      test "x$gssapi_incdir" != "x/usr/include" && GSSAPI_INCS="-I$gssapi_incdir"
      with_gssapi=FOUND
    fi
    if test $with_gssapi = FOUND ; then
      with_gssapi=NOTFOUND
      for ext in la so sl a dylib ; do
        AC_FIND_FILE(libgssapi.$ext, $kde_libraries /usr/lib /usr/local/lib,
          gssapi_libdir)
        if test -r $gssapi_libdir/libgssapi.$ext ; then
          if test "x$gssapi_libdir" != "x/usr/lib" ; then
            GSSAPI_LIBS="-L$gssapi_libdir "
            test "$USE_RPATH" = yes && GSSAPI_RPATH="-R $gssapi_libdir"
          fi
          GSSAPI_LIBS="${GSSAPI_LIBS} -lgssapi -lkrb5 -lasn1 -lcrypto -lroken -lcrypt ${LIBRESOLV}"
          with_gssapi=FOUND
          gssapi_flavor=HEIMDAL
          break
        fi
      done
    fi
  fi
fi

case "$with_gssapi" in
no) AC_MSG_RESULT(no) ;;
framework)
  GSSAPI_LIBS="-Xlinker -framework -Xlinker Kerberos"
  AC_DEFINE_UNQUOTED(HAVE_LIBGSSAPI, 1, [Define if you have GSSAPI libraries])
  GSSAPI_SUBDIR="gssapi"
  AC_MSG_RESULT(Apple framework)
  ;;
NOTFOUND) AC_MSG_RESULT(searched but not found) ;;
*)
  if test "x$with_gssapi" = "xFOUND" ; then
    msg="incs=$gssapi_incdir libs=$gssapi_libdir"
  else
    msg="$with_gssapi"
    GSSAPI_ROOT="$with_gssapi"
    if test "x$GSSAPI_ROOT" != "x/usr" ; then
      GSSAPI_INCS="-I${GSSAPI_ROOT}/include"
      GSSAPI_LIBS="-L${GSSAPI_ROOT}/lib "
      if test "$USE_RPATH" = "yes" ; then
        GSSAPI_RPATH="-R ${GSSAPI_ROOT}/lib"
      fi
    fi
    if test -f ${GSSAPI_ROOT}/include/gssapi/gssapi.h ; then
      gssapi_flavor=MIT
      GSSAPI_LIBS="${GSSAPI_LIBS}-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err ${LIBRESOLV}"
    else
      gssapi_flavor=HEIMDAL
      GSSAPI_LIBS="${GSSAPI_LIBS}-lgssapi -lkrb5 -lasn1 -lcrypto -lroken -lcrypt ${LIBRESOLV}"
    fi
  fi
  if test "x$gssapi_flavor" = "xMIT" ; then
    AC_DEFINE_UNQUOTED(GSSAPI_MIT, 1, [Define if you have the MIT Kerberos libraries])
  fi
  AC_DEFINE_UNQUOTED(HAVE_LIBGSSAPI, 1, [Define if you have GSSAPI libraries])
  AC_MSG_RESULT($msg)
  ;;
esac

AC_SUBST(GSSAPI_INCS)
AC_SUBST(GSSAPI_LIBS)
AC_SUBST(GSSAPI_RPATH)