home *** CD-ROM | disk | FTP | other *** search
/ ftp.ncftp.com / ftp.ncftp.com.zip / ftp.ncftp.com / ncftp / older_versions / ncftp-3.2.2-src.tar.bz2 / ncftp-3.2.2-src.tar / ncftp-3.2.2 / sh / autoconfall.sh next >
Linux/UNIX/POSIX Shell Script  |  2006-08-27  |  2KB  |  87 lines

  1. #!/bin/sh
  2.  
  3. PROJECT_HOME="$HOME/src/ncftp/current"
  4. if [ ! -d "$PROJECT_HOME" ] ; then
  5.     /bin/ls -ld "$PROJECT_HOME"
  6.     exit 1
  7. fi
  8. cd "$PROJECT_HOME"
  9.  
  10. a=`pwd`
  11. first=yes
  12. didone=no
  13. for f in \
  14.     ./configure.in \
  15.     sio/configure.in \
  16.     Strn/configure.in \
  17.     libncftp/configure.in \
  18.     /home/gleason/src/libncftp/current/libncftp/configure.in \
  19. ; do
  20.     abs=no
  21.     case "$f" in
  22.         /*) if [ -f "$f" ] ; then abs=yes ; fi ;;
  23.     esac
  24.     cd "$a"
  25.     if [ -f "$a/$f" ] || [ "$abs" = yes ] ; then
  26.         dir=`dirname "$f"`
  27.         first=no
  28.         cd "$dir" || exit 1
  29.         dir=`pwd`
  30.         echo "$dir" | awk -v c="*" -v cols="${COLUMNS-80}" '{if (cols < 20) {cols=80;} line = " " $0 " "; len = length(line); if (len/2 < cols/2) {k=cols/2 - len/2; i=k; while (--i >= 0) {printf("%s", c);} printf("%s", line); for (i=k+length(line); i<cols; i++) {printf("%s", c);}printf("\n");} else {printf("%s\n", $0);}}'
  31.         is_diff=no
  32.  
  33.         /bin/mv config.h.in config.h.in.orig 2>/dev/null
  34.         autoheader 2>&1 | fgrep -v AC_TRY_RUN
  35.         if [ ! -f config.h.in ] ; then
  36.             echo "* Warning: config.h.in not generated"
  37.             if [ -f config.h.in.orig ] ; then
  38.                 echo "* Restoring previous config.h.in"
  39.                 /bin/mv config.h.in.orig config.h.in
  40.             fi
  41.         elif [ -f config.h.in.orig ] && ! cmp config.h.in.orig config.h.in >/dev/null ; then
  42.             # echo "Running" diff -u config.h.in.orig config.h.in
  43.             # diff -u config.h.in.orig config.h.in
  44.             /bin/rm config.h.in.orig
  45.             /bin/ls -l config.h.in
  46.             is_diff=yes
  47.         else
  48.             # echo "(config.h.in is unchanged)"
  49.             /bin/mv config.h.in.orig config.h.in
  50.         fi
  51.  
  52.         /bin/mv configure configure.orig 2>/dev/null
  53.         autoconf 2>&1 | fgrep -v AC_TRY_RUN
  54.         if [ ! -f configure ] ; then
  55.             echo "* Warning: configure not generated"
  56.             if [ -f configure.orig ] ; then
  57.                 echo "* Restoring previous configure"
  58.                 /bin/mv configure.orig configure
  59.             fi
  60.         elif [ -f configure.orig ] && ! cmp configure.orig configure >/dev/null ; then
  61.             # echo "Running" diff -u configure.orig configure
  62.             # diff -u configure.orig configure
  63.             /bin/rm configure.orig
  64.             /bin/ls -l configure
  65.             is_diff=yes
  66.         else
  67.             # echo "(configure is unchanged)"
  68.             /bin/mv configure.orig configure
  69.         fi
  70.  
  71.         if [ "$is_diff" = yes ] && [ -f config.cache ] ; then
  72.             echo "Removing `pwd`/config.cache."
  73.             /bin/rm config.cache
  74.         fi
  75.         if [ "$first" = no ] && [ "$is_diff" = yes ] ; then
  76.             echo; echo; echo
  77.         fi
  78.         didone=yes
  79.     fi
  80. done
  81.  
  82. if [ "$didone" = no ] ; then
  83.     echo "* No autoconf files found -- edit this script and change the PROJECT_HOME." 1>&2
  84.     exit 1
  85. fi
  86. exit 0
  87.