pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/libnbcompat/files If dirfd is either a functi...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/68be2b513206
branches:  trunk
changeset: 533609:68be2b513206
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Fri Sep 21 19:51:58 2007 +0000

description:
If dirfd is either a function or a macro, use it. If it doesn't exist,
but DIR contains dd_fd, define it as macro. Otherwise use -1 when
calling fts_safe_changedir in fts(3). Based on patch from Sean Boudreau.

diffstat:

 pkgtools/libnbcompat/files/__fts13.c            |   11 +-
 pkgtools/libnbcompat/files/configure            |  208 +++++++++++++++++++++++-
 pkgtools/libnbcompat/files/configure.ac         |   30 +++-
 pkgtools/libnbcompat/files/nbcompat/config.h.in |    6 +
 pkgtools/libnbcompat/files/nbcompat/dirent.h    |    4 +-
 5 files changed, 251 insertions(+), 8 deletions(-)

diffs (truncated from 335 to 300 lines):

diff -r e3c7b44fc9b7 -r 68be2b513206 pkgtools/libnbcompat/files/__fts13.c
--- a/pkgtools/libnbcompat/files/__fts13.c      Fri Sep 21 19:51:00 2007 +0000
+++ b/pkgtools/libnbcompat/files/__fts13.c      Fri Sep 21 19:51:58 2007 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: __fts13.c,v 1.8 2007/07/31 13:17:33 joerg Exp $        */
+/*     $NetBSD: __fts13.c,v 1.9 2007/09/21 19:51:58 joerg Exp $        */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)fts.c      8.6 (Berkeley) 8/14/94";
 #else
-__RCSID("$NetBSD: __fts13.c,v 1.8 2007/07/31 13:17:33 joerg Exp $");
+__RCSID("$NetBSD: __fts13.c,v 1.9 2007/09/21 19:51:58 joerg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -714,7 +714,12 @@
         */
        cderrno = 0;
        if (nlinks || type == BREAD) {
-               if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) {
+#if defined(HAVE_DIRFD)
+               if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL))
+#else
+               if (fts_safe_changedir(sp, cur, -1, cur->fts_accpath))
+#endif
+               {
                        if (nlinks && type == BREAD)
                                cur->fts_errno = errno;
                        cur->fts_flags |= FTS_DONTCHDIR;
diff -r e3c7b44fc9b7 -r 68be2b513206 pkgtools/libnbcompat/files/configure
--- a/pkgtools/libnbcompat/files/configure      Fri Sep 21 19:51:00 2007 +0000
+++ b/pkgtools/libnbcompat/files/configure      Fri Sep 21 19:51:58 2007 +0000
@@ -10998,7 +10998,213 @@
 else
   :
 fi
-
+{ echo "$as_me:$LINENO: checking for DIR.dd_fd" >&5
+echo $ECHO_N "checking for DIR.dd_fd... $ECHO_C" >&6; }
+if test "${ac_cv_member_DIR_dd_fd+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+ #include <sys/types.h>
+         #if HAVE_DIRENT_H
+         # include <dirent.h>
+         #else
+         # define dirent direct
+         # if HAVE_SYS_NDIR_H
+         #  include <sys/ndir.h>
+         # endif
+         # if HAVE_SYS_DIR_H
+         #  include <sys/dir.h>
+         # endif
+         # if HAVE_NDIR_H
+         #  include <ndir.h>
+         # endif
+         #endif
+
+int
+main ()
+{
+static DIR ac_aggr;
+if (ac_aggr.dd_fd)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_member_DIR_dd_fd=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+ #include <sys/types.h>
+         #if HAVE_DIRENT_H
+         # include <dirent.h>
+         #else
+         # define dirent direct
+         # if HAVE_SYS_NDIR_H
+         #  include <sys/ndir.h>
+         # endif
+         # if HAVE_SYS_DIR_H
+         #  include <sys/dir.h>
+         # endif
+         # if HAVE_NDIR_H
+         #  include <ndir.h>
+         # endif
+         #endif
+
+int
+main ()
+{
+static DIR ac_aggr;
+if (sizeof ac_aggr.dd_fd)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_member_DIR_dd_fd=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_member_DIR_dd_fd=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_member_DIR_dd_fd" >&5
+echo "${ECHO_T}$ac_cv_member_DIR_dd_fd" >&6; }
+if test $ac_cv_member_DIR_dd_fd = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DIR_DD_FD 1
+_ACEOF
+
+:
+else
+  :
+fi
+
+
+{ echo "$as_me:$LINENO: checking for dirfd" >&5
+echo $ECHO_N "checking for dirfd... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+ #include <sys/types.h>
+    #if HAVE_DIRENT_H
+    # include <dirent.h>
+    #else
+    # define dirent direct
+    # if HAVE_SYS_NDIR_H
+    #  include <sys/ndir.h>
+    # endif
+    # if HAVE_SYS_DIR_H
+    #  include <sys/dir.h>
+    # endif
+    # if HAVE_NDIR_H
+    #  include <ndir.h>
+    # endif
+    #endif
+    int dummy_var;
+
+int
+main ()
+{
+ dummy_var = dirfd((DIR *)0)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+       { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DIRFD 1
+_ACEOF
+
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+               { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 
 if test $ac_cv_type_long_long = yes; then
 
diff -r e3c7b44fc9b7 -r 68be2b513206 pkgtools/libnbcompat/files/configure.ac
--- a/pkgtools/libnbcompat/files/configure.ac   Fri Sep 21 19:51:00 2007 +0000
+++ b/pkgtools/libnbcompat/files/configure.ac   Fri Sep 21 19:51:58 2007 +0000
@@ -1,4 +1,4 @@
-dnl $NetBSD: configure.ac,v 1.57 2007/07/21 13:57:33 tnn Exp $
+dnl $NetBSD: configure.ac,v 1.58 2007/09/21 19:51:58 joerg Exp $
 
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.52)
@@ -308,7 +308,7 @@
        [ #include <sys/statfs.h> ])
 AC_CHECK_MEMBERS([struct statfs.f_iosize], [:], [:],
        [ #include <sys/statfs.h> ])
-AC_CHECK_MEMBERS([struct dirent.d_namlen], [:], [:],
+AC_CHECK_MEMBERS([struct dirent.d_namlen, DIR.dd_fd], [:], [:],
        [ #include <sys/types.h>
          #if HAVE_DIRENT_H
          # include <dirent.h>
@@ -325,6 +325,32 @@
          # endif
          #endif ])
 
+AC_MSG_CHECKING([for dirfd])
+AC_TRY_LINK(
+  [ #include <sys/types.h>
+    #if HAVE_DIRENT_H
+    # include <dirent.h>
+    #else
+    # define dirent direct
+    # if HAVE_SYS_NDIR_H
+    #  include <sys/ndir.h>
+    # endif
+    # if HAVE_SYS_DIR_H
+    #  include <sys/dir.h>
+    # endif
+    # if HAVE_NDIR_H
+    #  include <ndir.h>
+    # endif
+    #endif
+    int dummy_var;
+  ], [ dummy_var = dirfd((DIR *)0) ],
+  [
+       AC_MSG_RESULT(yes)
+       AC_DEFINE([HAVE_DIRFD], [1], [Define if dirfd is either a function or a macro.])
+  ], [ AC_MSG_RESULT(no) ]
+
+)
+
 if test $ac_cv_type_long_long = yes; then
 



Home | Main Index | Thread Index | Old Index