File: configure.in

package info (click to toggle)
libpam-ldap 140-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 644 kB
  • ctags: 271
  • sloc: ansic: 3,168; sh: 2,267; perl: 156; makefile: 67
file content (120 lines) | stat: -rw-r--r-- 4,775 bytes parent folder | download
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
111
112
113
114
115
116
117
118
119
120
AC_INIT(pam_ldap.c)
AC_CANONICAL_SYSTEM
AC_PREFIX_DEFAULT()

AM_INIT_AUTOMAKE(pam_ldap, 140)
AM_CONFIG_HEADER(config.h)

AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL

AC_ARG_ENABLE(ypldapd, [  --enable-ypldapd        enable PADL ypldapd specific features], [AC_DEFINE(YPLDAPD)])
AC_ARG_ENABLE(ssl, [  --disable-ssl           disable SSL/TSL support])
AC_ARG_WITH(ldap-lib, [  --with-ldap-lib=type    select ldap library [auto|netscape5|netscape4|netscape3|umich|openldap]])
AC_ARG_WITH(ldap-dir, [  --with-ldap-dir=DIR     base directory of ldap SDK])
AC_ARG_WITH(ldap-conf-file, [  --with-ldap-conf-file     path to LDAP configuration file], [AC_DEFINE_UNQUOTED(PAM_LDAP_PATH_CONF, "$with_ldap_conf_file")])
AC_ARG_WITH(ldap-secret-file, [  --with-ldap-secret-file   path to LDAP root secret file], [AC_DEFINE_UNQUOTED(PAM_LDAP_PATH_ROOTPASSWD, "$with_ldap_secret_file")])

AM_CONDITIONAL(EXTENSION_SO, test "$target_os" = "linux" -o "$target_os" = "linux-gnu")
if test "$ac_cv_prog_gcc" = "yes"; then CFLAGS="$CFLAGS -Wall -fPIC"; fi

dnl This is needed for the native Solaris LDAP SDK
CPPFLAGS="$CPPFLAGS -DLDAP_REFERRALS"

case "$target_os" in
freebsd*) CPPFLAGS="$CPPFLAGS -DPIC -D_REENTRANT" ;;
aix*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;;
esac

case "$target_os" in
aix*) pam_ldap_so_LDFLAGS="-bM:SRE -bnoentry -bE:\$(srcdir)/exports.aix" ;;
solaris*) pam_ldap_so_LDFLAGS="-Wl,-M -Wl,mapfile -Wl,-G" ;;
darwin*) pam_ldap_so_LDFLAGS="-bundle" ;;
*) pam_ldap_so_LDFLAGS="-shared" ;;
esac
AC_SUBST(pam_ldap_so_LDFLAGS)

if test -n "$with_ldap_dir"; then
  CPPFLAGS="$CPPFLAGS -I$with_ldap_dir/include"
  LDFLAGS="$LDFLAGS -L$with_ldap_dir/lib"
  case "$target_os" in  
  solaris*) LDFLAGS="$LDFLAGS -Wl,-R$with_ldap_dir/lib" ;;  
  *) LDFLAGS="$LDFLAGS -Wl,-rpath,$with_ldap_dir/lib" ;;
  esac  
fi

AC_CHECK_HEADERS(security/pam_appl.h security/pam_misc.h)
AC_CHECK_HEADERS(des.h crypt.h)
AC_CHECK_HEADERS(lber.h)
AC_CHECK_HEADERS(ldap.h, , AC_MSG_ERROR(could not locate <ldap.h>))
AC_CHECK_HEADERS(ldap_ssl.h)

AC_CHECK_LIB(dl, main)
AC_CHECK_LIB(pam, main)
dnl AC_CHECK_LIB(pthread, main)
AC_CHECK_LIB(resolv, main)
AC_CHECK_LIB(crypt, main)

AC_CHECK_FUNCS(gethostbyname)
if test "$ac_cv_func_gethostbyname" = "no"; then
  unset ac_cv_func_gethostbyname
  AC_CHECK_LIB(nsl, main)
  AC_CHECK_FUNCS(gethostbyname)
fi


dnl check which ldap library we have
if test -z "$with_ldap_lib"; then
  with_ldap_lib=auto
fi

if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = umich -o $with_ldap_lib = openldap \); then
  AC_CHECK_LIB(lber, main)
  AC_CHECK_LIB(ldap, main, LIBS="-lldap $LIBS" found_ldap_lib=yes)
fi

if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape5 \); then
  AC_CHECK_LIB(ldap50, main, LIBS="-lldap50 -lssldap50 -lssl3 -lnss3 -lnspr4 -lprldap50 -lplc4 -lplds4 $LIBS" found_ldap_lib=yes need_pthread=true,, -lpthread)
fi
if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape4 \); then
  AC_CHECK_LIB(ldapssl41, main, LIBS="-lldapssl41 -lplc3 -lplds3 -lnspr3 $LIBS" found_ldap_lib=yes need_pthread=true,, -lpthread)
  if test -z "$found_ldap_lib"; then
    AC_CHECK_LIB(ldapssl40, main, LIBS="-lldapssl40 $LIBS" found_ldap_lib=yes need_pthread=true,, -lpthread)
  fi
fi
if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape3 \); then
  AC_CHECK_LIB(ldapssl30, main, LIBS="-lldapssl30 $LIBS" found_ldap_lib=yes need_pthread=true,, -lpthread)
fi

if test -z "$found_ldap_lib"; then
  AC_MSG_ERROR(could not locate a valid LDAP library)
fi

if test "$need_pthread" = "true"; then
  AC_CHECK_LIB(pthread, main)
fi

AC_CHECK_FUNCS(ldap_init ldap_get_lderrno ldap_parse_result ldap_memfree ldap_controls_free ldap_set_option ldap_get_option)
if test "$enable_ssl" \!= "no"; then
  AC_CHECK_FUNCS(ldapssl_init ldap_start_tls_s ldap_pvt_tls_set_option)
fi
AC_CHECK_FUNCS(ldap_initialize)
AC_CHECK_FUNCS(gethostbyname_r)

if test "$ac_cv_func_gethostbyname_r" = "yes"; then
AC_CACHE_CHECK(whether gethostbyname_r takes 6 arguments, pam_ldap_cv_gethostbyname_r_args, [
AC_TRY_COMPILE([
#include <netdb.h>], [gethostbyname_r(0, 0, 0, 0, 0, 0);], [pam_ldap_cv_gethostbyname_r_args=6], [pam_ldap_cv_gethostbyname_r_args=5]) ])
AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_ARGS, $pam_ldap_cv_gethostbyname_r_args)
fi

AC_CHECK_FUNCS(ldap_set_rebind_proc)
AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, pam_ldap_cv_ldap_set_rebind_proc, [
AC_TRY_COMPILE([
#include <lber.h>
#include <ldap.h>], [ldap_set_rebind_proc(0, 0, 0);], [pam_ldap_cv_ldap_set_rebind_proc=3], [pam_ldap_cv_ldap_set_rebind_proc=2]) ])
AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $pam_ldap_cv_ldap_set_rebind_proc)

AC_OUTPUT(Makefile)