diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2010-10-01 08:11:37 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2010-10-01 08:11:37 +0000 |
commit | 441c1838035aee4e6b33b8deee4646e65ad1ed47 (patch) | |
tree | c0525e37b4b0752b193d5911865c350a9acca163 | |
parent | 7a59469d9a7f7c4eddeff46e451bac4757f154fe (diff) |
use AC_CHECK_DECLS to check for definitions of functions we provide a replacement definition for
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1233 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | compat/ether.c | 8 | ||||
-rw-r--r-- | compat/ldap_passwd_s.c | 6 | ||||
-rw-r--r-- | configure.ac | 68 |
3 files changed, 22 insertions, 60 deletions
diff --git a/compat/ether.c b/compat/ether.c index 28dadf3..f02576c 100644 --- a/compat/ether.c +++ b/compat/ether.c @@ -37,11 +37,11 @@ #ifndef HAVE_ETHER_NTOA_R -#ifndef HAVE_ETHER_NTOA_DEFINED +#if !HAVE_DECL_ETHER_NTOA /* we define ether_ntoa() here because on some platforms the function is underfined */ extern char *ether_ntoa(const struct ether_addr *e); -#endif /* not HAVE_ETHER_NTOA_DEFINED */ +#endif /* not HAVE_DECL_ETHER_NTOA */ char *ether_ntoa_r(const struct ether_addr *addr,char *buf) { @@ -56,11 +56,11 @@ char *ether_ntoa_r(const struct ether_addr *addr,char *buf) #ifndef HAVE_ETHER_ATON_R -#ifndef HAVE_ETHER_ATON_DEFINED +#if !HAVE_DECL_ETHER_ATON /* we define ether_aton() here because on some platforms the function is underfined */ extern struct ether_addr *ether_aton(const char *s); -#endif /* not HAVE_ETHER_ATON_DEFINED */ +#endif /* not HAVE_DECL_ETHER_ATON */ struct ether_addr *ether_aton_r(const char *asc,struct ether_addr *addr) { diff --git a/compat/ldap_passwd_s.c b/compat/ldap_passwd_s.c index 97fcb3c..85825cb 100644 --- a/compat/ldap_passwd_s.c +++ b/compat/ldap_passwd_s.c @@ -4,7 +4,7 @@ (taken from _update_authtok() in pam_ldap.c). Copyright (C) 1998-2004 Luke Howard - Copyright (C) 2009 Arthur de Jong + Copyright (C) 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -53,11 +53,13 @@ #define ber_memfree free #endif /* not HAVE_BER_MEMFREE */ +#if !HAVE_DECL_LDAP_EXTENDED_OPERATION_S /* we define this ourselves here because some LDAP header versions don't seem to define this */ -int ldap_extended_operation_s(LDAP *ld,LDAP_CONST char *reqoid, +extern int ldap_extended_operation_s(LDAP *ld,LDAP_CONST char *reqoid, struct berval *reqdata,LDAPControl **serverctrls,LDAPControl **clientctrls, char **retoidp,struct berval **retdatap); +#endif /* not HAVE_DECL_LDAP_EXTENDED_OPERATION_S */ /* Replacement for password modification. user is the DN of the entry to change, oldpw is the old password (may not always be needed?), newpw is diff --git a/configure.ac b/configure.ac index d5f0df6..f56d515 100644 --- a/configure.ac +++ b/configure.ac @@ -437,60 +437,15 @@ then AC_CHECK_FUNCS(ether_aton_r ether_ntoa_r,,[AC_LIBOBJ(ether)]) # check requirements for our replacement functions - if test "x$ac_cv_func_ether_aton_r_func" != "xyes" - then - # we should have a simple ether_aton() - AC_CHECK_FUNCS(ether_aton) - # see if ether_aton() is defined in some header file - AC_CACHE_CHECK([for ether_aton() definition], - nss_pam_ldapd_cv_have_ether_aton_defined, - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ - #include <sys/socket.h> - #include <net/if.h> - #include <netinet/in.h> - #include <netinet/if_ether.h> - #ifdef HAVE_NETINET_ETHER_H - #include <netinet/ether.h> - #endif - ]],[[ - extern int ether_aton(int); - ]])], - [nss_pam_ldapd_cv_have_ether_aton_defined=no], - [nss_pam_ldapd_cv_have_ether_aton_defined=yes]) ]) - if test "x$nss_pam_ldapd_cv_have_ether_aton_defined" = "xyes" - then - AC_DEFINE_UNQUOTED(HAVE_ETHER_ATON_DEFINED,1, - [Define to 1 if you have the definition for `ether_aton'.]) - fi - fi - if test "x$ac_cv_func_ether_ntoa_r_func" != "xyes" - then - # we should have a simple ether_ntoa() - AC_CHECK_FUNCS(ether_ntoa) - # see if ether_ntoa() is defined in some header file - AC_CACHE_CHECK([for ether_ntoa() definition], - nss_pam_ldapd_cv_have_ether_ntoa_defined, - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ - #include <sys/socket.h> - #include <net/if.h> - #include <netinet/in.h> - #include <netinet/if_ether.h> - #ifdef HAVE_NETINET_ETHER_H - #include <netinet/ether.h> - #endif - ]],[[ - extern int ether_ntoa(int); - ]])], - [nss_pam_ldapd_cv_have_ether_ntoa_defined=no], - [nss_pam_ldapd_cv_have_ether_ntoa_defined=yes]) ]) - if test "x$nss_pam_ldapd_cv_have_ether_ntoa_defined" = "xyes" - then - AC_DEFINE_UNQUOTED(HAVE_ETHER_NTOA_DEFINED,1, - [Define to 1 if you have the definition for `ether_ntoa'.]) - fi - fi + AC_CHECK_FUNCS(ether_ntoa ether_aton) + AC_CHECK_DECLS([ether_ntoa,ether_aton],,,[ + #include <sys/socket.h> + #include <net/if.h> + #include <netinet/in.h> + #include <netinet/if_ether.h> + #ifdef HAVE_NETINET_ETHER_H + #include <netinet/ether.h> + #endif]) # check to see if struct sockaddr_storage is defined AC_CHECK_TYPE(struct sockaddr_storage,, @@ -585,6 +540,11 @@ then # replace ldap_create_page_control() and ldap_parse_page_control() AC_CHECK_FUNCS(ldap_create_page_control ldap_parse_page_control,,[AC_LIBOBJ(pagectrl)]) + AC_CHECK_DECLS(ldap_extended_operation_s,,,[ + #if HAVE_LBER_H + #include <lber.h> + #endif + #include <ldap.h>]) # replace other ldap functions AC_REPLACE_FUNCS(ldap_passwd_s) |