3
3
# Copyright (C) 2006 Luke Howard
4
4
# Copyright (C) 2006 West Consulting
5
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Arthur de Jong
5
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Arthur de Jong
7
7
# This library is free software; you can redistribute it and/or
8
8
# modify it under the terms of the GNU Lesser General Public
24
24
[Copyright (C) 2006 Luke Howard
25
25
Copyright (C) 2006 West Consulting
26
Copyright (C) 2006, 2007, 2008, 2009, 2010 Arthur de Jong
26
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Arthur de Jong
28
28
This configure script is derived from configure.ac which is free software;
29
29
you can redistribute it and/or modify it under the terms of the GNU Lesser
32
32
configure.ac file for more details.])
34
34
# initialize and set version and bugreport address
35
AC_INIT([nss-pam-ldapd],[0.7.13],[nss-pam-ldapd-users@lists.arthurdejong.org])
36
RELEASE_MONTH="Dec 2010"
35
AC_INIT([nss-pam-ldapd],
37
[nss-pam-ldapd-users@lists.arthurdejong.org],,
38
[http://arthurdejong.org/nss-pam-ldapd/])
39
RELEASE_MONTH="Sep 2011"
37
40
AC_SUBST(RELEASE_MONTH)
38
41
AC_CONFIG_SRCDIR([nslcd.h])
43
# define package URL (remove when switching to 2.64)
44
m4_ifndef([AC_PACKAGE_URL],
45
PACKAGE_URL="http://arthurdejong.org/nss-pam-ldapd/"
46
[AC_DEFINE_UNQUOTED([PACKAGE_URL],"$PACKAGE_URL",[Define to the home page for this package.])
47
AC_SUBST(PACKAGE_URL)])
40
49
# some initialisation
41
50
AC_CANONICAL_TARGET
42
51
AC_PREFIX_DEFAULT()
123
133
AM_CONDITIONAL([ENABLE_PAM], [test "x$enable_pam" = "xyes"])
125
135
# check whether the nslcd daemon should be built
126
AC_MSG_CHECKING([whether to build the nslcd server])
136
AC_MSG_CHECKING([whether to build the nslcd daemon])
127
137
AC_ARG_ENABLE(nslcd,
128
138
AS_HELP_STRING([--disable-nslcd],
129
[build the nslcd server [[default=enabled]]]),,
139
[build the nslcd daemon [[default=enabled]]]),,
130
140
[enable_nslcd="yes"])
131
141
AC_MSG_RESULT($enable_nslcd)
132
142
AM_CONDITIONAL([ENABLE_NSLCD], [test "x$enable_nslcd" = "xyes"])
144
# check whether the Python version of the nslcd daemon should be built
145
AC_MSG_CHECKING([whether to build the pynslcd daemon])
146
AC_ARG_ENABLE(pynslcd,
147
AS_HELP_STRING([--enable-pynslcd],
148
[build the pynslcd daemon [[default=disabled]]]),,
149
[enable_pynslcd="no"])
150
AC_MSG_RESULT($enable_pynslcd)
151
AM_CONDITIONAL([ENABLE_PYNSLCD], [test "x$enable_pynslcd" = "xyes"])
152
if test "x$enable_pynslcd" = "xyes"
154
AC_MSG_WARN([the pynslcd daemon is experimental])
134
157
# check whether SASL support should be enabled
135
158
AC_MSG_CHECKING([whether to enable SASL support])
136
159
AC_ARG_ENABLE(sasl,
198
222
AC_DEFINE_UNQUOTED(NSLCD_SOCKET,"$NSLCD_SOCKET",[The location of the socket used for communicating.])
199
223
AC_SUBST(NSLCD_SOCKET)
225
# the directory PAM librabries are expected to be placed into
226
AC_ARG_WITH(pam-seclib-dir,
227
AS_HELP_STRING([--with-pam-seclib-dir=PAM_SECLIB_DIR],
228
[path to PAM security library @<:@/lib/security@:>@]),
229
[ PAM_SECLIB_DIR="$with_pam_seclib_dir" ],
230
[ PAM_SECLIB_DIR="/lib/security" ])
231
AC_DEFINE_UNQUOTED(PAM_SECLIB_DIR,"$PAM_SECLIB_DIR",[path to PAM security library])
232
AC_SUBST(PAM_SECLIB_DIR)
201
234
# the SONAME to use for the NSS module
235
AC_MSG_CHECKING([name of NSS module])
202
236
AC_ARG_WITH(nss-ldap-soname,
203
237
AS_HELP_STRING([--with-nss-ldap-soname=SONAME],
204
[name of NSS module @<:@libnss_ldap.so.2@:>@]),
238
[name of NSS module @<:@auto@:>@]),
205
239
[ NSS_LDAP_SONAME="$with_nss_ldap_soname" ],
206
[ NSS_LDAP_SONAME="libnss_ldap.so.2" ])
240
[ NSS_LDAP_SONAME="auto" ])
241
if test "x$NSS_LDAP_SONAME" = "xauto"
244
solaris*) NSS_LDAP_SONAME="nss_ldap.so.1" ;;
245
freebsd*) NSS_LDAP_SONAME="nss_ldap.so.1" ;;
246
*) NSS_LDAP_SONAME="libnss_ldap.so.2" ;;
249
AC_MSG_RESULT($NSS_LDAP_SONAME)
207
250
AC_DEFINE_UNQUOTED(NSS_LDAP_SONAME,"$NSS_LDAP_SONAME",[The SONAME of the NSS library module.])
208
251
AC_SUBST(NSS_LDAP_SONAME)
253
# the SONAME to use for the PAM module
254
AC_MSG_CHECKING([name of PAM module])
255
AC_ARG_WITH(pam-ldap-soname,
256
AS_HELP_STRING([--with-pam-ldap-soname=SONAME],
257
[name of PAM module @<:@auto@:>@]),
258
[ PAM_LDAP_SONAME="$with_pam_ldap_soname" ],
259
[ PAM_LDAP_SONAME="auto" ])
260
if test "x$PAM_LDAP_SONAME" = "xauto"
263
solaris*) PAM_LDAP_SONAME="pam_ldap.so.1" ;;
264
*) PAM_LDAP_SONAME="pam_ldap.so" ;;
267
AC_MSG_RESULT($PAM_LDAP_SONAME)
268
AC_SUBST(PAM_LDAP_SONAME)
270
# check which modules should be build
271
AC_ARG_WITH(nss-maps,
272
AS_HELP_STRING([--with-nss-maps=MAP LIST],
273
[comma separated list of NSS maps to build @<:@all@:>@]),
274
,[ with_nss_maps="all" ])
210
276
# checks for availability of header files
211
277
AC_CHECK_HEADERS([ctype.h strings.h pthread.h fcntl.h limits.h])
212
278
AC_CHECK_HEADERS([nss.h nss_common.h grp.h shadow.h aliases.h netdb.h rpc/rpcent.h])
213
279
AC_CHECK_HEADERS([netinet/ether.h arpa/inet.h netinet/in.h])
280
AC_CHECK_HEADERS([nsswitch.h nss_dbdefs.h])
214
281
AC_CHECK_HEADERS([sys/socket.h sys/un.h sys/ucred.h ucred.h sys/param.h sys/time.h])
215
282
AC_CHECK_HEADERS([getopt.h syslog.h])
306
AC_CHECK_SIZEOF(unsigned int)
307
AC_CHECK_SIZEOF(unsigned long int)
308
AC_CHECK_SIZEOF(unsigned long long int)
309
AC_CHECK_SIZEOF(uid_t)
310
AC_CHECK_SIZEOF(gid_t)
239
312
# check for support for the __thread keyword
240
313
AC_CACHE_CHECK([whether $CC supports '__thread'], [mn_cv_c___thread_supported],
241
[AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[static __thread i;]], []),
314
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[static __thread i;]], [])],
242
315
[mn_cv_c___thread_supported=yes],
243
316
[mn_cv_c___thread_supported=no])])
244
317
if test $mn_cv_c___thread_supported != yes
247
320
AC_DEFINE(__thread,,[Define to empty if compiler does not support `__thread' keyword.])
250
# check how to pass a symbol map to the linker
251
AC_MSG_CHECKING([how linker wants the symbol map])
252
if $CC -Wl,--help 2>&1 | grep -- --version-script >/dev/null
254
VERSION_SCRIPT_FLAG="-Wl,--version-script,"
255
AC_SUBST(VERSION_SCRIPT_FLAG)
256
AC_MSG_RESULT([--version-script])
257
elif $CC -Wl,--help 2>&1 | grep -- '-M mapfile' >/dev/null
259
VERSION_SCRIPT_FLAG="-Wl,-M,"
260
AC_SUBST(VERSION_SCRIPT_FLAG)
263
AC_MSG_RESULT([unknown, not passing symbol map])
265
AM_CONDITIONAL([HAVE_VERSION_SCRIPT_FLAG], [test "x${VERSION_SCRIPT_FLAG}" != x])
267
323
# check for support for the struct ether_addr structure
268
324
AC_CHECK_TYPES(struct ether_addr,,,[
325
#include <sys/types.h>
326
#include <sys/socket.h>
328
#include <netinet/in.h>
329
#include <netinet/if_ether.h>
330
#ifdef HAVE_NETINET_ETHER_H
331
#include <netinet/ether.h>
334
# check for ether_aton and ether_ntoa functions
335
AC_CHECK_FUNCS(ether_aton ether_ntoa ether_aton_r ether_ntoa_r)
336
AC_CHECK_DECLS([ether_aton,ether_ntoa],,,[
337
#include <sys/types.h>
269
338
#include <sys/socket.h>
270
339
#include <net/if.h>
271
340
#include <netinet/in.h>
310
379
#include <rpc/rpcent.h>
313
# check for a definition of enum nss_status
314
AC_CHECK_TYPES(enum nss_status,,,[
382
# check for a definition of enum nss_status and nss_backend_t
383
AC_CHECK_TYPES([enum nss_status,nss_backend_t],,,[
315
384
#ifdef HAVE_NSS_H
318
387
#ifdef HAVE_NSS_COMMON_H
319
388
#include <nss_common.h>
390
#ifdef HAVE_NSS_DBDEFS_H
391
#include <nss_dbdefs.h>
393
#ifdef HAVE_NSSWITCH_H
394
#include <nsswitch.h>
396
#ifdef HAVE_IRS_NSS_H
400
# check if struct nss_XbyY_args has a returnlen attribute
401
AC_CHECK_MEMBERS([struct nss_XbyY_args.returnlen],,,[[
405
#ifdef HAVE_NSS_COMMON_H
406
#include <nss_common.h>
408
#ifdef HAVE_NSS_DBDEFS_H
409
#include <nss_dbdefs.h>
411
#ifdef HAVE_NSSWITCH_H
412
#include <nsswitch.h>
414
#ifdef HAVE_IRS_NSS_H
418
# check which NSS flavour to build
419
AC_MSG_CHECKING([which NSS flavour to build])
420
AC_ARG_WITH(nss-flavour,
421
AS_HELP_STRING([--with-nss-flavour=auto|glibc|solaris|freebsd],
422
[the libc flavour to build our NSS module for @<:@auto@:>@]),,
423
with_nss_flavour=auto)
424
if test "x$with_nss_flavour" = "xauto"
426
# do the guessing game
428
solaris*) with_nss_flavour=solaris ;;
429
freebsd*) with_nss_flavour=freebsd ;;
430
*) with_nss_flavour=glibc ;;
433
AC_MSG_RESULT($with_nss_flavour)
434
case "$with_nss_flavour" in
435
glibc) AC_DEFINE(NSS_FLAVOUR_GLIBC,1,[Whether to use the Glibc NSS interface flavour.]) ;;
436
solaris) AC_DEFINE(NSS_FLAVOUR_SOLARIS,1,[Whether to use the Solaris NSS interface flavour.]) ;;
437
freebsd) AC_DEFINE(NSS_FLAVOUR_FREEBSD,1,[Whether to use the FreeBSD NSS interface flavour.]) ;;
440
# check which module source files to use
441
AC_MSG_CHECKING([which NSS maps to build])
442
if test "x$with_nss_maps" = "xall"
444
case "$with_nss_flavour" in
445
glibc) with_nss_maps="aliases,ethers,group,hosts,netgroup,networks,passwd,protocols,rpc,services,shadow" ;;
446
solaris) with_nss_maps="ethers,group,hosts,netgroup,networks,passwd,protocols,rpc,services,shadow" ;;
447
freebsd) with_nss_maps="group,hosts,passwd" ;;
450
AC_MSG_RESULT($with_nss_maps)
451
NSS_MODULE_OBJS="$(echo "$with_nss_maps " | sed 's/,/ /g;s/ */.$(OBJEXT) /g')"
452
AC_SUBST(NSS_MODULE_OBJS)
454
# find out how to link the library
455
nss_ldap_so_LINK="\$(CCLD) \$(AM_CFLAGS) \$(CFLAGS) \$(nss_ldap_so_LDFLAGS) \$(LDFLAGS) -o \$@"
458
if test "x$GCC" = xyes
460
nss_ldap_so_LINK="/usr/ccs/bin/ld -Bdirect -z nodelete -Bdynamic -M \$(srcdir)/exports.solaris -G -o \$@"
462
nss_ldap_so_LDFLAGS="-Wl,-Bdirect -Wl,-z,nodelete -Wl,-Bdynamic -Wl,-M,\$(srcdir)/exports.solaris -Wl,-G"
466
nss_ldap_so_LDFLAGS="-shared -Wl,-h,\$(NSS_LDAP_SONAME) -Wl,--version-script,\$(srcdir)/exports.$with_nss_flavour"
469
AC_SUBST(nss_ldap_so_LDFLAGS)
470
AC_SUBST(nss_ldap_so_LINK)
322
472
# restore CFLAGS and LIBS
323
473
CFLAGS="$nss_save_CFLAGS"
324
474
LIBS="$nss_save_LIBS"
356
506
AC_REPLACE_FUNCS(pam_get_authtok pam_prompt)
357
507
AC_CHECK_FUNCS(pam_modutil_getpwnam pam_syslog)
509
# find out how to link the library
510
pam_ldap_so_LINK="\$(CCLD) \$(AM_CFLAGS) \$(CFLAGS) \$(pam_ldap_so_LDFLAGS) \$(LDFLAGS) -o \$@"
513
if test "x$GCC" = xyes
515
pam_ldap_so_LINK="/usr/ccs/bin/ld -Bdirect -z nodelete -Bdynamic -M \$(srcdir)/pam_ldap.map -G -o \$@"
517
pam_ldap_so_LDFLAGS="-shared -Wl,-Bdirect -Wl,-z,nodelete -Wl,-Bdynamic -Wl,-M,\$(srcdir)/pam_ldap.map -Wl,-G"
521
pam_ldap_so_LDFLAGS="-shared -Wl,--version-script,\$(srcdir)/pam_ldap.map"
524
AC_SUBST(pam_ldap_so_LDFLAGS)
525
AC_SUBST(pam_ldap_so_LINK)
359
527
# restore CFLAGS and LIBS
360
528
CFLAGS="$pam_save_CFLAGS"
361
529
LIBS="$pam_save_LIBS"
399
569
AC_CHECK_FUNCS(__nss_configure_lookup)
400
570
AC_CHECK_FUNCS(getenv putenv clearenv)
401
571
AC_CHECK_FUNCS(dlopen dlsym dlerror)
572
AC_CHECK_FUNCS(regcomp regexec regerror)
403
# replace getopt_long() function if it is not on the system
574
# replace some functions if they are not on the system
404
575
AC_REPLACE_FUNCS(getopt_long)
576
AC_REPLACE_FUNCS(strndup)
406
578
# replace daemon() function if it is not on the system
407
579
AC_SEARCH_LIBS(daemon,bsd)
408
580
AC_REPLACE_FUNCS(daemon)
581
AC_CHECK_DECLS([daemon],,,[#include <unistd.h>])
410
# replace ether_ntoa_r() and ether_aton_r() if they are not found
411
AC_CHECK_FUNCS(ether_aton_r ether_ntoa_r,,[AC_CHECK_FUNCS(ether_aton ether_ntoa)
583
# replace ether_aton_r() and ether_ntoa_r() if they are not found
584
AC_CHECK_FUNCS(ether_aton_r ether_ntoa_r,,[AC_LIBOBJ(ether)])
414
586
# check to see if struct sockaddr_storage is defined
415
587
AC_CHECK_TYPE(struct sockaddr_storage,,
427
599
# check threading stuff
428
600
AX_PTHREAD(,AC_MSG_ERROR([no support for pthreads]))
429
AC_CHECK_FUNCS(pthread_mutex_lock)
601
pthread_save_CFLAGS="$CFLAGS"
602
pthread_save_LIBS="$LIBS"
603
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
604
LIBS="$LIBS $PTHREAD_LIBS"
605
AC_CHECK_FUNCS([pthread_mutex_lock pthread_join pthread_timedjoin_np])
606
CFLAGS="$pthread_save_CFLAGS"
607
LIBS="$pthread_save_LIBS"
609
# also use deprecated LDAP functions
610
AC_DEFINE(LDAP_DEPRECATED, 1, Define to activate deprecated features in OpenLDAP)
611
# for compatibility on Solaris
612
AC_DEFINE(LDAP_REFERRALS, 1, Define to get some functions on Solaris)
431
614
# search for an LDAP library (only OpenLDAP is tested)
432
615
AC_ARG_WITH(ldap-lib,
479
662
#elif defined(HAVE_SASL_H)
480
663
#include <sasl.h>
482
AC_SEARCH_LIBS(sasl_client_init,sasl2)
483
AC_CHECK_FUNCS(sasl_auxprop_request ldap_sasl_interactive_bind_s)
665
AC_SEARCH_LIBS(ldap_sasl_interactive_bind_s,sasl2)
666
AC_CHECK_FUNCS(ldap_sasl_interactive_bind_s)
486
669
# check for extra Kerberos libraries
487
670
if test "$enable_kerberos" = "yes"
489
672
AC_SEARCH_LIBS(gss_krb5_ccache_name,gssapi gssapi_krb5)
490
AC_SEARCH_LIBS(ldap_gss_bind,gssldap)
491
673
AC_CHECK_FUNCS(gss_krb5_ccache_name)
557
744
AC_SUBST(nslcd_LIBS)
747
# pynslcd daemon-specific tests
748
if test "x$enable_pynslcd" = "xyes"
750
# check Python interpreter
754
AM_CONDITIONAL([NSS_FLAVOUR_GLIBC], [test "x${with_nss_flavour}" = xglibc])
755
AM_CONDITIONAL([NSS_FLAVOUR_SOLARIS], [test "x${with_nss_flavour}" = xsolaris])
756
AM_CONDITIONAL([NSS_FLAVOUR_FREEBSD], [test "x${with_nss_flavour}" = xfreebsd])
561
759
AC_CONFIG_FILES([Makefile compat/Makefile common/Makefile nss/Makefile
562
pam/Makefile nslcd/Makefile man/Makefile tests/Makefile])
760
pam/Makefile nslcd/Makefile pynslcd/Makefile pynslcd/config.py
761
man/Makefile tests/Makefile])