0e13921996-02-10Fredrik Hübinette (Hubbe) #!/bin/sh
24ddc71998-03-28Henrik Grubbström (Grubba) #
a64add1996-04-29Fredrik Hübinette (Hubbe) # Bootstrap script
d677e11997-01-21Henrik Grubbström (Grubba) need_to_make_depend=no
0dcc582003-01-09Marcus Comstedt prune_flag=""
d677e11997-01-21Henrik Grubbström (Grubba) 
5f4e221998-10-21Fredrik Hübinette (Hubbe) case :$PATH: in */NT/tools:*) echo Stripping NT/tools from path temporarily... PATH=`echo :$PATH | sed 's@:[^:]*/NT/tools:@@g' | sed 's@^:@@'` ;; esac
0dcc582003-01-09Marcus Comstedt if test "x$1" = "x--no-recursion"; then prune_flag="-prune" shift fi
c45fc01998-04-03Henrik Grubbström (Grubba) if test "x$1" = "x" ; then base=`echo $0 | sed 's@[^/]*$@@g'` if test "x$base" != "x" ; then cd "$base" fi
1b10561998-09-24Henrik Grubbström (Grubba)  localdir=`pwd`
c45fc01998-04-03Henrik Grubbström (Grubba) else
1b10561998-09-24Henrik Grubbström (Grubba)  localdir=`echo $0 | sed 's@[^/]*$@@g'` if test "x$localdir" = "x"; then localdir=`pwd`
cf499f1998-09-24Henrik Grubbström (Grubba)  else localdir=`cd $localdir;pwd`
1b10561998-09-24Henrik Grubbström (Grubba)  fi
3ef9672018-04-28Marcus Comstedt  cd "$1"
1b10561998-09-24Henrik Grubbström (Grubba) fi
e269811998-09-20Fredrik Hübinette (Hubbe) 
2e05832004-05-01Martin Stjernholm findprog() { ( IFS=: for path in $PATH; do if [ -x "$path/$1" ]; then return 0 fi done return 1 ) } # There are script wrappers for autoconf (e.g. in Debian) that tries # to autodetect which autoconf version configure.in etc is written # for. There are also configure.in scripts (e.g. in Pike) that tries # to detect which autoconf they're running in. These tend to fool each # other, so try to avoid the script wrappers.
38d68a2021-03-16Henrik Grubbström (Grubba) if findprog autoconf-2.69 && findprog autoheader-2.69; then autoconf=autoconf-2.69 autoheader=autoheader-2.69 elif findprog autoconf2.50 && findprog autoheader2.50; then
2e05832004-05-01Martin Stjernholm  autoconf=autoconf2.50 autoheader=autoheader2.50 else autoconf=autoconf autoheader=autoheader fi
0dcc582003-01-09Marcus Comstedt 
1c2cd02003-02-20Henrik Grubbström (Grubba) ac_args="--localdir=$localdir" ah_args="" autom4te_polluted="no"
7d7a892003-02-06Henrik Grubbström (Grubba) 
5b7f1b2003-12-07Marcus Comstedt autoconf_version="`\"$autoconf\" --version $ac_args|head -n 1|awk '{ print $NF }'`"
7f5f3b2006-05-20Marcus Comstedt if [ "`echo \"$autoconf_version\"|awk -F. '{ print $1 }'|sed -e 's/[A-Za-z]//g'`" -ne "2" -o \ "`echo \"$autoconf_version\"|awk -F. '{ print $2 }'|sed -e 's/[A-Za-z]//g'`" -le "10" -o \ "`echo \"$autoconf_version\"|awk -F. '{ print $2 }'|sed -e 's/[A-Za-z]//g'`" -ge "50" ]; then if [ "`echo \"$autoconf_version\"|awk -F. '{ print $2 }'|sed -e 's/[A-Za-z]//g'`" -le "51" ]; then
0dcc582003-01-09Marcus Comstedt  # Autoconf 2.50 and 2.51 are seriously broken.
22cf0a2002-02-13Martin Nilsson  echo "Autoconf version $autoconf_version is not supported." >&2 echo >&2
0dcc582003-01-09Marcus Comstedt  echo "Get and install autoconf 2.52 or later." >&2
22cf0a2002-02-13Martin Nilsson  # Abort exit 1
7f5f3b2006-05-20Marcus Comstedt  elif [ "`echo \"$autoconf_version\"|awk -F. '{ print $1 }'|sed -e 's/[A-Za-z]//g'`" = "2" -a \ "`echo \"$autoconf_version\"|awk -F. '{ print $2 }'|sed -e 's/[A-Za-z]//g'`" -ge "53" ]; then
7d7a892003-02-06Henrik Grubbström (Grubba)  # NB: autoheader 2.53 is stupid, and has broken handling of warnings. # 1) The warning flags are not passed along to autoconf. # 2) The option --warnings is misspelled by missing the last 's'.
7f5f3b2006-05-20Marcus Comstedt  if [ "`echo \"$autoconf_version\"|awk -F. '{ print $2 }'|sed -e 's/[A-Za-z]//g'`" -le "53" ]; then
c1caf02003-12-18Henrik Grubbström (Grubba)  # autoconf 2.53 doesn't have --prepend-include. ac_args="-Wno-obsolete --include=$localdir"
32ecec2004-05-05David Gourdelier  ah_args="--include=$localdir"
c1caf02003-12-18Henrik Grubbström (Grubba)  else ac_args="-Wno-obsolete --prepend-include=$localdir" ah_args="-Wno-obsolete --prepend-include=$localdir" fi
7d7a892003-02-06Henrik Grubbström (Grubba)  # Attempt to kludge around Perl's stupid warnings about locale settings. LANGUAGE=C LC_CTYPE=C LANG=C export LANGUAGE LC_CTYPE LANG LC_MONETARY=C LC_NUMERIC=C export LC_MONETARY LC_NUMERIC LC_MESSAGES=C LC_COLLATE=C export LC_MESSAGES LC_COLLATE LC_TIME=C LC_ALL=C export LC_TIME LC_ALL
1c2cd02003-02-20Henrik Grubbström (Grubba)  autom4te_polluted=yes
7d7a892003-02-06Henrik Grubbström (Grubba)  fi;
5b7f1b2003-12-07Marcus Comstedt else echo "Warning: Using autoconf < 2.50. Don't do this if you want to make export." >&2 fi
96bbce2001-09-23Henrik Grubbström (Grubba) 
5b7f1b2003-12-07Marcus Comstedt autoheader_version="`\"$autoheader\" --version $ah_args|head -n 1|awk '{ print $NF }'`"
0dcc582003-01-09Marcus Comstedt  if [ "x$autoconf_version" != "x$autoheader_version" ]; then echo "$autoheader version ($autoheader_version) differs from $autoconf version ($autoconf_version)" >&2 # Abort exit 1 else :; fi
a725a32010-11-26Per Hedbor num=0
1cb2252011-02-16Henrik Grubbström (Grubba) OIFS="$IFS"
f8cf2d1999-02-05Martin Stjernholm IFS=''
be21cc2004-04-04Martin Stjernholm ( find . -follow -type d -print $prune_flag || \ find . -type d -print $prune_flag
7a70482015-12-27Martin Nilsson ) | egrep -v '/(test-install)$' | sort | uniq | (
1cb2252011-02-16Henrik Grubbström (Grubba)  while read dir; do IFS="$OIFS" if [ -f "$dir/Makefile.am" -a -f "$dir/configure.in" ]; then # aclocal needs to be run before autoconf echo "Running aclocal in $dir" (cd "$dir" ; aclocal ) echo "Running automake in $dir" (cd "$dir" ; automake ) fi
97607b1998-02-28Henrik Grubbström (Grubba) 
1cb2252011-02-16Henrik Grubbström (Grubba)  if [ -f "$dir/Makefile.in" -a ! -f "$dir/dependencies" ] && \ egrep @dependencies@ "$dir/Makefile.in" >/dev/null; then
4f5fe02011-02-14Henrik Grubbström (Grubba)  touch "$dir/dependencies" need_to_make_depend=yes
1cb2252011-02-16Henrik Grubbström (Grubba)  fi if [ -f "$dir/configure.in" ]; then
4f5fe02011-02-14Henrik Grubbström (Grubba)  (
1cb2252011-02-16Henrik Grubbström (Grubba)  cd "$dir" if grep AC_CONFIG_HEADER configure.in >/dev/null; then echo "Running $autoheader in $dir"
491b202019-05-10Henrik Grubbström (Grubba)  "$autoheader" $ah_args
1cb2252011-02-16Henrik Grubbström (Grubba)  fi if grep AC_INIT configure.in >/dev/null; then echo "Running $autoconf in $dir" "$autoconf" $ac_args else echo "$dir seems to use Cygnus-configure." fi if [ "$autom4te_polluted" = "yes" ]; then # autoconf 2.53+ pollutes the source tree with cache-directories. for d in autom4te*.cache; do test -d "$d" && rm -rf "$d" done fi
491b202019-05-10Henrik Grubbström (Grubba)  echo foo >stamp-h.in
4f5fe02011-02-14Henrik Grubbström (Grubba)  ) &
1cb2252011-02-16Henrik Grubbström (Grubba)  num=`expr $num + 1` if [ $num -ge 12 ] ; then num=0 wait fi fi done wait ) | cat
1c2cd02003-02-20Henrik Grubbström (Grubba) 
1cb2252011-02-16Henrik Grubbström (Grubba) IFS="$OIFS"
d677e11997-01-21Henrik Grubbström (Grubba) 
1cb2252011-02-16Henrik Grubbström (Grubba) # Note: The above use of cat is somewhat magic. It forces the script # to wait until all the subshells have closed their stdout.
a725a32010-11-26Per Hedbor 
bbbd651997-02-13Fredrik Hübinette (Hubbe) if test "x$need_to_make_depend" = "xyes" ; then
e990f61997-01-21Fredrik Hübinette (Hubbe)  echo You need to run \"make depend\" after \"configure\", and then \"configure\" again.
bbbd651997-02-13Fredrik Hübinette (Hubbe) fi exit 0