home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / bin / autoconf-1.11 < prev    next >
Text File  |  1995-01-17  |  4KB  |  121 lines

  1. #!/bin/sh
  2. # autoconf -- create `configure' using m4 macros
  3. # Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  4.  
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9.  
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14.  
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. # If given no args, create `configure' from template file `configure.in'.
  20. # With one arg, create a configure script on standard output from
  21. # the given template file.
  22.  
  23. usage="Usage: autoconf [-h] [--help] [-m dir] [--macrodir=dir] 
  24.                 [-v] [--version] [template-file]" 
  25.  
  26. # NLS nuisances.
  27. # These must not be set unconditionally because not all systems understand
  28. # e.g. LANG=C (notably SCO).
  29. if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi
  30. if test "${LANG+set}"   = 'set' ; then LANG=C;   export LANG;   fi
  31.  
  32. test -z "${AC_MACRODIR}" && AC_MACRODIR=/gnu/lib/autoconf-1.11
  33. test -z "${M4}" && M4=/bin/m4
  34. case "${M4}" in
  35. /*) # Handle the case that m4 has moved since we were configured.
  36.     # It may have been found originally in a build directory.
  37.     test -f "${M4}" || M4=m4 ;;
  38. esac
  39.  
  40. tmpout=/tmp/acout.$$
  41.  
  42. print_version=
  43. while test $# -gt 0 ; do
  44.    case "z${1}" in 
  45.       z-h | z--help | z--h* )
  46.          /bin/echo "${usage}" 1>&2; exit 0 ;;
  47.       z--macrodir=* | z--m*=* )
  48.          AC_MACRODIR="`/bin/echo \"${1}\" | sed -e 's/^[^=]*=//'`"
  49.          shift ;;
  50.       z-m | z--macrodir | z--m* ) 
  51.          shift
  52.          test $# -eq 0 && { /bin/echo "${usage}" 1>&2; exit 1; }
  53.          AC_MACRODIR="${1}"
  54.          shift ;;
  55.       z-v | z--version | z--v* )
  56.          print_version="-DAC_PRINT_VERSION"
  57.          infile=/dev/null tmpout=/dev/null
  58.          shift ;;
  59.       z-- )     # Stop option processing
  60.         shift; break ;;
  61.       z- )    # Use stdin as input.
  62.         break ;;
  63.       z-* )
  64.         /bin/echo "${usage}" 1>&2; exit 1 ;;
  65.       * )
  66.         break ;;
  67.    esac
  68. done
  69.  
  70. if test -z "$print_version"; then
  71.   case $# in
  72.     0) infile=configure.in ;;
  73.     1) infile="$1" ;;
  74.     *) /bin/echo "$usage" >&2; exit 1 ;;
  75.   esac
  76.  
  77.   trap 'rm -f $tmpin $tmpout; exit 1' 1 2 15
  78.  
  79.   if test z$infile = z-; then
  80.     tmpin=/tmp/acin.$$
  81.     infile=$tmpin
  82.     cat > $infile
  83.   elif test ! -s "${infile}"; then
  84.     /bin/echo "autoconf: ${infile}: No such file or directory" >&2
  85.     exit 1
  86.   fi
  87. fi
  88.  
  89. MACROFILES="${AC_MACRODIR}/acgeneral.m4 ${AC_MACRODIR}/acspecific.m4"
  90. test -r ${AC_MACRODIR}/aclocal.m4 \
  91.    && MACROFILES="${MACROFILES} ${AC_MACRODIR}/aclocal.m4"
  92. test -r aclocal.m4 && MACROFILES="${MACROFILES} aclocal.m4"
  93. MACROFILES="${print_version} ${MACROFILES}"
  94.  
  95. $M4 $MACROFILES $infile > $tmpout || { st=$?; rm -f $tmpin $tmpout; exit $st; }
  96.  
  97. test -n "$print_version" && exit 0
  98.  
  99. # You could add your own prefixes to pattern if you wanted to check for
  100. # them too, e.g. pattern="AC_\|ILT_", except that UNIX sed doesn't do
  101. # alternation.
  102. pattern="AC_"
  103.  
  104. status=0
  105. if grep "${pattern}" $tmpout > /dev/null 2>&1; then
  106.   /bin/echo "autoconf: Undefined macros:" >&2
  107.   grep "${pattern}" $tmpout | sed "s/.*\(${pattern}[_A-Z0-9]*\).*/\1/" |
  108.     while read name; do
  109.       grep -n $name $infile /dev/null
  110.     done | sort -u >&2
  111.   status=1
  112. fi
  113.  
  114. case $# in
  115.   0) cat $tmpout > configure; chmod +x configure ;;
  116.   1) cat $tmpout ;;
  117. esac
  118.  
  119. rm -f $tmpout
  120. exit $status
  121.