summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d>2015-04-18 09:10:52 +0000
committerrmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d>2015-04-18 09:10:52 +0000
commit7b26fa2343e40b86497ba09bf6369b5ab7ed3703 (patch)
tree395708020004c397feb73a703322f5c071b40986
parentefd117dccf64f6a9b39fe014d7a67357f402fe26 (diff)
Added HAS_DIRENT_D_NAMELEN for a compile check of d_namelen.
The legacy symbol DIRNAMELEN uses a weaker grep-based test, hence it should no longer be used. git-svn-id: svn://svn.code.sf.net/p/dist/code/trunk/dist@187 2592e710-e01b-42a5-8df0-11608a6cc53d
-rw-r--r--MANIFEST1
-rw-r--r--mcon/U/d_dirent_d_namelen.U42
2 files changed, 43 insertions, 0 deletions
diff --git a/MANIFEST b/MANIFEST
index 76f4e50..557ee76 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -204,6 +204,7 @@ mcon/U/d_debugging.U Conditionally defines -DDEBUGGING
mcon/U/d_deflate.U Do we have zlib's deflate()?
mcon/U/d_devpoll.U Can we use /dev/poll?
mcon/U/d_difftime.U Do we have difftime()?
+mcon/U/d_dirent_d_namelen.U Does struct dirent has a member d_namelen?
mcon/U/d_dirent_d_type.U Does struct dirent has a member d_type?
mcon/U/d_dirfd.U Do we have dirfd()?
mcon/U/d_dladdr.U Do we have dladdr()?
diff --git a/mcon/U/d_dirent_d_namelen.U b/mcon/U/d_dirent_d_namelen.U
new file mode 100644
index 0000000..48361a6
--- /dev/null
+++ b/mcon/U/d_dirent_d_namelen.U
@@ -0,0 +1,42 @@
+?RCS:
+?RCS: Copyright (c) 2015 Raphael Manfredi
+?RCS:
+?RCS: You may redistribute only under the terms of the Artistic License,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic License; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS:
+?MAKE:d_dirent_d_namelen: Trylink cat i_dirent
+?MAKE: -pick add $@ %<
+?S:d_dirent_d_namelen:
+?S: This variable conditionally defines the HAS_DIRENT_D_NAMELEN symbol,
+?S: which indicates to the C program that struct dirent has an
+?S: integer member d_namelen. Better check for HAS_DIRENT_D_NAMELEN than
+?S: DIRNAMLEN since the latter has a weaker test not involving compilation.
+?S:.
+?C:HAS_DIRENT_D_NAMELEN:
+?C: This symbol, if defined, indicates that struct dirent has an
+?C: integer member d_namelen to hold the actual string length of d_name.
+?C:.
+?H:#$d_dirent_d_namelen HAS_DIRENT_D_NAMELEN /**/
+?H:.
+?LINT:set d_dirent_d_namelen
+: check whether struct dirent has a member d_namelen.
+$cat >try.c <<EOC
+#include <sys/types.h>
+#$i_dirent I_DIRENT
+#ifdef I_DIRENT
+#include <dirent.h>
+#endif
+int main(void)
+{
+ static struct dirent dir_entry;
+ dir_entry.d_namelen |= 1;
+ return 0;
+}
+EOC
+cyn="whether struct dirent has a d_namelen member"
+set d_dirent_d_namelen
+eval $trylink
+