bzr branch
http://suren.me/webbzr/rusxmms/librcc
9
by Suren A. Chilingaryan
08.07.2005 |
1 |
#!/bin/sh
|
2 |
||
3 |
PROG=`basename $0` |
|
4 |
||
5 |
KEYFILE=src/librcc.c |
|
6 |
||
53
by Suren A. Chilingaryan
Support systems without lockf (OpenSolaris), check GTK1 headers in configure.in, complain on missing macros in autogen.sh, patches by Ivan Borzenkov and Colin Watson for eglibc compatibility |
7 |
|
9
by Suren A. Chilingaryan
08.07.2005 |
8 |
# Some OS's have multiple versions (autoconf259, etc.) and don't have an
|
9 |
# autoconf binary
|
|
10 |
||
11 |
AUTOCONF=`which autoconf` |
|
49
by Suren A. Chilingaryan
Provide GPL disclaimers with all sources |
12 |
if test x"${AUTOCONF}" != x -a -f "${AUTOCONF}" |
9
by Suren A. Chilingaryan
08.07.2005 |
13 |
then
|
14 |
AUTOCONF=autoconf |
|
15 |
LIBTOOLIZE=libtoolize |
|
16 |
AUTOHEADER=autoheader |
|
17 |
else
|
|
18 |
FINDPATH=`echo ${PATH}|sed -e 's,:, ,g'` |
|
19 |
AUTOCONF=`find ${FINDPATH} -name "autoconf*"|sort -r|head -1` |
|
20 |
LIBTOOLIZE=`find ${FINDPATH} -name "libtoolize*"|sort -r|head -1` |
|
21 |
AUTOHEADER=`find /usr/bin /usr/local/bin -name "autoheader*"|sort -r|head -1` |
|
22 |
echo "$0: autoconf: using ${AUTOCONF}" |
|
53
by Suren A. Chilingaryan
Support systems without lockf (OpenSolaris), check GTK1 headers in configure.in, complain on missing macros in autogen.sh, patches by Ivan Borzenkov and Colin Watson for eglibc compatibility |
23 |
echo "$0: libtoolize: using ${LIBTOOLIZE}" |
24 |
echo "$0: autoheader: using ${AUTOHEADER}" |
|
25 |
fi
|
|
26 |
||
27 |
AUTOMAKE=`which automake` |
|
28 |
if test x"${AUTOMAKE}" != x -a -f "${AUTOMAKE}" |
|
29 |
then
|
|
30 |
AUTOMAKE=automake |
|
31 |
ACLOCAL=aclocal |
|
32 |
else
|
|
33 |
FINDPATH=`echo ${PATH}|sed -e 's,:, ,g'` |
|
34 |
AUTOMAKE=`find ${FINDPATH} -name "automake*"|sort -r|head -1` |
|
35 |
ACLOCAL=`find ${FINDPATH} -name "aclocal*"|sort -r|head -1` |
|
9
by Suren A. Chilingaryan
08.07.2005 |
36 |
echo "$0: automake: using ${AUTOMAKE}" |
37 |
echo "$0: aclocal: using ${ACLOCAL}" |
|
38 |
fi
|
|
39 |
||
40 |
GETTEXTIZE_FLAGS=--no-changelog |
|
41 |
AUTOPOINT_FLAGS= |
|
37
by Suren A. Chilingaryan
Autogen scripts fixup |
42 |
LIBTOOLIZE_FLAGS=--copy |
9
by Suren A. Chilingaryan
08.07.2005 |
43 |
|
44 |
# Some OS's require /usr/local/share/aclocal
|
|
45 |
||
46 |
if test ! -d /usr/local/share/aclocal |
|
47 |
then
|
|
48 |
ACLOCAL_FLAGS='-I m4' |
|
49 |
else
|
|
50 |
ACLOCAL_FLAGS='-I m4 -I /usr/local/share/aclocal' |
|
51 |
fi
|
|
52 |
AUTOHEADER_FLAGS=-Wall |
|
37
by Suren A. Chilingaryan
Autogen scripts fixup |
53 |
AUTOMAKE_FLAGS='--add-missing --copy -Wall' |
9
by Suren A. Chilingaryan
08.07.2005 |
54 |
AUTOCONF_FLAGS=-Wno-obsolete |
55 |
||
56 |
||
57 |
if [ ! -f $KEYFILE ] |
|
58 |
then
|
|
59 |
echo "$PROG: key-file \`$KEYFILE' not found, exiting." >&2 |
|
60 |
echo "$PROG: hint: you should run $PROG from top-level sourse directory." >&2 |
|
61 |
exit 1 |
|
62 |
fi
|
|
63 |
||
53
by Suren A. Chilingaryan
Support systems without lockf (OpenSolaris), check GTK1 headers in configure.in, complain on missing macros in autogen.sh, patches by Ivan Borzenkov and Colin Watson for eglibc compatibility |
64 |
|
65 |
boldface="`tput bold 2>/dev/null`" |
|
66 |
normal="`tput sgr0 2>/dev/null`" |
|
67 |
||
68 |
printbold() { |
|
69 |
echo $ECHO_N "$boldface" |
|
70 |
echo "$@" |
|
71 |
echo $ECHO_N "$normal" |
|
72 |
}
|
|
73 |
||
74 |
printerr() { |
|
75 |
echo "$@" >&2 |
|
76 |
}
|
|
77 |
||
78 |
die() { |
|
79 |
err=$? |
|
80 |
echo "$PROG: exited by previous error(s), return code was $err" >&2 |
|
81 |
exit 1 |
|
82 |
}
|
|
83 |
||
55
by Suren A. Chilingaryan
Automake version detection in autogen.sh |
84 |
compare_versions() { |
85 |
ch_min_version=$1 |
|
86 |
ch_actual_version=$2 |
|
87 |
ch_status=0 |
|
88 |
IFS="${IFS= }"; ch_save_IFS="$IFS"; IFS="." |
|
89 |
set $ch_actual_version |
|
90 |
for ch_min in $ch_min_version; do |
|
91 |
ch_cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes |
|
92 |
if [ -z "$ch_min" ]; then break; fi |
|
93 |
if [ -z "$ch_cur" ]; then ch_status=1; break; fi |
|
94 |
if [ $ch_cur -gt $ch_min ]; then break; fi |
|
95 |
if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi |
|
96 |
done
|
|
97 |
IFS="$ch_save_IFS" |
|
98 |
return $ch_status |
|
99 |
}
|
|
100 |
||
53
by Suren A. Chilingaryan
Support systems without lockf (OpenSolaris), check GTK1 headers in configure.in, complain on missing macros in autogen.sh, patches by Ivan Borzenkov and Colin Watson for eglibc compatibility |
101 |
REQUIRED_M4MACROS=${REQUIRED_M4MACROS:-} |
102 |
FORBIDDEN_M4MACROS=${FORBIDDEN_M4MACROS:-} |
|
103 |
require_m4macro() { |
|
104 |
case "$REQUIRED_M4MACROS" in |
|
105 |
$1\ * | *\ $1\ * | *\ $1) ;; |
|
106 |
*) REQUIRED_M4MACROS="$REQUIRED_M4MACROS $1" ;; |
|
107 |
esac
|
|
108 |
}
|
|
109 |
||
110 |
forbid_m4macro() { |
|
111 |
case "$FORBIDDEN_M4MACROS" in |
|
112 |
$1\ * | *\ $1\ * | *\ $1) ;; |
|
113 |
*) FORBIDDEN_M4MACROS="$FORBIDDEN_M4MACROS $1" ;; |
|
114 |
esac
|
|
115 |
}
|
|
116 |
||
117 |
add_to_cm_macrodirs() { |
|
118 |
case $cm_macrodirs in |
|
119 |
"$1 "* | *" $1 "* | *" $1") ;; |
|
120 |
*) cm_macrodirs="$cm_macrodirs $1";; |
|
121 |
esac
|
|
122 |
}
|
|
123 |
||
124 |
check_m4macros() { |
|
125 |
# construct list of macro directories
|
|
126 |
cm_macrodirs=`$ACLOCAL --print-ac-dir` |
|
127 |
# aclocal also searches a version specific dir, eg. /usr/share/aclocal-1.9
|
|
128 |
# but it contains only Automake's own macros, so we can ignore it.
|
|
129 |
||
55
by Suren A. Chilingaryan
Automake version detection in autogen.sh |
130 |
AUTOMAKE_VERSION=`$AUTOMAKE --version | sed -e '2,$ d' -e 's/ *([^()]*)$//' -e 's/.* \(.*\)/\1/' -e 's/-p[0-9]\+//'` |
53
by Suren A. Chilingaryan
Support systems without lockf (OpenSolaris), check GTK1 headers in configure.in, complain on missing macros in autogen.sh, patches by Ivan Borzenkov and Colin Watson for eglibc compatibility |
131 |
# Read the dirlist file, supported by Automake >= 1.7.
|
132 |
if compare_versions 1.7 $AUTOMAKE_VERSION && [ -s $cm_macrodirs/dirlist ]; then |
|
133 |
cm_dirlist=`sed 's/[ ]*#.*//;/^$/d' $cm_macrodirs/dirlist` |
|
134 |
if [ -n "$cm_dirlist" ] ; then |
|
135 |
for cm_dir in $cm_dirlist; do |
|
136 |
if [ -d $cm_dir ]; then |
|
137 |
add_to_cm_macrodirs $cm_dir
|
|
138 |
fi
|
|
139 |
done
|
|
140 |
fi
|
|
141 |
fi
|
|
142 |
||
143 |
# Parse $ACLOCAL_FLAGS
|
|
144 |
set - $ACLOCAL_FLAGS |
|
145 |
while [ $# -gt 0 ]; do |
|
146 |
if [ "$1" = "-I" ]; then |
|
147 |
add_to_cm_macrodirs "$2" |
|
148 |
shift
|
|
149 |
fi
|
|
150 |
shift
|
|
151 |
done
|
|
152 |
||
153 |
cm_status=0 |
|
154 |
if [ -n "$REQUIRED_M4MACROS" ]; then |
|
155 |
printbold "Checking for required M4 macros..."
|
|
156 |
# check that each macro file is in one of the macro dirs
|
|
157 |
for cm_macro in $REQUIRED_M4MACROS; do |
|
158 |
cm_macrofound=false |
|
159 |
for cm_dir in $cm_macrodirs; do |
|
160 |
if [ -f "$cm_dir/$cm_macro" ]; then |
|
161 |
cm_macrofound=true |
|
162 |
break
|
|
163 |
fi
|
|
164 |
# The macro dir in Cygwin environments may contain a file
|
|
165 |
# called dirlist containing other directories to look in.
|
|
166 |
if [ -f "$cm_dir/dirlist" ]; then |
|
167 |
for cm_otherdir in `cat $cm_dir/dirlist`; do |
|
168 |
if [ -f "$cm_otherdir/$cm_macro" ]; then |
|
169 |
cm_macrofound=true |
|
170 |
break
|
|
171 |
fi
|
|
172 |
done
|
|
173 |
fi
|
|
174 |
done
|
|
175 |
if $cm_macrofound; then |
|
176 |
: |
|
177 |
else
|
|
178 |
printerr " $cm_macro not found" |
|
179 |
cm_status=1 |
|
180 |
fi
|
|
181 |
done
|
|
182 |
fi
|
|
183 |
if [ -n "$FORBIDDEN_M4MACROS" ]; then |
|
184 |
printbold "Checking for forbidden M4 macros..."
|
|
185 |
# check that each macro file is in one of the macro dirs
|
|
186 |
for cm_macro in $FORBIDDEN_M4MACROS; do |
|
187 |
cm_macrofound=false |
|
188 |
for cm_dir in $cm_macrodirs; do |
|
189 |
if [ -f "$cm_dir/$cm_macro" ]; then |
|
190 |
cm_macrofound=true |
|
191 |
break
|
|
192 |
fi
|
|
193 |
done
|
|
194 |
if $cm_macrofound; then |
|
195 |
printerr " $cm_macro found (should be cleared from macros dir)" |
|
196 |
cm_status=1 |
|
197 |
fi
|
|
198 |
done
|
|
199 |
fi
|
|
200 |
if [ "$cm_status" != 0 ]; then |
|
201 |
printerr "***Error***: some autoconf macros required to build $PKG_NAME" |
|
202 |
printerr " were not found in your aclocal path, or some forbidden"
|
|
203 |
printerr " macros were found. Perhaps you need to adjust your"
|
|
204 |
printerr " ACLOCAL_FLAGS?"
|
|
205 |
printerr |
|
206 |
fi
|
|
207 |
return $cm_status |
|
208 |
}
|
|
209 |
||
210 |
||
211 |
# PKG_CONFIG
|
|
212 |
require_m4macro pkg.m4 |
|
213 |
check_m4macros || die
|
|
214 |
||
215 |
||
216 |
||
9
by Suren A. Chilingaryan
08.07.2005 |
217 |
# gettextize ${GETTEXTIZE_FLAGS}
|
218 |
# autopoint ${AUTOPOINT_FLAGS}
|
|
219 |
# xml-i18n-toolize || die
|
|
220 |
# intltoolize || die
|
|
221 |
${LIBTOOLIZE} ${LIBTOOLIZE_FLAGS} --force || die |
|
222 |
${ACLOCAL} ${ACLOCAL_FLAGS} || die |
|
223 |
${AUTOHEADER} ${AUTOHEADER_FLAGS} || die |
|
87
by Suren A. Chilingaryan
Multiple fixes of build system |
224 |
# Seems on some systems config.h.in should be newer when various m4/* stuff generated by aclocal
|
225 |
if [ -f config.h.in ]; then touch config.h.in; fi |
|
9
by Suren A. Chilingaryan
08.07.2005 |
226 |
${AUTOMAKE} ${AUTOMAKE_FLAGS} || die |
227 |
${AUTOCONF} ${AUTOCONF_FLAGS} || die |