summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-07-02 07:39:33 +0000
committerJim Meyering <jim@meyering.net>2001-07-02 07:39:33 +0000
commit5a3ec90c8165b94111cbdac75032f208e7b20cf6 (patch)
tree97c3451ddd295bd2dd3afb398179a63a40a2450f /m4
parent3e55e5756f472bc7ddbdf0d4bee3277a1daa4e36 (diff)
downloadcoreutils-5a3ec90c8165b94111cbdac75032f208e7b20cf6.tar.xz
(Makefile.am): Include jm-glibc-io.m4n in emitted
definition of EXTRA_DIST. (Makefile.am): Emit the dependency, `all-local: jm-glibc-io.m4' to ensure that the generated file is created/updated whenever the list of $(unlocked_functions) is changed. (jm-glibc-io.m4): New rule. (unlocked-io.h): New rule -- currently unused.
Diffstat (limited to 'm4')
-rw-r--r--m4/Makefile.am.in37
1 files changed, 36 insertions, 1 deletions
diff --git a/m4/Makefile.am.in b/m4/Makefile.am.in
index 1e3495fec..36a4da4e6 100644
--- a/m4/Makefile.am.in
+++ b/m4/Makefile.am.in
@@ -6,10 +6,45 @@
Makefile.am: Makefile.am.in
rm -f $@ $@t
sed -n '1,/^##m4-files-begin/p' $< > $@t
- ( (echo EXTRA_DIST = README Makefile.am.in | tr '\012' @); \
+ ((echo EXTRA_DIST = README jm-glibc-io.m4n Makefile.am.in|tr '\012' @);\
(echo *.m4|tr ' ' @) ) \
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
>> $@t
sed -n '/^##m4-files-end/,$$p' $< >> $@t
+ echo >> $@t
+ echo all-local: jm-glibc-io.m4 >> $@t
chmod a-w $@t
mv $@t $@
+
+unlocked_functions = \
+ clearerr_unlocked feof_unlocked ferror_unlocked \
+ fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked \
+ fread_unlocked fwrite_unlocked getc_unlocked getchar_unlocked \
+ putc_unlocked putchar_unlocked
+
+comma_separated = $(shell echo $(unlocked_functions)|tr -s ' ' ,)
+base_functions = $(patsubst %_unlocked,%,$(unlocked_functions))
+jm-glibc-io.m4: jm-glibc-io.m4n Makefile
+ echo 'dnl This file is automatically generated from $<' > $@t
+ echo '' >> $@t
+ sed \
+ -e 's/@space_separated@/$(unlocked_functions)/g' \
+ -e 's/@comma_separated@/$(comma_separated)/g' \
+ $< >> $@t
+ move-if-change $@t $@
+
+unlocked-io.h: unlocked-io.hin Makefile.am.in
+ tmp=t$$$$; \
+ echo '' > $$tmp; \
+ for f in $(base_functions); do \
+ u=`echo $$f|tr '[:lower:]' '[:upper:]'`; \
+ echo "# if HAVE_$${u}_UNLOCKED" >> $$tmp; \
+ echo "# undef $$f" >> $$tmp; \
+ echo "# define $$f(S) $${f}_unlocked (S)" >> $$tmp; \
+ echo '#endif' >> $$tmp; \
+ done; \
+ sed "/^@replace_this@$$/r$$tmp" $< \
+ | sed "/^@replace_this@$$/d" \
+ $< > $@t; \
+ rm -f $$tmp; \
+ mv $@t $@