1#!/bin/sh 2# Run this to generate all the initial makefiles, etc. 3# Tweaked by David Necas (Yeti) <yeti@physics.muni.cz> from various other 4# autogen.sh's. This file is in public domain. 5 6DIE=0 7 8PROJECT=Enca 9ACLOCAL_FLAGS="-I m4" 10 11(autoconf --version) < /dev/null > /dev/null 2>&1 || { 12 echo 13 echo "**ERROR**: You must have \`autoconf' installed to re-generate" 14 echo "all the $PROJECT Makefiles." 15 echo "Download the appropriate package for your distribution," 16 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/." 17 DIE=1 18 NO_AUTOCONF=yes 19} 20 21(grep "^AM_PROG_LIBTOOL" ./configure.ac >/dev/null) && { 22 (libtoolize --version) < /dev/null > /dev/null 2>&1 || { 23 echo 24 echo "**Error**: You must have \`libtoolize' installed." 25 echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz" 26 echo "(or a newer version if it is available)" 27 DIE=1 28 NO_LIBTOOL=yes 29 } 30} 31 32(automake --version) < /dev/null > /dev/null 2>&1 || { 33 echo 34 echo "**ERROR**: You must have \`automake' installed to re-generate" 35 echo "all the $PROJECT Makefiles." 36 echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.8.3.tar.gz" 37 echo "(or a newer version if it is available) and read DEVELOP.md." 38 DIE=1 39 NO_AUTOMAKE=yes 40} 41 42version_check ( ) { 43 if [ "x$1" = "x" ] ; then 44 echo "INTERNAL ERROR: version_check was not provided a minimum version" 45 exit 1 46 fi 47 _min="$1" 48 if [ "x$2" = "x" ] ; then 49 echo "INTERNAL ERROR: version check was not provided a comparison version" 50 exit 1 51 fi 52 _cur="$2" 53 54 # needed to handle versions like 1.10 and 1.4-p6 55 _min="`echo ${_min}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`" 56 _cur="`echo ${_cur}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`" 57 58 _min_major="`echo $_min | cut -d. -f1`" 59 _min_minor="`echo $_min | cut -d. -f2`" 60 _min_patch="`echo $_min | cut -d. -f3`" 61 62 _cur_major="`echo $_cur | cut -d. -f1`" 63 _cur_minor="`echo $_cur | cut -d. -f2`" 64 _cur_patch="`echo $_cur | cut -d. -f3`" 65 66 if [ "x$_min_major" = "x" ] ; then 67 _min_major=0 68 fi 69 if [ "x$_min_minor" = "x" ] ; then 70 _min_minor=0 71 fi 72 if [ "x$_min_patch" = "x" ] ; then 73 _min_patch=0 74 fi 75 if [ "x$_cur_minor" = "x" ] ; then 76 _cur_major=0 77 fi 78 if [ "x$_cur_minor" = "x" ] ; then 79 _cur_minor=0 80 fi 81 if [ "x$_cur_patch" = "x" ] ; then 82 _cur_patch=0 83 fi 84 85 if [ $_min_major -lt $_cur_major ] ; then 86 return 0 87 elif [ $_min_major -eq $_cur_major ] ; then 88 if [ $_min_minor -lt $_cur_minor ] ; then 89 return 0 90 elif [ $_min_minor -eq $_cur_minor ] ; then 91 if [ $_min_patch -lt $_cur_patch ] ; then 92 return 0 93 elif [ $_min_patch -eq $_cur_patch ] ; then 94 return 0 95 fi 96 fi 97 fi 98 return 1 99} 100 101 102# The world is cruel. 103if test -z "$NO_AUTOCONF"; then 104 AC_VERSION=`autoconf --version | sed -e '2,$ d' -e 's/ *([^()]*)$//' -e 's/.* \(.*\)/\1/' -e 's/-p[0-9]\+//'` 105 if ! version_check "2.52" "$AC_VERSION" ; then 106 echo 107 echo "**ERROR**: You need at least autoconf-2.52 installed to re-generate" 108 echo "all the $PROJECT Makefiles." 109 echo "Download the appropriate package for your distribution," 110 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/." 111 DIE=1 112 else 113 echo "Autoconf $AC_VERSION: OK" 114 fi 115fi 116 117if test -z "$NO_AUTOMAKE"; then 118 AM_VERSION=`automake --version | sed -e '2,$ d' -e 's/ *([^()]*)$//' -e 's/.* \(.*\)/\1/' -e 's/-p[0-9]\+//'` 119 if ! version_check "1.8" "$AM_VERSION" ; then 120 echo 121 echo "**ERROR**: You need at least automake-1.8 installed to re-generate" 122 echo "all the $PROJECT Makefiles." 123 echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.8.3.tar.gz" 124 echo "(or a newer version if it is available) and read DEVELOP.md." 125 DIE=1 126 else 127 echo "Automake $AM_VERSION: OK" 128 fi 129fi 130 131# if no automake, don't bother testing for aclocal 132test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { 133 echo 134 echo "**ERROR**: Missing \`aclocal'. The version of \`automake'" 135 echo "installed doesn't appear recent enough." 136 echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.8.3.tar.gz" 137 echo "(or a newer version if it is available) and read DEVELOP.md." 138 DIE=1 139} 140 141if test -z "$NO_LIBTOOL"; then 142 LT_VERSION=`libtoolize --version | sed -e '2,$ d' -e 's/ *([^()]*)$//' -e 's/.* \(.*\)/\1/' -e 's/-p[0-9]\+//' -e 's/^[a-zA-z]*-//'` 143 if ! version_check "1.4" "$LT_VERSION" ; then 144 echo 145 echo "**ERROR**: You need at least libtool-1.4 installed to re-generate" 146 echo "all the $PROJECT Makefiles." 147 echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz" 148 echo "(or a newer version if it is available) and read DEVELOP.md." 149 DIE=1 150 else 151 echo "Libtool $LT_VERSION: OK" 152 fi 153fi 154 155if test "$DIE" -eq 1; then 156 exit 1 157fi 158 159case $CC in 160*xlc | *xlc\ * | *lcc | *lcc\ * ) 161 am_opt=--include-deps;; 162esac 163 164dir=. 165echo processing $dir 166(cd $dir && \ 167 libtoolize --force --copy && \ 168 aclocal $ACLOCAL_FLAGS && \ 169 autoheader && \ 170 automake --add-missing $am_opt && \ 171 autoconf) || { 172 echo "**ERROR**: Re-generating failed. You are allowed to shoot $PROJECT maintainer." 173 echo "(BTW, why are you re-generating everything? Have you read DEVELOP.md?)" 174 exit 1 175 } 176 177if test -z "$*"; then 178 echo "**Warning**: I am going to run \`configure' with no arguments." 179 echo "If you wish to pass any to it, please specify them on the" 180 echo "\`$0' command line." 181 echo 182fi 183 184./configure "$@" 185