-
Notifications
You must be signed in to change notification settings - Fork 0
/
reconf.sh
137 lines (130 loc) · 3.46 KB
/
reconf.sh
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
#!/bin/sh
#
# Copyright (c) 2001, 2003, 2012 Tama Communications Corporation
#
# This file is part of GNU GLOBAL.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Usage:
#
# % sh reconf.sh [--configure|--make|--install]
#
CDPATH=
case $1 in
--help) echo "Usage: sh reconf.sh [--configure|--make|--install]"
exit 0;;
esac
prog='autoconf automake bison flex gperf libtool m4 perl' # required programs
file='convert.pl configure.ac Makefile.am libparser/reserved.pl' # required files
echo "- File existent checking..."
for f in `echo $file`; do
if [ ! -f $f ]; then
echo "*** File '$f' not found."
echo "You must execute this command at the root of GLOBAL source directory."
exit 1
fi
echo "+ $f"
done
#
# Software tools which was used for making this package is written to 'BUILD_TOOLS' file.
#
cat <<! >BUILD_TOOLS
This software was made using the following build tools:
!
echo "- Program existent checking..."
for p in `echo $prog`; do
found=0
for d in `echo $PATH | sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' -e 's/:/ /g'`
do
if [ -x $d/$p ]; then
#echo "Found at $d/$p."
found=1
echo "+ $d/$p"
break
fi
done
case $found in
0) echo "*** Program '$p' not found."
echo "Please install `echo $p | sed 's/autoreconf/automake and autoconf/'`."
exit 1;;
esac
case $p in
perl|libtool) ;;
*) $p --version | head -n 1 >>BUILD_TOOLS;;
esac
done
#
# We should do this before packaging so that user can build it without
# flex, bison and gperf.
#
echo "- Preparing parser source ..."
(cd libparser; set -x
for lang in c cpp java php asm ttcn3; do
name=${lang}_res
perl ./reserved.pl --prefix=$lang ${lang}_res.in > ${name}.gpf
option=`perl ./reserved.pl --prefix=$lang --option`
gperf $option < ${name}.gpf > ${name}.h
if [ -f $lang.l ]; then
flex -o$lang.c $lang.l
fi
if [ -f ${lang}_scan.l ]; then
flex -o${lang}_scan.c ${lang}_scan.l
fi
if [ -f ${lang}_parse.y ]; then
bison -d -o ${lang}_parse.c ${lang}_parse.y
fi
done
)
(cd htags; set -x
for lang in c cpp java php asm ttcn3; do
flex -o$lang.c $lang.l
done
)
echo "- Collecting reference manuals ..."
commands="global gtags htags htags-server gozilla gtags-cscope globash";
perl ./convert.pl --menu $commands > doc/reference.texi
for d in `echo $commands`; do
perl ./convert.pl --info $d/manual.in > doc/$d.ref
echo "+ doc/$d.ref"
perl ./convert.pl --man $d/manual.in > $d/$d.1
echo "+ $d/$d.1"
perl ./convert.pl --c $d/manual.in > $d/const.h
echo "+ $d/const.h"
done
echo "- Clean up config.cache..."
rm -f config.cache
echo "- Generating configure items..."
(set -x; autoreconf --symlink --verbose --install --force) &&
case $1 in
'') echo "You are ready to execute ./configure"
;;
--debug)
./configure CFLAGS='-g -p -Wall -DDEBUG'
make -s
;;
--warn)
./configure CFLAGS='-g -O2 -Wall'
make -s
;;
-c|--configure|--make|--install)
./configure
;;
esac && case $1 in
--make) make
;;
--install)
make install
;;
esac