lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1227 - in nss-pam-ldapd: . compat

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1227 - in nss-pam-ldapd: . compat



Author: arthur
Date: Wed Sep 29 21:37:51 2010
New Revision: 1227
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1227

Log:
only provide definitions for ether_aton() and ether_ntoa() for platforms 
missing a definition

Modified:
   nss-pam-ldapd/compat/ether.c
   nss-pam-ldapd/configure.ac

Modified: nss-pam-ldapd/compat/ether.c
==============================================================================
--- nss-pam-ldapd/compat/ether.c        Wed Sep 29 21:01:42 2010        (r1226)
+++ nss-pam-ldapd/compat/ether.c        Wed Sep 29 21:37:51 2010        (r1227)
@@ -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 @@
 
 #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)
 {

Modified: nss-pam-ldapd/configure.ac
==============================================================================
--- nss-pam-ldapd/configure.ac  Wed Sep 29 21:01:42 2010        (r1226)
+++ nss-pam-ldapd/configure.ac  Wed Sep 29 21:37:51 2010        (r1227)
@@ -434,8 +434,63 @@
   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,,
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits