]> git.sesse.net Git - vlc/blob - bootstrap
Temporary change to analyse buildbot's environment in regards
[vlc] / bootstrap
1 #! /bin/sh
2
3 ##  bootstrap file for the VLC media player
4 ##
5 ## Copyright (C) 2005-2006 the VideoLAN team
6 ##
7 ##  Authors: Sam Hocevar <sam@zoy.org>
8 ##           RĂ©mi Denis-Courmont <rem # videolan # org>
9
10 if test "$#" != "0"; then
11   echo "Usage: $0"
12   echo "  Calls automake, autoconf, autoheader, autopoint and other auto* to generate"
13   echo "  m4 macros and prepare Makefiles."
14   exit 1
15 fi
16
17 ###
18 ###  Get a sane environment, just in case
19 ###
20 LANG=C
21 export LANG
22 CYGWIN=binmode
23 export CYGWIN
24
25 set -e
26 set -x
27
28 ##
29 ## Check for various tools
30 ##
31
32 ACLOCAL_ARGS="-I m4 ${ACLOCAL_ARGS}"
33
34 # Check for contrib directory
35 if test -d extras/contrib/bin; then
36   export PATH="`pwd`/extras/contrib/bin:$PATH"
37   if test -d extras/contrib/share/aclocal; then
38     ACLOCAL_ARGS="${ACLOCAL_ARGS} -I extras/contrib/share/aclocal"
39   fi
40   if test ".`uname -s`" = ".Darwin"; then
41     export LD_LIBRARY_PATH=./extras/contrib/lib:$LD_LIBRARY_PATH
42     export DYLD_LIBRARY_PATH=./extras/contrib/lib:$DYLD_LIBRARY_PATH
43   elif test ".`uname -s`" = ".BeOS"; then
44     export LIBRARY_PATH=./extras/contrib/lib:$LIBRARY_PATH
45     export BELIBRARIES=./extras/contrib/lib:$BELIBRARIES
46   fi
47 elif test ".`uname -s`" = ".Darwin"; then
48   set +x
49   echo ""
50   echo "ERR: Contribs haven't been built"
51   echo "ERR: Please run:"
52   echo "ERR: "
53   echo "ERR:    'cd extras/contrib && ./bootstrap && make && cd ../..'"
54   echo "ERR: "
55   echo "ERR: Make sure fink has been disabled too."
56   echo ""
57   set -x
58   exit 1
59 fi
60
61 # Check for autoconf
62 rm -f m4/autoconf260.m4
63 case "$(autoconf --version|head -n 1)" in
64   *2.5[012345678]*)
65     echo "$0: you need autoconf version 2.59 or later (2.60 recommanded)."
66     exit 1
67     ;;
68
69   *2.59*)
70     echo "Enabling provisional autoconf 2.59 work-around. Update autoconf ASAP."
71     echo "Press Enter to continue"
72     read
73     cp -f extras/m4/autoconf260.m4 m4/
74     ;;
75 esac
76
77 # Check for automake
78 amvers="no"
79 for v in "-1.10" "110" "-1.9" "19"; do
80   if automake${v} --version >/dev/null 2>&1; then
81     amsuff="${v}"
82     amvers="`echo ${v} | sed -e 's/^-//'`"
83     break
84   fi
85 done
86
87 if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
88   amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
89   amsuff=""
90 fi
91
92 case "${amvers}" in
93   no|1.[012345678]|1.[0123456].*|1[0123456]|1.[0123456]-*)
94     set +x
95     echo "$0: you need automake version 1.9 or later"
96     exit 1
97     ;;
98 esac
99
100 # Check for libtool
101 libtoolize="no"
102 if test -x extras/contrib/bin/libtoolize; then
103   libtoolize="extras/contrib/bin/libtoolize"
104 elif glibtoolize --version >/dev/null 2>&1; then
105   libtoolize="glibtoolize"
106 elif libtoolize --version >/dev/null 2>&1; then
107   libtoolize="libtoolize"
108 fi
109
110 if test "$libtoolize" = "no"; then
111   set +x
112   echo "$0: you need libtool"
113   exit 1
114 fi
115
116 # Check for gettext
117 if gettextize --version >/dev/null 2>&1; then
118 # Autopoint is available from 0.11.3, but we need 0.11.5
119 if expr `gettextize --version |cut -d' ' -f2- | sed -e '1s/[^0-9]*//' -e q` \
120         '>=' 0.11.5 >/dev/null 2>&1; then
121   # We have gettext, and a recent version! Everything is cool.
122   autopoint=autopoint
123   GETTEXT=yes
124   set +x
125   echo "autopoint program we will use:"
126   which ${autopoint}
127   echo "autopoint --version"
128   autopoint --version
129   echo "Directory listing of extras/contrib/bin"
130   ls -la extras/contrib/bin
131   echo "extras/contrib/bin/autopoint --version"
132   extras/contrib/bin/autopoint --version
133   set -x
134 else
135   # User's gettext is too old. try to continue anyway.
136   autopoint=:
137   GETTEXT=old
138 fi;else
139   set +x
140   echo "$0: you need gettextize (package gettext-devel or gettext)"
141   exit 1
142 fi
143
144 # Check for pkg-config
145 if pkg-config --version >/dev/null 2>&1; then
146   # We have pkg-config, everything is cool.
147   PKGCONFIG=yes
148 else
149   PKGCONFIG=no
150 fi
151
152 aclocal=aclocal${amsuff}
153 automake=automake${amsuff}
154 autoconf=autoconf
155 autoheader=autoheader
156
157 ##
158 ## Generate the modules makefile, by parsing modules/**/Modules.am
159 ##
160
161 set +x
162 echo "generating modules/**/Makefile.am and m4/private.m4"
163
164 # Prepare m4/private.m4
165 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
166 dnl  Private VLC macros - generated by bootstrap
167
168 EOF
169
170 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
171 dnl  User does not have pkg-config, so assume package was not found
172 AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
173
174 EOF
175 fi
176
177 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
178 dnl  User does not have gettext, so this is a no-op
179 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
180
181 EOF
182 fi
183
184 cat >> m4/private.m4 << EOF
185 dnl  Helper macro for vlc-config generation
186 AC_DEFUN([VLC_CONFIG_HELPER], [
187   cat >> vlc-config.in << BLAH
188 EOF
189
190 modules=""
191
192 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
193 # Autogenerated by bootstrap - DO NOT EDIT
194 EXTRA_DIST = LIST
195 dist_noinst_SCRIPTS = genmf
196 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
197
198 EOF
199
200 modules/genmf `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
201
202 cat >> m4/private.m4 << EOF
203 BLAH
204 ])
205 EOF
206
207 ###
208 ###  classic bootstrap stuff
209 ###
210 set -x
211
212 # remove autotools cruft
213 rm -f aclocal.m4 configure config.log config.h config.h.in
214 rm -Rf autom4te*.cache
215 # remove old autotools extra cruft
216 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
217 # remove new autotools extra cruft
218 rm -Rf autotools
219 mkdir autotools
220 # remove libtool cruft
221 rm -f ltmain.sh libtool ltconfig
222 # remove gettext cruft
223 rm -f ABOUT-NLS
224 rm -Rf intl
225 # remove vlc cruft
226 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
227
228 # Automake complains if these are not present
229 rm -f vlc-config.in && printf "" > vlc-config.in
230 if [ "$GETTEXT" != "yes" ]; then
231   test -d intl || mkdir intl
232   printf "" > intl/Makefile.am
233   printf "" > ABOUT-NLS
234 fi
235
236 # Libtoolize directory
237 ${libtoolize} --copy --force
238 if test -f "ltmain.sh"; then
239   echo "$0: working around a minor libtool issue"
240   mv ltmain.sh autotools/
241 fi
242
243 # Do the rest
244 ${autopoint} -f
245 rm -f po/Makevars.template
246 ${aclocal} ${ACLOCAL_ARGS}
247 ${autoconf}
248 ${autoheader}
249 ${automake} --add-missing --copy -Wall
250
251 ##
252 ##  files which need to be regenerated
253 ##
254 rm -f vlc-config.in vlc-config
255 rm -f src/misc/modules_builtin.h
256
257 # Shut up
258 set +x
259
260 ##
261 ##  Tell the user about gettext, pkg-config and sed
262 ##
263 if [ "${GETTEXT}" = "old" ]; then
264   cat << EOF
265
266 ==========================================================
267 NOTE: you have an old version of gettext installed on your
268 system. The vlc build will work, but if your system does not
269 have libintl you will not have internationalization support.
270 We suggest upgrading to gettext 0.11.5 or later.
271 EOF
272 fi
273
274 if [ "$PKGCONFIG" = "no" ]; then
275   cat << EOF
276
277 ==============================================================
278 NOTE: you do not have the "pkg-config" utility on your system;
279 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
280 reliable.
281 EOF
282 fi
283
284 echo "Successfully bootstrapped"