comparison configure1.in @ 5531:c4f36c5ece61

(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.
author Roland McGrath <roland@gnu.org>
date Sun, 09 Jan 1994 00:36:27 +0000
parents 5131e7d642b9
children a5bb8db5c4e7
comparison
equal deleted inserted replaced
5530:7ff479a8e8bf 5531:c4f36c5ece61
1429 test -n "${prefix}" && 1429 test -n "${prefix}" &&
1430 prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'` 1430 prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'`
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 ]