]> git.sesse.net Git - vlc/blob - bootstrap
* Added an info panel to show movie info, etc.
[vlc] / bootstrap
1 #! /bin/sh
2
3 ##  bootstrap file for the VLC media player
4 ##  $Id: bootstrap,v 1.43 2003/02/03 21:47:08 sam Exp $
5 ##
6 ##  Authors: Samuel Hocevar <sam@zoy.org>
7
8 if test x$# != x0; then
9   echo "Usage: ./bootstrap"
10   echo "  Calls automake, autoconf, autoheader, autopoint and other auto* to build"
11   echo "  Makefiles."
12   exit 1
13 fi
14
15 ###
16 ###  Get a sane environment, just in case
17 ###
18 LANG=C
19 export LANG
20 CYGWIN=binmode
21 export CYGWIN
22
23 ##
24 ## Naively assume our system doesn't suck. Unfortunately it seldom doesn't.
25 ##
26 SEDSUCKS=no
27 PERLSUCKS=no
28 AUTOMAKESUCKS=no
29 INSTALLSUCKS=no
30
31 ##
32 ## Check that our tools don't suck
33 ##
34 if test ! 20000 -eq `perl -e 'printf "%s\n","a"x20000' | sed -e 's/.//' 2>/dev/null | wc -c`
35 then
36   SEDSUCKS=yes
37 fi
38
39 # Mac OS X stacksize sucks
40 if test x`uname -s` = xDarwin; then ulimit -s 20000; fi
41
42 ##
43 ## Generate the modules makefile, by parsing modules/**/Modules.am
44 ##
45
46 printf "generating Modules.am and configure.ac"
47
48 echo > Modules.am
49 echo > configure.ac
50
51 ALL_FLAGS="`sed -n -e '/^[^=A-Z]*[A-Z]*FLAGS_[^=]*=/s/[^=A-Z]*\([A-Z]*FLAGS_[^=]*=\).*/\1/p' < configure.ac.in | sort | uniq`"
52
53 cat >> configure.ac << EOF
54 dnl ################################################################
55 dnl # Do not edit this file, it was generated from configure.ac.in #
56 dnl ################################################################
57
58 EOF
59 sed -n -e '/dnl do not touch this line/q;p' < configure.ac.in >> configure.ac
60
61 modules=""
62 for mf in `sed -ne 's@[^a-z]*\([^ ]*\)am.*@modules/\1am@p' < modules/Makefile.am`
63 do
64   printf "."
65   dir=`echo ${mf} | sed -e 's@\(.*\)/.*@\1@'`
66   topdir=`echo ${dir} | cut -f2 -d/`
67   sym=`echo ${dir} | sed -e 'y@/@_@'`
68   cat >> Modules.am << EOF
69 # Directory ${dir}
70
71 include ${dir}/Modules.am
72
73 EOF
74   sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf} | while read mod
75   do
76     LINKER="LINK"
77     if echo "$ALL_FLAGS" | grep '^CPPFLAGS_'${mod}'=$' >/dev/null 2>&1; then
78         echo "AC_SUBST(CPPFLAGS_${mod})" >> configure.ac; fi
79     if echo "$ALL_FLAGS" | grep '^CFLAGS_'${mod}'=$' >/dev/null 2>&1; then
80         echo "AC_SUBST(CFLAGS_${mod})" >> configure.ac; fi
81     if echo "$ALL_FLAGS" | grep '^CXXFLAGS_'${mod}'=$' >/dev/null 2>&1; then
82         LINKER="CXXLINK"
83         echo "AC_SUBST(CXXFLAGS_${mod})" >> configure.ac; fi
84     if echo "$ALL_FLAGS" | grep '^OBJCFLAGS_'${mod}'=$' >/dev/null 2>&1; then
85         LINKER="OBJCLINK"
86         echo "AC_SUBST(OBJCFLAGS_${mod})" >> configure.ac; fi
87     if echo "$ALL_FLAGS" | grep '^LDFLAGS_'${mod}'=$' >/dev/null 2>&1; then
88         echo "AC_SUBST(LDFLAGS_${mod})" >> configure.ac; fi
89     if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
90         PRIVATE='#'; else
91         PRIVATE=''; fi
92     if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
93         NODIST=''; else
94         NODIST='#'; fi
95     cat >> configure.ac << EOF
96 AM_CONDITIONAL(${mod}_plugin, test x\$${mod}_plugin = xyes)
97 AM_CONDITIONAL(${mod}_builtin, test x\$${mod}_builtin = xyes)
98 EOF
99 # Generation of Modules.am
100 # ~~~~~~~~~~~~~~~~~~~~~~~~
101 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
102 #   S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
103 #   the resulting file size.
104 # - *_CFLAGS, *_CXXFLAGS etc. include *_CPPFLAGS because per-object CPPFLAGS
105 #   does not seem to work properly with any automake version I tested.
106     cat >> Modules.am << EOF
107 # The ${mod} plugin
108
109 if ${mod}_plugin
110 if UNTRUE
111 L_${mod}_p = ${dir}/lib${mod}_plugin.a
112 endif
113 D_${mod}_p = ${dir}/lib${mod}_plugin\$(LIBEXT)
114 ${NODIST}B_${mod}_p = \$(nodist_SOURCES_${mod})
115 endif
116 if ${mod}_builtin
117 L_${mod}_b = ${dir}/lib${mod}.a
118 F_${mod}_b = \$(LDFLAGS_${mod})
119 if BUILD_MOZILLA
120 L_${mod}_pic = ${dir}/lib${mod}_pic.a
121 endif
122 ${NODIST}B_${mod}_b = \$(nodist_SOURCES_${mod})
123 endif
124
125 L_builtin += \$(L_${mod}_b)
126 L_builtin_pic += \$(L_${mod}_pic)
127 LDFLAGS_builtin += \$(F_${mod}_b)
128 ${PRIVATE}BUILT_SOURCES += \$(B_${mod}_p) \$(B_${mod}_b)
129 PLUGIN_FILES += \$(D_${mod}_p)
130
131 ${PRIVATE}${sym}_lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
132 ${NODIST}${PRIVATE}nodist_${sym}_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
133 ${sym}_lib${mod}_plugin_a_CPPFLAGS = \$(CPPFLAGS_plugin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
134 ${sym}_lib${mod}_plugin_a_CFLAGS = \$(CFLAGS_plugin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
135 ${sym}_lib${mod}_plugin_a_CXXFLAGS = \$(CXXFLAGS_plugin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
136 ${sym}_lib${mod}_plugin_a_OBJCFLAGS = \$(OBJCFLAGS_plugin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
137
138 ${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
139 ${NODIST}nodist_${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
140 ${sym}_lib${mod}_pic_a_CPPFLAGS = \$(CPPFLAGS_builtin_pic) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
141 ${sym}_lib${mod}_pic_a_CFLAGS = \$(CFLAGS_builtin_pic) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
142 ${sym}_lib${mod}_pic_a_CXXFLAGS = \$(CXXFLAGS_builtin_pic) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
143 ${sym}_lib${mod}_pic_a_OBJCFLAGS = \$(OBJCFLAGS_builtin_pic) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
144
145 ${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
146 ${NODIST}nodist_${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
147 ${sym}_lib${mod}_a_CPPFLAGS = \$(CPPFLAGS_builtin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
148 ${sym}_lib${mod}_a_CFLAGS = \$(CFLAGS_builtin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
149 ${sym}_lib${mod}_a_CXXFLAGS = \$(CXXFLAGS_builtin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
150 ${sym}_lib${mod}_a_OBJCFLAGS = \$(OBJCFLAGS_builtin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
151
152 libvlc_LIBRARIES += \$(L_${mod}_b) \$(L_${mod}_pic)
153 lib${mod}_DATA = \$(D_${mod}_p)
154
155 lib${mod}dir = \$(libdir)/vlc/${topdir}
156 ${PRIVATE}noinst_LIBRARIES += \$(L_${mod}_p)
157 ${PRIVATE}${dir}/lib${mod}_plugin\$(LIBEXT): \$(${sym}_lib${mod}_plugin_a_OBJECTS)
158 ${PRIVATE}      \$(${LINKER}) \$(${sym}_lib${mod}_plugin_a_OBJECTS) -shared \$(LDFLAGS_plugins) \$(LDFLAGS_${mod})
159
160
161 EOF
162   done
163 done
164
165 echo "AM_CONDITIONAL(UNTRUE, false)" >> configure.ac
166 sed -n -e '/dnl do not touch this line/,//p' < configure.ac.in >> configure.ac
167
168 echo "done."
169
170 ###
171 ###  classic bootstrap stuff
172 ###
173 set -x
174 rm -f aclocal.m4 m4/oldgettext.m4 configure config.guess config.log config.sub ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh
175 rm -Rf intl
176
177 # Check for gettext
178 if gettextize --version >/dev/null 2>&1
179 then
180 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
181         '>' 0.11.2 >/dev/null 2>&1
182 then
183   # We have gettext, and a recent version! Everything is cool.
184   autopoint || exit 1
185   GETTEXT=yes
186 else
187   # User's gettext is too old. try to continue anyway.
188   echo > ABOUT-NLS
189   mkdir -p intl
190   echo > intl/Makefile.am
191   echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
192   GETTEXT=old
193 fi;else
194   # we don't have gettext. grmbl. try to continue anyway.
195   echo > ABOUT-NLS
196   mkdir -p intl
197   echo > intl/Makefile.am
198   echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
199   GETTEXT=no
200 fi
201
202 # Check for automake
203 amvers="none"
204 if automake-1.7 --version >/dev/null 2>&1
205 then
206   amvers="-1.7"
207 else
208   if automake-1.6 --version >/dev/null 2>&1
209   then
210     amvers="-1.6"
211     if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1
212     then AUTOMAKESUCKS=yes
213     fi
214   else
215     if automake-1.5 --version >/dev/null 2>&1
216     then
217       INSTALLSUCKS=yes
218       amvers="-1.5"
219     else
220       if automake --version > /dev/null 2>&1
221       then
222         amvers=`automake --version | sed -e '1s/[^0-9]*//' -e q`
223         case $amvers in
224         1.6|1.6.0|1.6.1)
225           AUTOMAKESUCKS=yes ;;
226         1.5|1.5.*)
227           INSTALLSUCKS=yes ;;
228         esac
229
230         if expr "$amvers" "<" "1.5" > /dev/null 2>&1
231         then amvers="none"
232         else amvers=""
233         fi
234       fi
235     fi
236   fi
237 fi
238
239 if test x$amvers = xnone
240 then
241   set +x
242   echo "you need automake version 1.5 or later"
243   exit 1
244 fi
245
246 # Do the rest
247 aclocal${amvers} -I m4 || exit 1
248 autoheader || exit 1
249
250 automake${amvers} --add-missing --copy || PERLSUCKS=yes
251
252 case "$PERLSUCKS" in
253   no)
254   ;;
255   yes)
256     set +x
257     cat << EOF
258
259 =======================================================================
260 IMPORTANT NOTE: automake failed, please check the error messages. If it
261 actually segfaulted, it might be because of insufficient stack size; set
262 the stack size to something bigger or unlimited (\`unlimit stacksize')
263 and try again.
264 EOF
265     exit 1
266   ;;
267 esac
268
269 # Wrap automake's long lines, because the Solaris sed doesn't support lines
270 # longer than 3999 characters, and ./configure calls sed. We use Perl instead
271 # of sed for obvious reasons :)
272 perl -ne 'if(/^.{500}/) {s/(.{200}[^ ]* )/$1\\\n\t/g} print $_' < Makefile.in > Makefile.in.tmp && mv Makefile.in.tmp Makefile.in
273
274 autoconf || exit 1
275
276 ##
277 ##  headers which need to be regenerated
278 ##
279 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
280 rm -f include/vlc_symbols.h
281 rm -f mozilla/vlcintf.h
282
283 ##
284 ##  Shut up
285 ##
286 set +x
287
288 ##
289 ##  Tell the user about gettext and sed
290 ##
291 case "$GETTEXT" in
292   yes)
293   ;;
294   no)
295     cat << EOF
296
297 ===========================================================
298 IMPORTANT NOTE: you do not have gettext installed on your
299 system. The vlc build will work, but you will not have
300 internationalization support. We suggest installing gettext.
301 EOF
302   ;;
303   old)
304     cat << EOF
305
306 ==========================================================
307 NOTE: you have an old version of gettext installed on your
308 system. The vlc build will work, but if your system does not
309 have libintl you will not have internationalization support.
310 We suggest upgrading to gettext 0.11.3 or later.
311 EOF
312   ;;
313 esac
314
315 case "$AUTOMAKESUCKS" in
316   no)
317   ;;
318   yes)
319     cat << EOF
320
321 =============================================================
322 IMPORTANT NOTE: your version of automake has a bug which will
323 prevent proper plugin compilation. Either compile VLC with
324 the --disable-plugins flag, or use a version of automake newer
325 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
326 EOF
327   ;;
328 esac
329
330 case "$INSTALLSUCKS" in
331   no)
332   ;;
333   yes)
334     cat << EOF
335
336 =============================================================
337 IMPORTANT NOTE: your version of automake has a bug which will
338 prevent proper installation. Do not use "make install" with this
339 version of automake, or use a version of automake newer than 1.5
340 (such as 1.6 or 1.7).
341 EOF
342   ;;
343 esac
344
345 case "$SEDSUCKS" in
346   no)
347   ;;
348   yes)
349     cat << EOF
350
351 =============================================================
352 IMPORTANT NOTE: the version of 'sed' on your system is unable
353 to handle long lines. bootstrap will try its best to generate
354 a correct Makefile, but you should expect problems. We highly
355 recommend installing GNU sed.
356 EOF
357   ;;
358 esac
359