summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-11-23 18:09:37 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-11-23 18:09:37 +0000
commitae0e3d3b35cf70354d3fdbc894ffe3064a567667 (patch)
treea47416a946612d985678972cdc902e94b52f4ead
parent165444cdf3b3a33edaf56f31103ddaa68085c6b2 (diff)
downloadperl-ae0e3d3b35cf70354d3fdbc894ffe3064a567667.tar.gz
Add probing for dirfd() so that it can be added it IO::Dir.
p4raw-id: //depot/perl@13211
-rwxr-xr-xConfigure69
-rw-r--r--config_h.SH6
-rw-r--r--perl.h51
3 files changed, 93 insertions, 33 deletions
diff --git a/Configure b/Configure
index 0b1b043c04..87ba29cd01 100755
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
-# Generated on Thu Nov 22 08:04:01 EET 2001 [metaconfig 3.0 PL70]
+# Generated on Fri Nov 23 21:08:41 EET 2001 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by perlbug@perl.org)
cat >c1$$ <<EOF
@@ -345,6 +345,7 @@ d_cuserid=''
d_dbl_dig=''
d_dbminitproto=''
d_difftime=''
+d_dirfd=''
d_dlerror=''
d_dlopen=''
d_dlsymun=''
@@ -9517,6 +9518,63 @@ set d_dirnamlen
eval $setvar
$rm -f try.c
+: see if this is an sysdir system
+set sys/dir.h i_sysdir
+eval $inhdr
+
+: see if this is an sysndir system
+set sys/ndir.h i_sysndir
+eval $inhdr
+
+: Look for dirfd
+echo " "
+$cat >dirfd.c <<EOM
+#include <stdio.h>
+#$i_dirent I_DIRENT /**/
+#$i_sysdir I_SYS_DIR /**/
+#$i_sysndir I_SYS_NDIR /**/
+#$i_systypes I_SYS_TYPES /**/
+#if defined(I_SYS_TYPES)
+#include <sys/types.h>
+#endif
+#if defined(I_DIRENT)
+#include <dirent.h>
+#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
+#include <sys/dir.h>
+#endif
+#else
+#ifdef I_SYS_NDIR
+#include <sys/ndir.h>
+#else
+#ifdef I_SYS_DIR
+#ifdef hp9000s500
+#include <ndir.h> /* may be wrong in the future */
+#else
+#include <sys/dir.h>
+#endif
+#endif
+#endif
+#endif
+int main() {
+ DIR *dirp = opendir(".");
+ if (dirfd(dirp) >= 0)
+ exit(0);
+ else
+ exit(1);
+}
+EOM
+set dirfd
+if eval $compile; then
+ val="$define"
+fi
+case "$val" in
+$define) echo "dirfd() found." >&4 ;;
+*) echo "dirfd() NOT found." >&4 ;;
+esac
+set d_dirfd
+eval $setvar
+$rm -f dirfd*
+
: see if dlerror exists
xxx_runnm="$runnm"
runnm=false
@@ -13443,14 +13501,6 @@ $define) usevfork='true';;
*) usevfork='false';;
esac
-: see if this is an sysdir system
-set sys/dir.h i_sysdir
-eval $inhdr
-
-: see if this is an sysndir system
-set sys/ndir.h i_sysndir
-eval $inhdr
-
: see if closedir exists
set closedir d_closedir
eval $inlibc
@@ -16832,6 +16882,7 @@ d_cuserid='$d_cuserid'
d_dbl_dig='$d_dbl_dig'
d_dbminitproto='$d_dbminitproto'
d_difftime='$d_difftime'
+d_dirfd='$d_dirfd'
d_dirnamlen='$d_dirnamlen'
d_dlerror='$d_dlerror'
d_dlopen='$d_dlopen'
diff --git a/config_h.SH b/config_h.SH
index 9b20de6f38..381d2581d5 100644
--- a/config_h.SH
+++ b/config_h.SH
@@ -3484,6 +3484,12 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
*/
#$d_dbminitproto HAS_DBMINIT_PROTO /**/
+/* HAS_DIRFD:
+ * This manifest constant lets the C program know that dirfd
+ * is available.
+ */
+#$d_dirfd HAS_DIRFD /**/
+
/* HAS_FLOCK_PROTO:
* This symbol, if defined, indicates that the system provides
* a prototype for the flock() function. Otherwise, it is up
diff --git a/perl.h b/perl.h
index a1bb275862..762ffdaf82 100644
--- a/perl.h
+++ b/perl.h
@@ -4003,6 +4003,30 @@ extern void moncontrol(int);
#define PERL_GPROF_MONCONTROL(x)
#endif
+#ifdef UNDER_CE
+#include "wince.h"
+#endif
+
+/* ISO 6429 NEL - C1 control NExt Line */
+/* See http://www.unicode.org/unicode/reports/tr13/ */
+#ifdef EBCDIC /* In EBCDIC NEL is just an alias for LF */
+# if '^' == 95 /* CP 1047: MVS OpenEdition - OS/390 - z/OS */
+# define NEXT_LINE_CHAR 0x15
+# else /* CDRA */
+# define NEXT_LINE_CHAR 0x25
+# endif
+#else
+# define NEXT_LINE_CHAR 0x85
+#endif
+
+/* The UTF-8 bytes of the Unicode LS and PS, U+2028 and U+2029 */
+#define UNICODE_LINE_SEPA_0 0xE2
+#define UNICODE_LINE_SEPA_1 0x80
+#define UNICODE_LINE_SEPA_2 0xA8
+#define UNICODE_PARA_SEPA_0 0xE2
+#define UNICODE_PARA_SEPA_1 0x80
+#define UNICODE_PARA_SEPA_2 0xA9
+
/* and finally... */
#define PERL_PATCHLEVEL_H_IMPLICIT
#include "patchlevel.h"
@@ -4045,31 +4069,10 @@ extern void moncontrol(int);
HAS_STRUCT_CMSGHDR
HAS_NL_LANGINFO
+
+ HAS_DIRFD
so that Configure picks them up. */
-#ifdef UNDER_CE
-#include "wince.h"
-#endif
-
-/* ISO 6429 NEL - C1 control NExt Line */
-/* See http://www.unicode.org/unicode/reports/tr13/ */
-#ifdef EBCDIC /* In EBCDIC NEL is just an alias for LF */
-# if '^' == 95 /* CP 1047: MVS OpenEdition - OS/390 - z/OS */
-# define NEXT_LINE_CHAR 0x15
-# else /* CDRA */
-# define NEXT_LINE_CHAR 0x25
-# endif
-#else
-# define NEXT_LINE_CHAR 0x85
-#endif
-
-/* The UTF-8 bytes of the Unicode LS and PS, U+2028 and U+2029 */
-#define UNICODE_LINE_SEPA_0 0xE2
-#define UNICODE_LINE_SEPA_1 0x80
-#define UNICODE_LINE_SEPA_2 0xA8
-#define UNICODE_PARA_SEPA_0 0xE2
-#define UNICODE_PARA_SEPA_1 0x80
-#define UNICODE_PARA_SEPA_2 0xA9
-
#endif /* Include guard */
+