aboutsummaryrefslogtreecommitdiff
path: root/devel/djgpp-gcc/scripts/pre-configure
blob: 6a141bec51c6f528f401744745468ec5eeb8d70d (plain) (blame)
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
#! /bin/sh

AUTOCONF_OLD=autoconf-2.13
AUTOHEADER_OLD=autoheader-2.13
AUTOCONF=autoconf-2.61
AUTOHEADER=autoheader-2.61
ACLOCAL=aclocal-1.9
AUTOMAKE=automake-1.9

#
#  List of directories in which we should run autoconf or/and automake
#

automake_list=
aclocal_list=

#
#  Build list of patched files
#

for x in `(cd ${WRKDIR}/diffs/source && find . -type f | sed -e 's/\.\///g')`; do
    case $x in 
       *.diff | *.diff.in)
           cd $top
           diff=${WRKDIR}/$x;
           fname=`echo $x | sed -e 's/\.diff//g'`
           if [ -f $gcc_dir/$fname ] ; then
              case $fname in 
                  */acinclude.m4)
                     dir=`echo $gcc_dir/$fname | sed -e 's/\/acinclude.m4//g'`
                      aclocal_list="$aclocal_list $dir"
                      ;;
                  */Makefile.am)
                      dir=`echo $gcc_dir/$fname | sed -e 's/\/Makefile.am//g'`
                      automake_list="$automake_list $dir"
                      ;;
              esac
           fi
           ;;
       *)
           ;;
       esac
done

for dir in build.gcc install.gcc; do
    for x in `(cd ${WRKDIR}/diffs/$dir && find . -type f | sed -e 's/\.\///g')`; do
        mkdir -p `dirname ${WRKDIR}/gnu/$dir/$x`
	echo "Writing $dir/$x"
	cat ${WRKDIR}/diffs/$dir/$x |\
	sed -e "s:@SRCDIR@:$dir_name:g" >${WRKDIR}/gnu/$dir/$x
    done
done

#
#  Run aclocal where needed
#
( cd $gcc_dir/libgfortran && ${ACLOCAL} -I ../config || exit 1)
( cd $gcc_dir/libstdc++-v3 && ${ACLOCAL} -I . -I .. -I ../config || exit 1)

#for dir in $aclocal_list ; do
#   if cd $dir ; then
#      echo Running aclocal in `pwd`...
#      if ! aclocal -I . -I $gcc_dir -I $gcc_dir/config ; then
#         echo "aclocal failed in directory `pwd`"
#         cd $top
#         exit 1
#      fi
#   fi
#   cd $top
#done

#
#  Run automake where needed
#

for dir in $automake_list; do
   if cd $dir ; then
      echo "Directory $dir: must run automake ...";
      if ! [ -f configure.in ] ; then
         if ! [ -f configure.ac ] ; then
            cd ..;
            if ! [ -f configure.in ] ; then
               if ! [ -f configure.ac ] ; then
                  cd ..
               fi
            fi
         fi
      fi
      echo "Running automake..."
      if ! ${AUTOMAKE}; then
         echo "automake failed in directory `pwd`"
         cd $top
         exit 1
      fi
   fi
   cd $top
done

#
#  Run autoconf where needed
#

for c in `find $gcc_dir -name 'configure.in' -o -name 'configure.ac'`; do
   d=`dirname $c`
   n=`basename $c`
   if cd $d ; then
      AC_PREREQ=`grep 'AC_PREREQ(' $n | sed 's#.*(##' | sed 's#)##'`;

      case $AC_PREREQ in 
          2.1*) echo Running autoconf-2.13 in `pwd` ...;
                if ! $AUTOCONF_OLD ; then 
                   echo "autoconf failed in directory `pwd`"
                   cd $top
                   exit 1
                fi
                ;;
          *2.5*) echo Running autoconf-2.5X in `pwd` ...;
                if ! $AUTOCONF ; then 
                   echo "autoconf failed in directory `pwd`"
                   cd $top
                   exit 1
                fi
                ;;
          *)    echo Unknown autoconf version $AC_PREREQ required
                exit 1
                ;;
      esac 
   fi
   cd $top
done

#
#  Run autoheader where needed
#

if cd $gcc_dir/gcc ; then
   echo Running autoheader in `pwd` ...;
   if [ -f configure.ac ] ; then
      if ! $AUTOHEADER ; then
         echo "autoheader failed in directory `pwd`"
         cd $top
         exit 1
      fi
   elif ! $AUTOHEADER_OLD ; then
      echo "autoheader failed in directory `pwd`"
      cd $top
      exit 1
   fi
   rm -f cstamp-h.in
   echo timestamp >cstamp-h.in
fi

if [ -f $gcc_dir/contrib/gcc_update ] ; then
   echo Running contrib/gcc_update --touch
   cd $gcc_dir;
   ./contrib/gcc_update --touch
   cd $top
fi

for x in `find . -type d -a -name 'autom4te.cache'`; do
   rm -rf $x
done