diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2010-09-29 19:37:51 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2010-09-29 19:37:51 +0000 |
commit | f413be4e52fc7b638ced9cf1c67725258afe7bc4 (patch) | |
tree | 06362a2ed562750a2a12eedc62a3c6d5b9e96aaf | |
parent | 3c436eecebaf3f66c3a2d735f6c567d8eaa75a70 (diff) |
only provide definitions for ether_aton() and ether_ntoa() for platforms missing a definition
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1227 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | compat/ether.c | 4 | ||||
-rw-r--r-- | configure.ac | 59 |
2 files changed, 61 insertions, 2 deletions
diff --git a/compat/ether.c b/compat/ether.c index 6ab052d..28dadf3 100644 --- a/compat/ether.c +++ b/compat/ether.c @@ -37,9 +37,11 @@ #ifndef HAVE_ETHER_NTOA_R +#ifndef HAVE_ETHER_NTOA_DEFINED /* 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 */ char *ether_ntoa_r(const struct ether_addr *addr,char *buf) { @@ -54,9 +56,11 @@ char *ether_ntoa_r(const struct ether_addr *addr,char *buf) #ifndef HAVE_ETHER_ATON_R +#ifndef HAVE_ETHER_ATON_DEFINED /* 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 */ struct ether_addr *ether_aton_r(const char *asc,struct ether_addr *addr) { diff --git a/configure.ac b/configure.ac index 6e3825d..6f8701a 100644 --- a/configure.ac +++ b/configure.ac @@ -434,8 +434,63 @@ then AC_REPLACE_FUNCS(daemon) # replace ether_ntoa_r() and ether_aton_r() if they are not found - AC_CHECK_FUNCS(ether_aton_r ether_ntoa_r,,[AC_CHECK_FUNCS(ether_aton ether_ntoa) - AC_LIBOBJ(ether)]) + AC_CHECK_FUNCS(ether_aton_r ether_ntoa_r,,[AC_LIBOBJ(ether)]) + + # check requirements for our replacement functions + if test $ac_cv_func_ether_aton_r_func = no + 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 $nss_pam_ldapd_cv_have_ether_aton_defined = yes + then + AC_DEFINE_UNQUOTED(HAVE_ETHER_ATON_DEFINED,1, + [Define to 1 if you have the definition for `ether_aton'.]) + fi + fi + if test $ac_cv_func_ether_ntoa_r_func = no + 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 $nss_pam_ldapd_cv_have_ether_ntoa_defined = yes + then + AC_DEFINE_UNQUOTED(HAVE_ETHER_NTOA_DEFINED,1, + [Define to 1 if you have the definition for `ether_ntoa'.]) + fi + fi # check to see if struct sockaddr_storage is defined AC_CHECK_TYPE(struct sockaddr_storage,, |