summaryrefslogtreecommitdiff
path: root/xc/extras/Mesa/fixam
blob: bd9757c5d5be60cd56b7d87ce1e5e4851c168174 (plain)
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
#! /bin/sh

# (c) Copyright 1999, Thomas Tanner <tanner@ffii.org>
# Disables/enables automake's automatic dependency tracking
# since automake 1.4 doesn't support this feature on non-GNU systems.
# Developers using a non-GNU system (no GNU make and GCC installed)
# must execute
#	fixam
# before running bootstrap and
#	fixam -r
# before doing a CVS checkin.
# Normally, on GNU systems (both GCC and GNU make installed) 
# this script has no effect. However, you can force it to assume
# a non-GNU system using the -f argument.

undo=no
force=no
while test $# -gt 0
do
  arg="$1"
  shift
  case "$arg" in
  -f) force=yes ;;
  -r) undo=yes ;;
  esac
done

if test $force = no && (cc -v 2>&1 | grep gcc > /dev/null) &&
   (make -v 2>&1 | grep GNU > /dev/null); then 
  # GCC and GNU make installed
  echo "nothing to do."
  exit 0
fi

files=`find -name "Makefile.am"`
for file in $files; do
  if grep "AUTOMAKE_OPTIONS = no-dependencies" $file > /dev/null; then
    echo "fixing $file"
    if test $undo = no; then
      # uncomment it -> disable automatic dependency tracking
      sed -e "s/^\#AUTOMAKE_OPTIONS/AUTOMAKE_OPTIONS/g" $file > $file.tmp
    else
      # comment it out -> enable automatic dependency tracking
      sed -e "s/^AUTOMAKE_OPTIONS/\#AUTOMAKE_OPTIONS/g" $file > $file.tmp
    fi
    mv -f $file.tmp $file
  fi
done
echo "done."

exit 0