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 m4/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/m4/autoconf260.m4 m4/
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 glibtoolize --version >/dev/null 2>&1; then
103 libtoolize="glibtoolize"
104 elif libtoolize --version >/dev/null 2>&1; then
105 libtoolize="libtoolize"
108 if test "$libtoolize" = "no"; then
110 echo "$0: you need libtool"
115 if gettextize --version >/dev/null 2>&1; then
116 # Autopoint is available from 0.11.3, but we need 0.11.5
117 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
118 '>=' 0.11.5 >/dev/null 2>&1; then
119 # We have gettext, and a recent version! Everything is cool.
123 # User's gettext is too old. try to continue anyway.
128 echo "you need gettextize (package gettext-devel or gettext)"
132 # Check for pkg-config
133 if pkg-config --version >/dev/null 2>&1; then
134 # We have pkg-config, everything is cool.
140 aclocal=aclocal${amsuff}
141 automake=automake${amsuff}
143 autoheader=autoheader
146 ## Generate the modules makefile, by parsing modules/**/Modules.am
150 echo "generating modules/**/Makefile.am and m4/private.m4"
152 # Prepare m4/private.m4
153 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
154 dnl Private VLC macros - generated by bootstrap
158 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
159 dnl User does not have pkg-config, so assume package was not found
160 AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
165 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
166 dnl User does not have gettext, so this is a no-op
167 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
172 cat >> m4/private.m4 << EOF
173 dnl Helper macro for vlc-config generation
174 AC_DEFUN([VLC_CONFIG_HELPER], [
175 cat >> vlc-config.in << BLAH
180 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
181 # Autogenerated by bootstrap - DO NOT EDIT
183 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
186 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
189 modf="modules/${dir}/Modules.am"
190 makf="modules/${dir}/Makefile.am"
191 basedir="`echo "${dir}" | cut -f1 -d/`"
192 # automake will not recurse for make dist if we don't define SUBDIRS = .
193 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
194 mods="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | xargs`"
198 extra_ltlibs="${extra_ltlibs} lib${mod}_plugin.la"
200 rm -f "${makf}" && cat > "${makf}" << EOF
202 # ${makf} automatically generated from ${modf} by bootstrap
203 # DO NOT EDIT - edit Modules.am or \$(top_srcdir)/bootstrap instead
210 EXTRA_DIST = Modules.am
214 SUFFIXES = _plugin\$(LIBEXT) _plugin.la
216 libvlcdir = \$(libdir)/vlc/\$(basedir)
218 EXTRA_LTLIBRARIES = ${extra_ltlibs}
222 LTLIBVLC = \$(top_builddir)/src/libvlc.la
224 AM_LDFLAGS = -rpath '\$(libvlcdir)' -avoid-version \\
225 -module -no-undefined -shrext \$(LIBEXT) \\
226 -export-symbol-regex ^\$(VLC_ENTRY)\$\$
229 AM_LIBADD = \$(LTLIBVLC)
232 LIBVLC = \$(top_builddir)/src/libvlc.dll
238 \$(top_builddir)/compile
240 # Find out which modules were enabled and tell make to build them
243 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
244 z=\$\$(\$(VLC_CONFIG) --list plugin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_plugin.la;; esac; done; \\
245 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
248 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
249 z=\$\$(\$(VLC_CONFIG) --list plugin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_plugin\$(LIBEXT);; esac; done; \\
250 z=\$\$(\$(VLC_CONFIG) --list builtin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}.a;; esac; done; \\
251 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
255 # Build a plugin with the adequate linker and linker's flags
256 _plugin.la_plugin\$(LIBEXT):
257 @mod="\$*" ; mod=\$\${mod#lib} ; \
258 ldfl="\`\$(VLC_CONFIG) --libs plugin \$\$mod\` \$(LIBVLC) -u \$(SYMPREF)\$(VLC_ENTRY)" ; \
259 case \`\$(VLC_CONFIG) --linkage \$\$mod\` in \\
260 c++) ld="\$(CXXLINK)" ;; \
261 objc) ld="\$(OBJCLINK)" ;; \
262 c|*) ld="\$(LINK)" ;; \
264 echo \$\$ld \$< \$\$ldfl ; \
266 @if test -f "\$@.exe"; then mv -f -- "\$@.exe" "\$@"; fi
269 \$(srcdir)/Makefile.am: \$(srcdir)/Modules.am \$(top_srcdir)/bootstrap
270 cd \$(top_srcdir) && \$(SHELL) ./bootstrap
279 ### automake creates libvlcdir after running install-*-local
280 ### so we have to create it ourselves first
281 install-exec-local: all-modules
283 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
284 z=\$\$(\$(VLC_CONFIG) --list plugin); \
285 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
287 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" install-libvlcLTLIBRARIES || exit \$\$? ; \
290 mkdir -p -- "\$(DESTDIR)\$(libvlcdir)"
291 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
292 for mod in \$(mods); do \
294 in *\ \$\${mod}\ *) \
295 echo \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" ; \
296 \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
304 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
305 z=\$\$(\$(VLC_CONFIG) --list plugin); \
306 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
308 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" uninstall-libvlcLTLIBRARIES || exit \$\$?; \
311 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
312 for mod in \$(mods); do \
314 in *\ \$\${mod}\ *) \
315 echo rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" ; \
316 rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" || true; \
325 if grep '^nodist_SOURCES_'${mod}'' < "${modf}" >/dev/null 2>&1; then
328 cat >> m4/private.m4 << EOF
329 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
331 # Generation of modules/**/Makefile.am
332 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
334 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
335 # the resulting file size.
336 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
337 # work properly with any automake version I tested.
338 cat >> "${makf}" << EOF
342 cat >> "${makf}" << EOF
343 lib${mod}_plugin_la_SOURCES = \$(SOURCES_${mod})
345 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
346 nodist_lib${mod}_plugin_la_SOURCES = \$(nodist_SOURCES_${mod})
347 CLEANFILES += "\$(nodist_SOURCES_${mod})"
348 BUILT_SOURCES += \$(B${mod})
351 cat >> "${makf}" << EOF
352 lib${mod}_plugin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
353 lib${mod}_plugin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
354 lib${mod}_plugin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
355 lib${mod}_plugin_la_LDFLAGS = \`\$(VLC_CONFIG) --libs plugin ${mod}\` \$(AM_LDFLAGS)
356 lib${mod}_plugin_la_LIBADD = \$(AM_LIBADD)
361 cat >> m4/private.m4 << EOF
367 ### classic bootstrap stuff
371 # remove autotools cruft
372 rm -f aclocal.m4 configure config.log config.h config.h.in
373 rm -Rf autom4te*.cache
374 # remove old autotools extra cruft
375 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
376 # remove new autotools extra cruft
379 # remove libtool cruft
380 rm -f ltmain.sh libtool ltconfig
381 # remove gettext cruft
385 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
387 # Automake complains if these are not present
388 rm -f vlc-config.in && printf "" > vlc-config.in
389 if [ "$GETTEXT" != "yes" ]; then
390 test -d intl || mkdir intl
391 printf "" > intl/Makefile.am
392 printf "" > ABOUT-NLS
395 # Libtoolize directory
396 ${libtoolize} --copy --force
397 if test -f "ltmain.sh"; then
398 echo "$0: working around a minor libtool issue"
399 mv ltmain.sh autotools/
402 # patch for DLL link for libtool on cygwin (remove when fixed)
403 if test ".`uname -s|sed -n '/^CYGWIN/p'`" != "."; then
404 patch -s -p0 << 'EOF'
405 --- autotools/ltmain.orig 2006-12-05 15:15:42.064607000 +0000
406 +++ autotools/ltmain.sh 2006-12-05 15:16:24.705777800 +0000
407 @@ -4360,7 +4360,7 @@
411 - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
412 + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,;s,.dll.exe$,.dll,'` ;;
414 if test -n "$vinfo"; then
415 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
421 ${aclocal} ${ACLOCAL_ARGS}
424 ${automake} --add-missing --copy -Wall
427 ## files which need to be regenerated
429 rm -f vlc-config.in vlc-config
430 rm -f src/misc/modules_builtin.h
436 ## Tell the user about gettext, pkg-config and sed
438 if [ "${GETTEXT}" = "old" ]; then
441 ==========================================================
442 NOTE: you have an old version of gettext installed on your
443 system. The vlc build will work, but if your system does not
444 have libintl you will not have internationalization support.
445 We suggest upgrading to gettext 0.11.5 or later.
449 if [ "$PKGCONFIG" = "no" ]; then
452 ==============================================================
453 NOTE: you do not have the "pkg-config" utility on your system;
454 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be