3 ## bootstrap file for the VLC media player
4 ## $Id: bootstrap,v 1.51 2003/06/23 10:21:25 sam Exp $
6 ## Authors: Samuel Hocevar <sam@zoy.org>
8 if test x$# != x0; then
9 echo "Usage: ./bootstrap"
10 echo " Calls automake, autoconf, autoheader, autopoint and other auto* to build"
16 ### Get a sane environment, just in case
24 ## Naively assume our system doesn't suck. Unfortunately it seldom doesn't.
32 ## Check that our tools don't suck
34 if test ! 20000 -eq `perl -e 'printf "%s\n","a"x20000' | sed -e 's/.//' 2>/dev/null | wc -c`
39 # Mac OS X stacksize sucks
40 if test x`uname -s` = xDarwin; then ulimit -s 20000; fi
43 ## Generate the modules makefile, by parsing modules/**/Modules.am
46 printf "generating Modules.am and vlc.m4"
48 # Prepare Modules.am and m4/vlc.m4
49 rm -f Modules.am && echo > Modules.am
50 rm -f m4/vlc.m4 && cat > m4/vlc.m4 << EOF
51 dnl Private VLC macros - generated by bootstrap
53 dnl The required AM_CONDITIONAL an AC_SUBST calls
54 AC_DEFUN([VLC_VARIABLES], [
57 ALL_FLAGS="`sed -n -e '/^[^=A-Z]*[A-Z]*FLAGS_[^=]*=/s/[^=A-Z]*\([A-Z]*FLAGS_[^=]*=\).*/\1/p' < configure.ac | sort | uniq`"
60 for mf in `sed -ne 's@[^a-z]*\([^ ]*\)am.*@modules/\1am@p' < modules/Makefile.am`
63 dir=`echo ${mf} | sed -e 's@\(.*\)/.*@\1@'`
64 topdir=`echo ${dir} | cut -f2 -d/`
65 sym=`echo ${dir} | sed -e 'y@/@_@'`
66 cat >> Modules.am << EOF
69 include ${dir}/Modules.am
72 sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf} | while read mod
75 if echo "$ALL_FLAGS" | grep '^CPPFLAGS_'${mod}'=$' >/dev/null 2>&1; then
76 echo "AC_SUBST(CPPFLAGS_${mod})" >> m4/vlc.m4; fi
77 if echo "$ALL_FLAGS" | grep '^CFLAGS_'${mod}'=$' >/dev/null 2>&1; then
78 echo "AC_SUBST(CFLAGS_${mod})" >> m4/vlc.m4; fi
79 if echo "$ALL_FLAGS" | grep '^CXXFLAGS_'${mod}'=$' >/dev/null 2>&1; then
81 echo "AC_SUBST(CXXFLAGS_${mod})" >> m4/vlc.m4; fi
82 if echo "$ALL_FLAGS" | grep '^OBJCFLAGS_'${mod}'=$' >/dev/null 2>&1; then
84 echo "AC_SUBST(OBJCFLAGS_${mod})" >> m4/vlc.m4; fi
85 if echo "$ALL_FLAGS" | grep '^LDFLAGS_'${mod}'=$' >/dev/null 2>&1; then
86 echo "AC_SUBST(LDFLAGS_${mod})" >> m4/vlc.m4; fi
87 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
90 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
93 cat >> m4/vlc.m4 << EOF
94 AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
95 AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
97 # Generation of Modules.am
98 # ~~~~~~~~~~~~~~~~~~~~~~~~
99 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
100 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
101 # the resulting file size.
102 # - *_CFLAGS, *_CXXFLAGS etc. include *_CPPFLAGS because per-object CPPFLAGS
103 # does not seem to work properly with any automake version I tested.
104 cat >> Modules.am << EOF
109 L_${mod}_p = ${dir}/lib${mod}_plugin.a
111 D_${mod}_p = ${dir}/lib${mod}_plugin\$(LIBEXT)
112 ${NODIST}B_${mod}_p = \$(nodist_SOURCES_${mod})
115 L_${mod}_b = ${dir}/lib${mod}.a
116 F_${mod}_b = \$(LDFLAGS_${mod})
118 L_${mod}_pic = ${dir}/lib${mod}_pic.a
120 ${NODIST}B_${mod}_b = \$(nodist_SOURCES_${mod})
123 L_builtin += \$(L_${mod}_b)
124 L_builtin_pic += \$(L_${mod}_pic)
125 LDFLAGS_builtin += \$(F_${mod}_b)
126 ${PRIVATE}BUILT_SOURCES += \$(B_${mod}_p) \$(B_${mod}_b)
127 PLUGIN_FILES += \$(D_${mod}_p)
129 ${PRIVATE}${sym}_lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
130 ${NODIST}${PRIVATE}nodist_${sym}_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
131 ${sym}_lib${mod}_plugin_a_CPPFLAGS = \$(CPPFLAGS_plugin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
132 ${sym}_lib${mod}_plugin_a_CFLAGS = \$(CFLAGS_plugin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
133 ${sym}_lib${mod}_plugin_a_CXXFLAGS = \$(CXXFLAGS_plugin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
134 ${sym}_lib${mod}_plugin_a_OBJCFLAGS = \$(OBJCFLAGS_plugin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
136 ${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
137 ${NODIST}nodist_${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
138 ${sym}_lib${mod}_pic_a_CPPFLAGS = \$(CPPFLAGS_builtin_pic) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
139 ${sym}_lib${mod}_pic_a_CFLAGS = \$(CFLAGS_builtin_pic) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
140 ${sym}_lib${mod}_pic_a_CXXFLAGS = \$(CXXFLAGS_builtin_pic) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
141 ${sym}_lib${mod}_pic_a_OBJCFLAGS = \$(OBJCFLAGS_builtin_pic) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
143 ${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
144 ${NODIST}nodist_${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
145 ${sym}_lib${mod}_a_CPPFLAGS = \$(CPPFLAGS_builtin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
146 ${sym}_lib${mod}_a_CFLAGS = \$(CFLAGS_builtin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
147 ${sym}_lib${mod}_a_CXXFLAGS = \$(CXXFLAGS_builtin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
148 ${sym}_lib${mod}_a_OBJCFLAGS = \$(OBJCFLAGS_builtin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
150 libvlc_LIBRARIES += \$(L_${mod}_b) \$(L_${mod}_pic)
151 lib${mod}_DATA = \$(D_${mod}_p)
153 lib${mod}dir = \$(libdir)/vlc/${topdir}
154 ${PRIVATE}noinst_LIBRARIES += \$(L_${mod}_p)
155 ${PRIVATE}${dir}/lib${mod}_plugin\$(LIBEXT): \$(${sym}_lib${mod}_plugin_a_OBJECTS)
156 ${PRIVATE} \$(${LINKER}) \$(${sym}_lib${mod}_plugin_a_OBJECTS) \$(LDFLAGS_plugins) \$(LDFLAGS_${mod})
163 cat >> m4/vlc.m4 << EOF
164 AM_CONDITIONAL(UNTRUE, false)
171 ### classic bootstrap stuff
175 # remove autotools cruft
176 rm -f aclocal.m4 configure configure.ac.in config.log
177 # remove old autotools extra cruft
178 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
179 # remove new autotools extra cruft
180 (cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh)
181 # remove libtool cruft
182 rm -f ltmain.sh libtool ltconfig
183 # remove gettext cruft
184 rm -f m4/oldgettext.m4 ABOUT-NLS
188 if gettextize --version >/dev/null 2>&1
190 # Autopoint is available from 0.11.3, but we need 0.11.5
191 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
192 '>=' 0.11.5 >/dev/null 2>&1
194 # We have gettext, and a recent version! Everything is cool.
198 # User's gettext is too old. try to continue anyway.
201 echo > intl/Makefile.am
202 cat >> m4/vlc.m4 << EOF
203 dnl User's gettext is too old, so this is a no-op
204 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
209 # we don't have gettext. grmbl. try to continue anyway.
212 echo > intl/Makefile.am
213 cat >> m4/vlc.m4 << EOF
214 dnl User does not have gettext, so this is a no-op
215 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
221 # Check for pkg-config
222 if pkg-config --version >/dev/null 2>&1
224 # We have pkg-config, everything is cool.
227 # Not present, use a workaround.
228 cat >> m4/vlc.m4 << EOF
229 dnl User does not have pkg-config, so this is a no-op
230 AC_DEFUN([PKG_CHECK_MODULES], [])
238 if automake-1.7 --version >/dev/null 2>&1
242 if automake-1.6 --version >/dev/null 2>&1
245 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1
246 then AUTOMAKESUCKS=yes
249 if automake-1.5 --version >/dev/null 2>&1
254 if automake --version > /dev/null 2>&1
256 amvers=`automake --version | sed -e '1s/[^0-9]*//' -e q`
264 if expr "$amvers" "<" "1.5" > /dev/null 2>&1
273 if test x$amvers = xnone
276 echo "you need automake version 1.5 or later"
281 aclocal${amvers} -I m4 || exit 1
284 automake${amvers} --add-missing --copy || PERLSUCKS=yes
293 =======================================================================
294 IMPORTANT NOTE: automake failed, please check the error messages. If it
295 actually segfaulted, it might be because of insufficient stack size; set
296 the stack size to something bigger or unlimited (\`unlimit stacksize')
303 # Wrap automake's long lines, because the Solaris sed doesn't support lines
304 # longer than 3999 characters, and ./configure calls sed. We use Perl instead
305 # of sed for obvious reasons :)
306 perl -ne 'if(/^.{500}/) {s/(.{200}[^ ]* )/$1\\\n\t/g} print $_' < Makefile.in > Makefile.in.tmp && mv Makefile.in.tmp Makefile.in
311 ## headers which need to be regenerated
313 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
314 rm -f include/vlc_symbols.h
315 rm -f mozilla/vlcintf.h
323 ## Tell the user about gettext, pkg-config and sed
331 ===========================================================
332 IMPORTANT NOTE: you do not have gettext installed on your
333 system. The vlc build will work, but you will not have
334 internationalization support. We suggest installing gettext.
340 ==========================================================
341 NOTE: you have an old version of gettext installed on your
342 system. The vlc build will work, but if your system does not
343 have libintl you will not have internationalization support.
344 We suggest upgrading to gettext 0.11.5 or later.
355 ==============================================================
356 NOTE: you do not have the "pkg-config" utility on your system;
357 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
363 case "$AUTOMAKESUCKS" in
369 =============================================================
370 IMPORTANT NOTE: your version of automake has a bug which will
371 prevent proper plugin compilation. Either compile VLC with
372 the --disable-plugins flag, or use a version of automake newer
373 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
378 case "$INSTALLSUCKS" in
384 =============================================================
385 IMPORTANT NOTE: your version of automake has a bug which will
386 prevent proper installation. Do not use "make install" with this
387 version of automake, or use a version of automake newer than 1.5
388 (such as 1.6 or 1.7).
399 =============================================================
400 IMPORTANT NOTE: the version of 'sed' on your system is unable
401 to handle long lines. bootstrap will try its best to generate
402 a correct Makefile, but you should expect problems. We highly
403 recommend installing GNU sed.