File: run_autoconfig

package info (click to toggle)
pike8.0 8.0.702-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 79,608 kB
  • sloc: ansic: 266,508; xml: 186,324; makefile: 3,537; sh: 1,731; cpp: 1,328; lisp: 655; awk: 441; asm: 242; objc: 240; pascal: 157; perl: 34; sed: 34
file content (175 lines) | stat: -rwxr-xr-x 5,148 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/sh
#
# Bootstrap script

need_to_make_depend=no
prune_flag=""

case :$PATH: in
   */NT/tools:*)
      echo Stripping NT/tools from path temporarily...
      PATH=`echo :$PATH | sed 's@:[^:]*/NT/tools:@@g' | sed 's@^:@@'`
   ;;
esac

if test "x$1" = "x--no-recursion"; then
  prune_flag="-prune"
  shift
fi

if test "x$1" = "x" ; then
  base=`echo $0 | sed 's@[^/]*$@@g'`
  if test "x$base" != "x" ; then
    cd "$base"
  fi

  localdir=`pwd`
else
  localdir=`echo $0 | sed 's@[^/]*$@@g'`
  if test "x$localdir" = "x"; then
    localdir=`pwd`
  else
    localdir=`cd $localdir;pwd`
  fi

  cd "$1"
fi

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.
if findprog autoconf2.50 && findprog autoheader2.50; then
  autoconf=autoconf2.50
  autoheader=autoheader2.50
else
  autoconf=autoconf
  autoheader=autoheader
fi

ac_args="--localdir=$localdir"
ah_args=""

autom4te_polluted="no"

autoconf_version="`\"$autoconf\" --version $ac_args|head -n 1|awk '{ print $NF }'`"

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
    # Autoconf 2.50 and 2.51 are seriously broken.
    echo "Autoconf version $autoconf_version is not supported." >&2
    echo >&2
    echo "Get and install autoconf 2.52 or later." >&2
    # Abort
    exit 1
  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
    # 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'.
    if [ "`echo \"$autoconf_version\"|awk -F. '{ print $2 }'|sed -e 's/[A-Za-z]//g'`" -le "53" ]; then
      # autoconf 2.53 doesn't have --prepend-include.
      ac_args="-Wno-obsolete --include=$localdir"
      ah_args="--include=$localdir"
    else
      ac_args="-Wno-obsolete --prepend-include=$localdir"
      ah_args="-Wno-obsolete --prepend-include=$localdir"
    fi
    # 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
    autom4te_polluted=yes
  fi;
else
  echo "Warning: Using autoconf < 2.50.  Don't do this if you want to make export." >&2
fi

autoheader_version="`\"$autoheader\" --version $ah_args|head -n 1|awk '{ print $NF }'`"

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

num=0
OIFS="$IFS"
IFS=''
( find . -follow -type d -print $prune_flag || \
  find . -type d -print $prune_flag
) | egrep -v '/(CVS)|(RCS)|(test-install)$' | sort | uniq | (
  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

    if [ -f "$dir/Makefile.in" -a ! -f "$dir/dependencies" ] && \
	egrep @dependencies@ "$dir/Makefile.in" >/dev/null; then
      touch "$dir/dependencies"
      need_to_make_depend=yes
    fi
    if [ -f "$dir/configure.in" ]; then
      (
	cd "$dir"
	if grep AC_CONFIG_HEADER configure.in >/dev/null; then
	  echo "Running $autoheader in $dir"
	  "$autoheader" $ah_args && echo foo >stamp-h.in
	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
      ) &
      num=`expr $num + 1`
      if [ $num -ge 12 ] ; then
        num=0
        wait
      fi
    fi

  done

  wait
) | cat

IFS="$OIFS"

# Note: The above use of cat is somewhat magic. It forces the script
#       to wait until all the subshells have closed their stdout.

if test "x$need_to_make_depend" = "xyes" ; then
  echo You need to run \"make depend\" after \"configure\", and then \"configure\" again.
fi

exit 0