#! /bin/sh # dryrun.test - check whether the --dry-run mode works properly # Test script header. need_prefix=yes if test -z "$srcdir"; then srcdir=`echo "$0" | sed 's%/[^/]*$%%'` test "$srcdir" = "$0" && srcdir=. test "${VERBOSE+set}" != "set" && VERBOSE=yes fi . $srcdir/defs || exit 1 if test -f ../mdemo/Makefile; then : else echo "You must run mdemo-conf.test before running $0" 1>&2 exit 77 fi # Change to our build directory. cd ../mdemo || exit 1 echo "= Running $make clean in ../mdemo" $make clean || exit 1 eval `$libtool --config | grep "^objdir="` # create `before' and `after' in a directory deep within objdir, # so that their creation and removal does not modify even a timestamp # in the output of `ls -l . $objdir' for d in $objdir $objdir/temp $objdir/temp/temp; do test -d $d || mkdir $d done before=$d/before after=$d/after # Create a new libtool script that will enter dry run if the environment # variable force_dry_run is set rm -f $objdir/libtool.new sed 's/^run=$/run=${force_dry_run+:}/' < libtool > $objdir/libtool.new chmod +x $objdir/libtool.new mv libtool $objdir/libtool mv $objdir/libtool.new libtool # main.o is not compiled with libtool, but it depends on it, so make # sure it is up-to-date. libfoo2.la is linked with libsub.la, so make # sure it exists, otherwise libtool will complain. $make main.$OBJEXT || exit 1 echo "= Making object files in ../mdemo (dry run)" # ls -l in MSYS sometimes shows year, not time, for really fresh files. sleep 1 ls -l . $objdir | grep -v total > $before force_dry_run=yes $make foo1.lo foo2.lo sub.lo || exit $? ls -l . $objdir | grep -v total > $after cmp $before $after > /dev/null || exit 1 # Now really make them echo "= Making object files in ../mdemo" $make foo1.lo foo2.lo libsub.la || exit 1 echo "= Making libraries in ../mdemo (dry run)" # ls -l in MSYS sometimes shows year, not time, for really fresh files. sleep 1 ls -l . $objdir | grep -v total > $before force_dry_run=yes $make foo1.la libfoo2.la || exit $? ls -l . $objdir | grep -v total > $after cmp $before $after > /dev/null || exit 1 # Now really make them echo "= Making libraries in ../mdemo" $make foo1.la libfoo2.la || exit 1 echo "= Making programs in ../mdemo (dry run)" # ls -l in MSYS sometimes shows year, not time, for really fresh files. sleep 1 ls -l . $objdir | grep -v total > $before force_dry_run=yes $make mdemo$EXEEXT mdemo_static$EXEEXT 1>&2 || exit $? ls -l . $objdir | grep -v total > $after cmp $before $after > /dev/null || exit 1 # Now really make them echo "= Making programs in ../mdemo" $make mdemo$EXEEXT mdemo_static$EXEEXT || exit 1 echo "= Running $make install in ../mdemo (dry run)" # Libtool does not create these directories test -d $prefix/bin || mkdir $prefix/bin test -d $prefix/lib || mkdir $prefix/lib # ls -l in MSYS sometimes shows year, not time, for really fresh files. sleep 1 ls -l . $objdir | grep -v total > $before ls -lR $prefix | grep -v total >> $before force_dry_run=yes $make install 1>&2 || exit 1 ls -l . $objdir | grep -v total > $after ls -lR $prefix | grep -v total >> $after cmp $before $after > /dev/null || exit 1 # Now really run it echo "= Running $make install in ../mdemo" $make install || exit 1 echo "= Running $make uninstall in ../mdemo (dry run)" # Libtool does not uninstall the programs, remove them first rm -f $prefix/bin/mdemo$EXEEXT $prefix/bin/mdemo_static$EXEEXT ls -l . $objdir | grep -v total > $before ls -lR $prefix | grep -v total >> $before force_dry_run=yes $make uninstall 1>&2 || exit $? ls -l . $objdir | grep -v total > $after ls -lR $prefix | grep -v total >> $after cmp $before $after > /dev/null || exit 1 # Now really run it echo "= Running $make uninstall in ../mdemo" $make uninstall || exit 1 rm -f $before $after libtool mv $objdir/libtool libtool exit 0