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 ACLOCAL_ARGS="${ACLOCAL_ARGS} -I extras/contrib/share/aclocal"
40 if test ".`uname -s`" = ".Darwin"; then
41 export LD_LIBRARY_PATH=./extras/contrib/lib:$LD_LIBRARY_PATH
42 export DYLD_LIBRARY_PATH=./extras/contrib/lib:$DYLD_LIBRARY_PATH
43 elif test ".`uname -s`" = ".BeOS"; then
44 export LIBRARY_PATH=./extras/contrib/lib:$LIBRARY_PATH
45 export BELIBRARIES=./extras/contrib/lib:$BELIBRARIES
51 if automake-1.9 --version >/dev/null 2>&1; then
53 elif automake-1.8 --version >/dev/null 2>&1; then
55 elif automake-1.7 --version >/dev/null 2>&1; then
57 elif automake-1.6 --version >/dev/null 2>&1; then
59 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1; then
62 elif automake-1.5 --version >/dev/null 2>&1; then
65 elif automake --version > /dev/null 2>&1; then
67 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
68 0|0.*|1|1.[01234]|1.[01234][-.]*)
79 if test "${amvers}" = "none"; then
81 echo "you need automake version 1.5 or later"
86 if gettextize --version >/dev/null 2>&1; then
87 # Autopoint is available from 0.11.3, but we need 0.11.5
88 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
89 '>=' 0.11.5 >/dev/null 2>&1; then
90 # We have gettext, and a recent version! Everything is cool.
94 # User's gettext is too old. try to continue anyway.
98 # we don't have gettext. grmbl. try to continue anyway.
103 # Check for pkg-config
104 if pkg-config --version >/dev/null 2>&1; then
105 # We have pkg-config, everything is cool.
111 aclocal=aclocal${amvers}
112 automake=automake${amvers}
114 autoheader=autoheader
117 ## Generate the modules makefile, by parsing modules/**/Modules.am
121 echo "generating modules/**/Makefile.am and m4/private.m4"
123 # Prepare m4/private.m4
124 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
125 dnl Private VLC macros - generated by bootstrap
129 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
130 dnl User does not have pkg-config, so this is a no-op
131 AC_DEFUN([PKG_CHECK_MODULES], [:], [], [], [])
136 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
137 dnl User does not have gettext, so this is a no-op
138 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
143 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
144 dnl The required AM_CONDITIONAL calls
145 dnl XXX: too many conditionals make the build very slow, disabled them
146 AC_DEFUN([VLC_CONDITIONALS], [
148 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
149 dnl The required AC_SUBST calls
150 AC_DEFUN([VLC_SUBSTS], [
152 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
153 dnl The required AC_OUTPUT calls
154 dnl XXX: this feature is only supported starting from automake-1.7
155 AC_DEFUN([VLC_MAKEFILES], [AC_OUTPUT([
157 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
158 dnl Helper macro for vlc-config generation
159 AC_DEFUN([VLC_CONFIG_HELPER], [
160 cat >> vlc-config.in << BLAH
165 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
166 # Autogenerated by bootstrap - DO NOT EDIT
168 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
171 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
174 modf="modules/${dir}/Modules.am"
175 makf="modules/${dir}/Makefile.am"
176 basedir="`echo "${dir}" | cut -f1 -d/`"
177 # automake will not recurse for make dist if we don't define SUBDIRS = .
178 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
179 mods="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | xargs`"
183 extra_libs="${extra_libs} lib${mod}_plugin.a"
184 extra_libs="${extra_libs} lib${mod}.a lib${mod}_pic.a"
186 rm -f "${makf}" && cat > "${makf}" << EOF
188 # ${makf} automatically generated from ${modf} by bootstrap
189 # DO NOT EDIT - edit Modules.am or \$(top_srcdir)/bootstrap instead
198 EXTRA_DIST = Modules.am
201 SUFFIXES = _plugin\$(LIBEXT) _plugin.a
202 ### TODO ought to be defined somewhere else
204 libvlcdir = \$(libdir)/vlc/\$(basedir)
206 EXTRA_LIBRARIES = ${extra_libs}
213 ### There's no need for pic code on win32 so get rid of this to substantially
214 ### reduce the compilation time.
221 # Find out which modules were enabled and tell make to build them
223 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
224 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; \\
225 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; \\
226 if test "\$(pic)" != "no"; then z=\$\$(\$(VLC_CONFIG) --list builtin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_pic.a;; esac; done; fi; \\
227 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
230 # Build a plugin with the adequate linker and linker's flags
231 _plugin.a_plugin\$(LIBEXT):
232 @mod="\$*" ; mod=\$\${mod:3} ; \
233 ldfl="\`\$(VLC_CONFIG) --libs plugin \$\$mod\` -u \$(SYMPREF)\$(VLC_ENTRY)" ; \
234 case \`\$(VLC_CONFIG) --linkage \$\$mod\` in \\
235 c++) ld="\$(CXXLINK)" ;; \
236 objc) ld="\$(OBJCLINK)" ;; \
237 c|*) ld="\$(LINK)" ;; \
239 echo \$\$ld \$< \$\$ldfl ; \
242 \$(srcdir)/Makefile.am: \$(srcdir)/Modules.am \$(top_srcdir)/bootstrap
243 cd \$(top_srcdir) && \$(SHELL) ./bootstrap
246 -rm -f *.a *\$(LIBEXT)
248 ### automake creates libvlcdir after running install-*-local
249 ### so we have to create it ourselves first
250 install-exec-local: all-modules
251 mkdir -p -- "\$(DESTDIR)\$(libvlcdir)"
252 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
253 for mod in \$(mods); do \
255 in *\ \$\${mod}\ *) \
256 echo \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" ; \
257 \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
261 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
262 for mod in \$(mods); do \
264 in *\ \$\${mod}\ *) \
265 echo \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
266 \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" || exit \$\$?; \
271 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
272 for mod in \$(mods); do \
274 in *\ \$\${mod}\ *) \
275 echo \$(INSTALL_DATA) "lib\$\${mod}_pic.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
276 \$(INSTALL_DATA) "lib\$\${mod}_pic.a" "\$(DESTDIR)\$(libdir)/vlc/" || exit \$\$?; \
283 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
284 for mod in \$(mods); do \
286 in *\ \$\${mod}\ *) \
287 echo rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" ; \
288 rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" || true; \
292 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
293 for mod in \$(mods); do \
295 in *\ \$\${mod}\ *) \
296 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" ; \
297 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" || true; \
302 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
303 for mod in \$(mods); do \
305 in *\ \$\${mod}\ *) \
306 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}_pic.a" ; \
307 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}_pic.a" || true; \
316 if grep '^nodist_SOURCES_'${mod}'' < "${modf}" >/dev/null 2>&1; then
319 cat >> m4/private.m4-tmp4 << EOF
320 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
322 # Generation of modules/**/Makefile.am
323 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
324 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
325 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
326 # the resulting file size.
327 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
328 # work properly with any automake version I tested.
329 cat >> "${makf}" << EOF
333 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
334 clean-local: clean-${mod}
336 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
340 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
341 BUILT_SOURCES += \$(B${mod})
344 cat >> "${makf}" << EOF
345 lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
347 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
348 nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
351 cat >> "${makf}" << EOF
352 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
353 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
354 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
356 lib${mod}_pic_a_SOURCES = \$(SOURCES_${mod})
358 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
359 nodist_lib${mod}_pic_a_SOURCES = \$(nodist_SOURCES_${mod})
362 cat >> "${makf}" << EOF
363 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
364 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
365 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
367 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
369 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
370 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
373 cat >> "${makf}" << EOF
374 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
375 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
376 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
382 cat >> m4/private.m4-tmp1 << EOF
385 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
386 cat >> m4/private.m4-tmp2 << EOF
389 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
390 cat >> m4/private.m4-tmp3 << EOF
393 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
394 cat >> m4/private.m4-tmp4 << EOF
398 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
403 ### classic bootstrap stuff
407 # remove autotools cruft
408 rm -f aclocal.m4 configure config.log config.h config.h.in
409 rm -Rf autom4te.cache
410 # remove old autotools extra cruft
411 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
412 # remove new autotools extra cruft
415 # remove libtool cruft
416 rm -f ltmain.sh libtool ltconfig
417 # remove gettext cruft
420 # remove old vlc cruft
421 rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
422 # remove new vlc cruft
423 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
425 # Automake complains if these are not present
426 rm -f vlc-config.in && printf "" > vlc-config.in
427 if [ "$GETTEXT" != "yes" ]; then
428 test -d intl || mkdir intl
429 printf "" > intl/Makefile.am
430 printf "" > ABOUT-NLS
435 ${aclocal} ${ACLOCAL_ARGS}
438 ${automake} --add-missing --copy
441 ## files which need to be regenerated
443 rm -f vlc-config.in vlc-config
444 rm -f src/misc/modules_builtin.h
445 rm -f mozilla/vlcintf.h
451 ## Tell the user about gettext, pkg-config and sed
457 ===========================================================
458 IMPORTANT NOTE: you do not have gettext installed on your
459 system. The vlc build will work, but you will not have
460 internationalization support. We suggest installing gettext.
465 ==========================================================
466 NOTE: you have an old version of gettext installed on your
467 system. The vlc build will work, but if your system does not
468 have libintl you will not have internationalization support.
469 We suggest upgrading to gettext 0.11.5 or later.
478 ==============================================================
479 NOTE: you do not have the "pkg-config" utility on your system;
480 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
486 case "$AUTOMAKESUCKS" in
490 =============================================================
491 IMPORTANT NOTE: your version of automake has a bug which will
492 prevent proper plugin compilation. Either compile VLC with
493 the --disable-plugins flag, or use a version of automake newer
494 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
499 case "$INSTALLSUCKS" in
503 =============================================================
504 IMPORTANT NOTE: your version of automake has a bug which will
505 prevent proper installation. Do not use "make install" with this
506 version of automake, or use a version of automake newer than 1.5
507 (such as 1.6 or 1.7).