about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-02-14 13:56:12 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-02-14 13:56:12 +0000
commit3a5c9827a10cf00f8a143829dc1785365a30bc93 (patch)
tree48997c350ad98d7b0ca07ae9c541aaa7816678bb
parent5dc7bc1ea17977aae74b41fb3d8b776da9dc0092 (diff)
downloadzsh-3a5c9827a10cf00f8a143829dc1785365a30bc93.tar.gz
zsh-3a5c9827a10cf00f8a143829dc1785365a30bc93.tar.xz
zsh-3a5c9827a10cf00f8a143829dc1785365a30bc93.zip
20811: Use the cpp trick to find the file with resource names
-rw-r--r--ChangeLog6
-rw-r--r--configure.ac27
2 files changed, 26 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 4e97882f5..d5ba2ac62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-02-14  Peter Stephenson  <pws@csr.com>
+
+	* 20811: configure.ac: Copy the trick for finding the
+	file with signal names to make finding the file with resource
+	names more reliable.
+
 2005-02-10  Wayne Davison  <wayned@users.sourceforge.net>
 
 	* unposted: Completion/Unix/Command/_yodl:  Added missing
diff --git a/configure.ac b/configure.ac
index 35d846c01..f7a731b08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1275,13 +1275,26 @@ dnl Look for the file containing the RLIMIT_* definitions
 dnl -----------------------------------------------------
 dnl CALL FOR MORE (FEWER?) LOCATIONS:  I've just copied the signal checking.
 AC_CACHE_CHECK(where the RLIMIT macros are located,zsh_cv_path_rlimit_h,
-[for RESOURCE_H in /usr/include/bsd/sys/resource.h   dnl
-                   /usr/include/asm/resource.h	     dnl
-                   /usr/include/linux/resource.h     dnl
-                   /usr/include/sys/resource.h       dnl
-                   /usr/include/bits/resource.h      dnl
-                   /usr/include/resourcebits.h       dnl
-                   /dev/null;
+[dnl Look at the output from the preprocessor.
+dnl Copied from the search for the signal names above.
+echo "#include <sys/resource.h>" >restmp.c
+resourcefile_list="`$CPP restmp.c |
+sed -n -e 's/^#line[ 	].*\"\(.*\)\"/\1/p' \
+       -e 's/^#[ 	].*\"\(.*\)\"/\1/p' |
+sed 's/\\\\\\\\/\//g' |
+$AWK '{ if (\$1 ~ \"resource\") files[[\$1]] = \$1 }
+  END { for (var in files) print var }'`"
+rm -f restmp.c
+if test -z "$resourcefile_list"; then
+  dnl No list: look at standard places.
+  resourcefile_list="/usr/include/bsd/sys/resource.h
+/usr/include/asm/resource.h
+/usr/include/linux/resource.h
+/usr/include/sys/resource.h
+/usr/include/bits/resource.h
+/usr/include/resourcebits.h"
+fi
+for RESOURCE_H in $resourcefile_list /dev/null;
 do
   test -f $RESOURCE_H && \
   grep '#[ 	]*define[ 	][ 	]*RLIMIT_[A-Z]*[ 	]*[0-9A-Z][0-9]*' $RESOURCE_H > /dev/null && \