3 ## bootstrap file for the VLC media player
6 ## Copyright (C) 2005 the VideoLAN team
8 ## Initial author: Sam Hocevar <sam@zoy.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
36 # Check for contrib directory
37 if test -d extras/contrib/bin; then
38 export PATH=./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
53 if automake-1.9 --version >/dev/null 2>&1; then
55 elif automake-1.8 --version >/dev/null 2>&1; then
57 elif automake-1.7 --version >/dev/null 2>&1; then
59 elif automake-1.6 --version >/dev/null 2>&1; then
61 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1; then
64 elif automake-1.5 --version >/dev/null 2>&1; then
67 elif automake --version > /dev/null 2>&1; then
69 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
70 0|0.*|1|1.[01234]|1.[01234][-.]*)
81 if test "${amvers}" = "none"; then
83 echo "you need automake version 1.5 or later"
88 if gettextize --version >/dev/null 2>&1; then
89 # Autopoint is available from 0.11.3, but we need 0.11.5
90 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
91 '>=' 0.11.5 >/dev/null 2>&1; then
92 # We have gettext, and a recent version! Everything is cool.
96 # User's gettext is too old. try to continue anyway.
101 echo "you need gettextize (package gettext-devel or gettext)"
105 # Check for pkg-config
106 if pkg-config --version >/dev/null 2>&1; then
107 # We have pkg-config, everything is cool.
113 aclocal=aclocal${amvers}
114 automake=automake${amvers}
116 autoheader=autoheader
119 ## Generate the modules makefile, by parsing modules/**/Modules.am
123 echo "generating modules/**/Makefile.am and m4/private.m4"
125 # Prepare m4/private.m4
126 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
127 dnl Private VLC macros - generated by bootstrap
131 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
132 dnl User does not have pkg-config, so assume package was not found
133 AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
138 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
139 dnl User does not have gettext, so this is a no-op
140 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
145 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
146 dnl The required AM_CONDITIONAL calls
147 dnl XXX: too many conditionals make the build very slow, disabled them
148 AC_DEFUN([VLC_CONDITIONALS], [
150 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
151 dnl The required AC_SUBST calls
152 AC_DEFUN([VLC_SUBSTS], [
154 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
155 dnl The required AC_OUTPUT calls
156 dnl XXX: this feature is only supported starting from automake-1.7
157 AC_DEFUN([VLC_MAKEFILES], [AC_OUTPUT([
159 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
160 dnl Helper macro for vlc-config generation
161 AC_DEFUN([VLC_CONFIG_HELPER], [
162 cat >> vlc-config.in << BLAH
167 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
168 # Autogenerated by bootstrap - DO NOT EDIT
170 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
173 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
176 modf="modules/${dir}/Modules.am"
177 makf="modules/${dir}/Makefile.am"
178 basedir="`echo "${dir}" | cut -f1 -d/`"
179 # automake will not recurse for make dist if we don't define SUBDIRS = .
180 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
181 mods="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | xargs`"
185 extra_libs="${extra_libs} lib${mod}_plugin.a"
186 extra_libs="${extra_libs} lib${mod}.a lib${mod}_pic.a"
188 rm -f "${makf}" && cat > "${makf}" << EOF
190 # ${makf} automatically generated from ${modf} by bootstrap
191 # DO NOT EDIT - edit Modules.am or \$(top_srcdir)/bootstrap instead
200 EXTRA_DIST = Modules.am
203 SUFFIXES = _plugin\$(LIBEXT) _plugin.a
205 libvlcdir = \$(libdir)/vlc/\$(basedir)
207 EXTRA_LIBRARIES = ${extra_libs}
212 # Find out which modules were enabled and tell make to build them
214 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
215 if test "\$(plugin)" != "no"; then z=\$\$(\$(VLC_CONFIG) --list plugin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_plugin\$(LIBEXT);; esac; done; fi; \\
216 if test "\$(builtin)" != "no"; then z=\$\$(\$(VLC_CONFIG) --list builtin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}.a;; esac; done; fi; \\
217 if test "\$(pic)" = "pic"; then z=\$\$(\$(VLC_CONFIG) --list builtin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_pic.a;; esac; done; fi; \\
218 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
221 # Build a plugin with the adequate linker and linker's flags
222 _plugin.a_plugin\$(LIBEXT):
223 @mod="\$*" ; mod=\$\${mod#lib} ; \
224 ldfl="\`\$(VLC_CONFIG) --libs plugin \$\$mod\` -u \$(SYMPREF)\$(VLC_ENTRY)" ; \
225 case \`\$(VLC_CONFIG) --linkage \$\$mod\` in \\
226 c++) ld="\$(CXXLINK)" ;; \
227 objc) ld="\$(OBJCLINK)" ;; \
228 c|*) ld="\$(LINK)" ;; \
230 echo \$\$ld \$< \$\$ldfl ; \
234 \$(srcdir)/Makefile.am: \$(srcdir)/Modules.am \$(top_srcdir)/bootstrap
235 cd \$(top_srcdir) && \$(SHELL) ./bootstrap
239 -rm -f *.a *\$(LIBEXT)
241 ### automake creates libvlcdir after running install-*-local
242 ### so we have to create it ourselves first
243 install-exec-local: all-modules
244 mkdir -p -- "\$(DESTDIR)\$(libvlcdir)"
245 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
246 for mod in \$(mods); do \
248 in *\ \$\${mod}\ *) \
249 echo \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" ; \
250 \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
254 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
255 for mod in \$(mods); do \
257 in *\ \$\${mod}\ *) \
258 echo \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
259 \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" || exit \$\$?; \
264 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
265 for mod in \$(mods); do \
267 in *\ \$\${mod}\ *) \
268 echo \$(INSTALL_DATA) "lib\$\${mod}_pic.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
269 \$(INSTALL_DATA) "lib\$\${mod}_pic.a" "\$(DESTDIR)\$(libdir)/vlc/" || exit \$\$?; \
276 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
277 for mod in \$(mods); do \
279 in *\ \$\${mod}\ *) \
280 echo rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" ; \
281 rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" || true; \
285 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
286 for mod in \$(mods); do \
288 in *\ \$\${mod}\ *) \
289 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" ; \
290 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" || true; \
295 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
296 for mod in \$(mods); do \
298 in *\ \$\${mod}\ *) \
299 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}_pic.a" ; \
300 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}_pic.a" || true; \
309 if grep '^nodist_SOURCES_'${mod}'' < "${modf}" >/dev/null 2>&1; then
312 cat >> m4/private.m4-tmp4 << EOF
313 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
315 # Generation of modules/**/Makefile.am
316 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
317 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
318 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
319 # the resulting file size.
320 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
321 # work properly with any automake version I tested.
322 cat >> "${makf}" << EOF
326 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
327 clean-local: clean-${mod}
329 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
333 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
334 BUILT_SOURCES += \$(B${mod})
337 cat >> "${makf}" << EOF
338 lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
340 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
341 nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
344 cat >> "${makf}" << EOF
345 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
346 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
347 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
349 lib${mod}_pic_a_SOURCES = \$(SOURCES_${mod})
351 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
352 nodist_lib${mod}_pic_a_SOURCES = \$(nodist_SOURCES_${mod})
355 cat >> "${makf}" << EOF
356 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
357 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
358 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
360 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
362 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
363 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
366 cat >> "${makf}" << EOF
367 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
368 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
369 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
375 cat >> m4/private.m4-tmp1 << EOF
378 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
379 cat >> m4/private.m4-tmp2 << EOF
382 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
383 cat >> m4/private.m4-tmp3 << EOF
386 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
387 cat >> m4/private.m4-tmp4 << EOF
391 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
396 ### classic bootstrap stuff
400 # remove autotools cruft
401 rm -f aclocal.m4 configure config.log config.h config.h.in
402 rm -Rf autom4te*.cache
403 # remove old autotools extra cruft
404 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
405 # remove new autotools extra cruft
408 # remove libtool cruft
409 rm -f ltmain.sh libtool ltconfig
410 # remove gettext cruft
413 # remove old vlc cruft
414 rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
415 # remove new vlc cruft
416 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
418 # Automake complains if these are not present
419 rm -f vlc-config.in && printf "" > vlc-config.in
420 if [ "$GETTEXT" != "yes" ]; then
421 test -d intl || mkdir intl
422 printf "" > intl/Makefile.am
423 printf "" > ABOUT-NLS
428 ${aclocal} ${ACLOCAL_ARGS}
431 ${automake} --add-missing --copy
434 ## files which need to be regenerated
436 rm -f vlc-config.in vlc-config
437 rm -f src/misc/modules_builtin.h
438 rm -f mozilla/vlcintf.h
444 ## Tell the user about gettext, pkg-config and sed
446 if [ "${GETTEXT}" = "old" ]; then
449 ==========================================================
450 NOTE: you have an old version of gettext installed on your
451 system. The vlc build will work, but if your system does not
452 have libintl you will not have internationalization support.
453 We suggest upgrading to gettext 0.11.5 or later.
457 if [ "$PKGCONFIG" = "no" ]; then
460 ==============================================================
461 NOTE: you do not have the "pkg-config" utility on your system;
462 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
467 if [ "$AUTOMAKESUCKS" = "yes" ]; then
470 =============================================================
471 IMPORTANT NOTE: your version of automake has a bug which will
472 prevent proper plugin compilation. Either compile VLC with
473 the --disable-plugins flag, or use a version of automake newer
474 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
478 if [ "$INSTALLSUCKS" = "yes" ]; then
481 =============================================================
482 IMPORTANT NOTE: your version of automake has a bug which will
483 prevent proper installation. Do not use "make install" with this
484 version of automake, or use a version of automake newer than 1.5
485 (such as 1.6 or 1.7).