.
authorJim Meyering <jim@meyering.net>
Mon, 2 Jul 2001 07:40:36 +0000 (07:40 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 2 Jul 2001 07:40:36 +0000 (07:40 +0000)
m4/.cvsignore
m4/Makefile.am
m4/Makefile.in

index f3c7a7c..66dba33 100644 (file)
@@ -1 +1,2 @@
 Makefile
+jm-glibc-io.m4
index d5a1248..7b6e0d5 100644 (file)
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in -*-Makefile-*-
 
 ##m4-files-begin
-EXTRA_DIST = README Makefile.am.in \
+EXTRA_DIST = README jm-glibc-io.m4n Makefile.am.in \
 afs.m4 \
 assert.m4 \
 bison.m4 \
@@ -75,10 +75,47 @@ xstrtoumax.m4
 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 $@
+
+all-local: jm-glibc-io.m4
index 79543c0..0b367ca 100644 (file)
@@ -237,7 +237,7 @@ distdir: $(DISTFILES)
        done
 check-am: all-am
 check: check-am
-all-am: Makefile
+all-am: Makefile all-local
 
 installdirs:
 
@@ -302,9 +302,9 @@ uninstall-am: uninstall-info-am
 
 uninstall-info: uninstall-info-am
 
-.PHONY: all all-am check check-am clean clean-generic distclean \
-       distclean-generic distdir dvi dvi-am info info-am install \
-       install-am install-data install-data-am install-exec \
+.PHONY: all all-am all-local check check-am clean clean-generic \
+       distclean distclean-generic distdir dvi dvi-am info info-am \
+       install install-am install-data install-data-am install-exec \
        install-exec-am install-info install-info-am install-man \
        install-strip installcheck installcheck-am installdirs \
        maintainer-clean maintainer-clean-generic mostlyclean \
@@ -319,16 +319,18 @@ Makefile.am: Makefile.am.in
          |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 $@
-jm-glibc-io.m4: jm-glibc-io.m4n Makefile.am.in
+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
-       mv $@t $@
+       move-if-change $@t $@
 
 unlocked-io.h: unlocked-io.hin Makefile.am.in
        tmp=t$$$$;                                                      \
@@ -345,6 +347,8 @@ unlocked-io.h: unlocked-io.hin Makefile.am.in
          $< > $@t;                                                     \
        rm -f $$tmp;                                                    \
        mv $@t $@
+
+all-local: jm-glibc-io.m4
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT: