diff options
| author | Roland McGrath | 1994-01-09 00:36:27 +0000 |
|---|---|---|
| committer | Roland McGrath | 1994-01-09 00:36:27 +0000 |
| commit | 47241a651a751dc19453af79cf5ab5a35aa385f9 (patch) | |
| tree | 36e9183ad92119f2a6b20407bc1fba5ae151d32c | |
| parent | 33abe2d96d47196571b7c6e23e0bc3b08527bcbc (diff) | |
| download | emacs-47241a651a751dc19453af79cf5ab5a35aa385f9.tar.gz emacs-47241a651a751dc19453af79cf5ab5a35aa385f9.zip | |
(creating src/Makefile): Put code inside 2nd arg to AC_OUTPUT as it should
be; hopefully noone will again see fit to gratuitously break this and not
make a change log entry. Optimized sed processing of Makefile.in and cpp
output; now preserves comments previously removed from the cpp input.
Eliminated temp file for cpp output.
Generate -U switches to undefine all identifiers that appear in the
directory name ${srcdir}; pass these to cpp.
| -rwxr-xr-x | configure1.in | 74 |
1 files changed, 28 insertions, 46 deletions
diff --git a/configure1.in b/configure1.in index 86446302c67..5196854bb7c 100755 --- a/configure1.in +++ b/configure1.in | |||
| @@ -1431,50 +1431,32 @@ test -n "${prefix}" && | |||
| 1431 | test -n "${exec_prefix}" && | 1431 | test -n "${exec_prefix}" && |
| 1432 | exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'` | 1432 | exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'` |
| 1433 | ] | 1433 | ] |
| 1434 | AC_OUTPUT(Makefile lib-src/Makefile oldXMenu/Makefile src/Makefile.in) [ | 1434 | AC_OUTPUT(Makefile lib-src/Makefile oldXMenu/Makefile src/Makefile.in, [ |
| 1435 | # Build src/Makefile from ${srcdir}/src/Makefile.in. This must be done | 1435 | # Build src/Makefile from ${srcdir}/src/Makefile.in. This must be done |
| 1436 | # after src/config.h is built, since we rely on that file. Only do the | 1436 | # after src/config.h is built, since we rely on that file. |
| 1437 | # build if "config.status" is present, since it's non-presence indicates | 1437 | |
| 1438 | # an error occured. | 1438 | changequote(,)dnl The horror, the horror. |
| 1439 | status=$? | 1439 | # Now get this: Some word that is part of the ${srcdir} directory name |
| 1440 | if [ ! -f ./config.status ]; then | 1440 | # might, just might, happen to be an identifier like `i386' or something, |
| 1441 | exit $status | 1441 | # and be predefined by the C preprocessor to some helpful value like 1, or |
| 1442 | fi | 1442 | # maybe the empty string. Needless to say consequent macro substitutions |
| 1443 | topsrcdir=${srcdir} | 1443 | # are less than conducive to the makefile finding the correct directory. |
| 1444 | # We discard all lines in Makefile.in that start with `# Generated' or /**/# | 1444 | srcdir_undefs="`echo $top_srcdir | |
| 1445 | # because some cpps get confused by them. | 1445 | sed -e 's/[^a-zA-Z0-9_]/ /g' -e 's/ */ -U/g' \ |
| 1446 | # Really we should preserve them somehow into Makefile, | 1446 | -e 's/ -U$//' -e 's/^[^ ]/-U/' \ |
| 1447 | # but that is beyond my level of shell programming. | 1447 | -e 's/-U[0-9][^ ]*//' \ |
| 1448 | makefile_command='echo "creating src/Makefile"; | 1448 | `" |
| 1449 | topsrcdir='"${topsrcdir}"'; | 1449 | changequote([,])dnl |
| 1450 | ( cd ./src; | 1450 | |
| 1451 | rm -f junk.c; | 1451 | echo creating src/Makefile |
| 1452 | sed -e '\''s/^# Generated.*//'\'' -e '\''s%/\*\*/#.*%%'\'' < Makefile.in > junk.c; | 1452 | ( cd src |
| 1453 | eval `echo ${CPP} -I. -I${topsrcdir}/src ${CPPFLAGS} junk.c \>junk.cpp`; | 1453 | rm -f junk.c |
| 1454 | < junk.cpp '\ | 1454 | sed -e 's@^# \(Generated.*\)$@/* \1 */@' \ |
| 1455 | ' sed -e '\''s/^#.*//'\'' '\ | 1455 | -e 's@/\*\*/#\(.*\)$@/* \1 */@' \ |
| 1456 | ' -e '\''s/^[ \f\t][ \f\t]*$//'\'' '\ | 1456 | < Makefile.in > junk.c |
| 1457 | ' -e '\''s/^ / /'\'' '\ | 1457 | $CPP $srcdir_undefs -I. -I$top_srcdir/src $CPPFLAGS junk.c | |
| 1458 | ' | sed -n -e '\''/^..*$/p'\'' '\ | 1458 | sed -e 's/^ / /' -e '/^#/d' -e '/^[ ][ ]*$/d' > Makefile.new |
| 1459 | ' > Makefile.new; | 1459 | rm -f junk.c |
| 1460 | chmod 444 Makefile.new; | 1460 | chmod 444 Makefile.new; |
| 1461 | mv -f Makefile.new Makefile; | 1461 | mv -f Makefile.new Makefile; |
| 1462 | rm -f junk.c junk.cpp; | 1462 | )]) |
| 1463 | )' | ||
| 1464 | eval `echo $makefile_command` | ||
| 1465 | # AC-OUTPUT has created `config.status' already. We need to add the above | ||
| 1466 | # commands to re-create `src/Makefile', and we need to insert them before | ||
| 1467 | # the final "exit 0" which appears at the end of `config.status'. | ||
| 1468 | <config.status sed -e 's/^exit 0$//' >config.new | ||
| 1469 | echo $makefile_command >>config.new | ||
| 1470 | echo exit 0 >>config.new | ||
| 1471 | mv -f config.new config.status | ||
| 1472 | chmod +x config.status | ||
| 1473 | # Don't let the fact that we just rewrote config.status make Makefile think | ||
| 1474 | # that it is now newer. We have just rewritten all of the Makefiles as well. | ||
| 1475 | MFS="Makefile src/Makefile src/Makefile.in lib-src/Makefile oldXMenu/Makefile" | ||
| 1476 | for file in $MFS; do | ||
| 1477 | chmod a+w $file; touch $file; chmod 444 $file | ||
| 1478 | done | ||
| 1479 | exit 0 | ||
| 1480 | ] | ||