3 ## bootstrap file for the VLC media player
5 ## Copyright (C) 2005-2006 the VideoLAN team
7 ## Authors: Sam Hocevar <sam@zoy.org>
8 ## RĂ©mi Denis-Courmont <rem # videolan # org>
10 if test "$#" != "0"; then
12 echo " Calls automake, autoconf, autoheader, autopoint and other auto* to generate"
13 echo " m4 macros and prepare Makefiles."
18 ### Get a sane environment, just in case
29 ## Check for various tools
34 ACLOCAL_ARGS
="-I m4 ${ACLOCAL_ARGS}"
36 # Check for contrib directory
37 if test -d extras
/contrib
/bin
; then
38 export PATH
="`pwd`/extras/contrib/bin:$PATH"
39 if test -d extras
/contrib
/share
/aclocal
; then
40 ACLOCAL_ARGS
="${ACLOCAL_ARGS} -I extras/contrib/share/aclocal"
42 if test ".`uname -s`" = ".Darwin"; then
43 export LD_LIBRARY_PATH
=.
/extras
/contrib
/lib
:$LD_LIBRARY_PATH
44 export DYLD_LIBRARY_PATH
=.
/extras
/contrib
/lib
:$DYLD_LIBRARY_PATH
45 elif test ".`uname -s`" = ".BeOS"; then
46 export LIBRARY_PATH
=.
/extras
/contrib
/lib
:$LIBRARY_PATH
47 export BELIBRARIES
=.
/extras
/contrib
/lib
:$BELIBRARIES
49 elif test ".`uname -s`" = ".Darwin"; then
52 echo "ERR: Contribs haven't been built"
53 echo "ERR: Please run:"
55 echo "ERR: 'cd extras/contrib && ./bootstrap && make && cd ../..'"
57 echo "ERR: Make sure fink has been disabled too."
64 rm -f m
4/autoconf260.
m4
65 case "$(autoconf --version|head -n 1)" in
67 echo "Hey, your autoconf is quite old. Update it." >&2
72 echo "Enabling provisional autoconf 2.59 work-around. Update autoconf ASAP."
73 cp -f extras
/m
4/autoconf260.
m4 m
4/
79 for v
in "-1.10" "110" "-1.9" "19"; do
80 if automake
${v} --version >/dev
/null
2>&1; then
82 amvers
="`echo ${v} | sed -e 's/^-//'`"
87 if test "${amvers}" = "no" && automake
--version > /dev
/null
2>&1; then
88 amvers
="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
93 no|
1.
[012345678]|
1.
[0123456].
*|
1[0123456]|
1.
[0123456]-*)
95 echo "$0: you need automake version 1.9 or later"
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"
110 if test "$libtoolize" = "no"; then
112 echo "$0: you need libtool"
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 | 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.
125 # User's gettext is too old. try to continue anyway.
130 echo "you need gettextize (package gettext-devel or gettext)"
134 # Check for pkg-config
135 if pkg-config
--version >/dev
/null
2>&1; then
136 # We have pkg-config, everything is cool.
142 aclocal
=aclocal
${amsuff}
143 automake
=automake
${amsuff}
145 autoheader
=autoheader
148 ## Generate the modules makefile, by parsing modules/**/Modules.am
152 echo "generating modules/**/Makefile.am and m4/private.m4"
154 # Prepare m4/private.m4
155 rm -f m
4/private.
m4 && cat > m
4/private.
m4 << EOF
156 dnl Private VLC macros - generated by bootstrap
160 if [ "${PKGCONFIG}" = "no" ]; then cat >> m
4/private.
m4 << EOF
161 dnl User does not have pkg-config, so assume package was not found
162 AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
167 if [ "${GETTEXT}" != "yes" ]; then cat >> m
4/private.
m4 << EOF
168 dnl User does not have gettext, so this is a no-op
169 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
174 cat >> m
4/private.
m4 << EOF
175 dnl Helper macro for vlc-config generation
176 AC_DEFUN([VLC_CONFIG_HELPER], [
177 cat >> vlc-config.in << BLAH
182 rm -f modules
/Makefile.am
&& cat > modules
/Makefile.am
<< EOF
183 # Autogenerated by bootstrap - DO NOT EDIT
185 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
188 for dir
in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
191 modf
="modules/${dir}/Modules.am"
192 makf
="modules/${dir}/Makefile.am"
193 basedir
="`echo "${dir}" | cut -f1 -d/`"
194 # automake will not recurse for make dist if we don't define SUBDIRS = .
195 subdirs
="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
196 mods
="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | xargs`"
200 extra_ltlibs
="${extra_ltlibs} lib${mod}_plugin.la"
202 rm -f "${makf}" && cat > "${makf}" << EOF
204 # ${makf} automatically generated from ${modf} by bootstrap
205 # DO NOT EDIT - edit Modules.am or \$(top_srcdir)/bootstrap instead
212 EXTRA_DIST = Modules.am
216 SUFFIXES = _plugin\$(LIBEXT) _plugin.la
218 libvlcdir = \$(libdir)/vlc/\$(basedir)
220 EXTRA_LTLIBRARIES = ${extra_ltlibs}
224 LTLIBVLC = \$(top_builddir)/src/libvlc.la
226 AM_LDFLAGS = -rpath '\$(libvlcdir)' -avoid-version \\
227 -module -no-undefined -shrext \$(LIBEXT) \\
228 -export-symbol-regex ^\$(VLC_ENTRY)\$\$
231 AM_LIBADD = \$(LTLIBVLC)
234 LIBVLC = \$(top_builddir)/src/libvlc.dll
240 \$(top_builddir)/compile
242 # Find out which modules were enabled and tell make to build them
245 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
246 z=\$\$(\$(VLC_CONFIG) --list plugin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_plugin.la;; esac; done; \\
247 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
250 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
251 z=\$\$(\$(VLC_CONFIG) --list plugin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_plugin\$(LIBEXT);; esac; done; \\
252 z=\$\$(\$(VLC_CONFIG) --list builtin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}.a;; esac; done; \\
253 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
257 # Build a plugin with the adequate linker and linker's flags
258 _plugin.la_plugin\$(LIBEXT):
259 @mod="\$*" ; mod=\$\${mod#lib} ; \
260 ldfl="\`\$(VLC_CONFIG) --libs plugin \$\$mod\` \$(LIBVLC) -u \$(SYMPREF)\$(VLC_ENTRY)" ; \
261 case \`\$(VLC_CONFIG) --linkage \$\$mod\` in \\
262 c++) ld="\$(CXXLINK)" ;; \
263 objc) ld="\$(OBJCLINK)" ;; \
264 c|*) ld="\$(LINK)" ;; \
266 echo \$\$ld \$< \$\$ldfl ; \
268 @if test -f "\$@.exe"; then mv -f -- "\$@.exe" "\$@"; fi
271 \$(srcdir)/Makefile.am: \$(srcdir)/Modules.am \$(top_srcdir)/bootstrap
272 cd \$(top_srcdir) && \$(SHELL) ./bootstrap
281 ### automake creates libvlcdir after running install-*-local
282 ### so we have to create it ourselves first
283 install-exec-local: all-modules
285 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
286 z=\$\$(\$(VLC_CONFIG) --list plugin); \
287 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
289 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" install-libvlcLTLIBRARIES || exit \$\$? ; \
292 mkdir -p -- "\$(DESTDIR)\$(libvlcdir)"
293 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
294 for mod in \$(mods); do \
296 in *\ \$\${mod}\ *) \
297 echo \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" ; \
298 \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
306 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
307 z=\$\$(\$(VLC_CONFIG) --list plugin); \
308 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
310 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" uninstall-libvlcLTLIBRARIES || exit \$\$?; \
313 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
314 for mod in \$(mods); do \
316 in *\ \$\${mod}\ *) \
317 echo rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" ; \
318 rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" || true; \
327 if grep '^nodist_SOURCES_'${mod}'' < "${modf}" >/dev
/null
2>&1; then
330 cat >> m
4/private.
m4 << EOF
331 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
333 # Generation of modules/**/Makefile.am
334 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
335 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
336 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
337 # the resulting file size.
338 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
339 # work properly with any automake version I tested.
340 cat >> "${makf}" << EOF
344 cat >> "${makf}" << EOF
345 lib${mod}_plugin_la_SOURCES = \$(SOURCES_${mod})
347 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
348 nodist_lib${mod}_plugin_la_SOURCES = \$(nodist_SOURCES_${mod})
349 CLEANFILES += "\$(nodist_SOURCES_${mod})"
350 BUILT_SOURCES += \$(B${mod})
353 cat >> "${makf}" << EOF
354 lib${mod}_plugin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
355 lib${mod}_plugin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
356 lib${mod}_plugin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
357 lib${mod}_plugin_la_LDFLAGS = \`\$(VLC_CONFIG) --libs plugin ${mod}\` \$(AM_LDFLAGS)
358 lib${mod}_plugin_la_LIBADD = \$(AM_LIBADD)
363 cat >> m
4/private.
m4 << EOF
369 ### classic bootstrap stuff
373 # remove autotools cruft
374 rm -f aclocal.
m4 configure config.log config.h config.h.
in
375 rm -Rf autom4te
*.cache
376 # remove old autotools extra cruft
377 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
378 # remove new autotools extra cruft
381 # remove libtool cruft
382 rm -f ltmain.sh libtool ltconfig
383 # remove gettext cruft
387 rm -f stamp-builtin stamp-h
* mozilla
/stamp-pic
389 # Automake complains if these are not present
390 rm -f vlc-config.
in && printf "" > vlc-config.
in
391 if [ "$GETTEXT" != "yes" ]; then
392 test -d intl || mkdir intl
393 printf "" > intl
/Makefile.am
394 printf "" > ABOUT-NLS
397 # Libtoolize directory
398 ${libtoolize} --copy --force
399 if test -f "ltmain.sh"; then
400 echo "$0: working around a minor libtool issue"
401 mv ltmain.sh autotools
/
404 # patch for DLL link for libtool on cygwin (remove when fixed)
405 if test ".`uname -s|sed -n '/^CYGWIN/p'`" != "."; then
406 patch -s -p0 << 'EOF'
407 --- autotools
/ltmain.orig
2006-12-05 15:15:42.064607000 +0000
408 +++ autotools
/ltmain.sh
2006-12-05 15:16:24.705777800 +0000
409 @@
-4360,7 +4360,7 @@
413 - *cygwin
*) output
=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
414 + *cygwin
*) output
=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,;s,.dll.exe$,.dll,'` ;;
416 if test -n "$vinfo"; then
417 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
423 ${aclocal} ${ACLOCAL_ARGS}
426 ${automake} --add-missing --copy -Wall
429 ## files which need to be regenerated
431 rm -f vlc-config.
in vlc-config
432 rm -f src
/misc
/modules_builtin.h
438 ## Tell the user about gettext, pkg-config and sed
440 if [ "${GETTEXT}" = "old" ]; then
443 ==========================================================
444 NOTE: you have an old version of gettext installed on your
445 system. The vlc build will work, but if your system does not
446 have libintl you will not have internationalization support.
447 We suggest upgrading to gettext 0.11.5 or later.
451 if [ "$PKGCONFIG" = "no" ]; then
454 ==============================================================
455 NOTE: you do not have the "pkg-config" utility on your system;
456 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be