summaryrefslogtreecommitdiff
path: root/ext/ldap/config.m4
blob: c86aca2b8a2034ff6be96c44837d3528c02f62e6 (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
dnl $Id$

AC_MSG_CHECKING(for LDAP support)
AC_ARG_WITH(ldap,
[  --with-ldap[=DIR]       Include LDAP support.  DIR is the LDAP base
                          install directory, defaults to /usr/local/ldap],
[
  if test "$withval" != "no"; then
    if test "$withval" = "yes"; then
		if test -f /usr/include/ldap.h; then 
			LDAP_INCDIR=/usr/include
			LDAP_LIBDIR=/usr/lib
		elif test -f /usr/local/include/ldap.h; then
			LDAP_INCDIR=/usr/local/include
			LDAP_LIBDIR=/usr/local/lib
		elif test -f /usr/local/ldap/include/ldap.h; then
			LDAP_INCDIR=/usr/local/ldap/include
			LDAP_LIBDIR=/usr/local/ldap/lib
		elif test -f /usr/include/umich-ldap/ldap.h; then
			LDAP_INCDIR=/usr/include/umich-ldap
			LDAP_LIBDIR=/usr/lib
		else
			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Unable to find ldap.h)
		fi	
    else
		if test -f $withval/include/ldap.h; then
			LDAP_INCDIR=$withval/include
			LDAP_LIBDIR=$withval/lib
		else
			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Unable to find $withval/include/ldap.h)
		fi
    fi

dnl The Linux version of the SDK need -lpthread
dnl I have tested Solaris, and it doesn't, but others may.  Add
dnl these here if necessary.   -RL

	if test `uname` = "Linux"; then
		LDAP_PTHREAD="pthread"
	else
		LDAP_PTHREAD=
	fi

	if test -f $LDAP_LIBDIR/liblber.a; then
		LDAP_LIBS="-lldap -llber"
        AC_ADD_LIBRARY(ldap)
        AC_ADD_LIBRARY(lber,1)
	elif test -f $LDAP_LIBDIR/libldapssl30.so; then
        AC_ADD_LIBRARY(ldapssl30)
        AC_ADD_LIBRARY($LDAP_PTHREAD)
		AC_DEFINE(HAVE_NSLDAP,1,[ ])
	elif test -f $LDAP_LIBDIR/libldapssl30.sl; then
        AC_ADD_LIBRARY(ldapssl30)
		AC_DEFINE(HAVE_NSLDAP,1,[ ])
	elif test -f $LDAP_LIBDIR/libldap30.so; then
        AC_ADD_LIBRARY(ldap30)
        AC_ADD_LIBRARY($LDAP_PTHREAD)
		AC_DEFINE(HAVE_NSLDAP,1,[ ])
	elif test -f $LDAP_LIBDIR/libldap30.sl; then
        AC_ADD_LIBRARY(ldap30)
		AC_DEFINE(HAVE_NSLDAP,1,[ ])
	elif test -f $LDAP_LIBDIR/libumich_ldap.so; then
        AC_ADD_LIBRARY(umich_ldap)
        AC_ADD_LIBRARY(umich_lber,1)
	fi  

    AC_ADD_INCLUDE($LDAP_INCDIR)
    AC_ADD_LIBPATH($LDAP_LIBDIR)

    AC_DEFINE(HAVE_LDAP,1,[ ])

    AC_MSG_RESULT(yes)
    PHP_EXTENSION(ldap)
  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])