3 ## bootstrap file for the VLC media player
6 ## Authors: Sam Hocevar <sam@zoy.org>
8 if test "$#" != "0"; then
10 echo " Calls automake, autoconf, autoheader, autopoint and other auto* to generate"
11 echo " m4 macros and prepare Makefiles."
16 ### Get a sane environment, just in case
27 ## Check for various tools
34 # Check for contrib directory
35 if test -d extras/contrib/bin; then
36 export PATH=./extras/contrib/bin:$PATH
37 ACLOCAL_ARGS="${ACLOCAL_ARGS} -I extras/contrib/share/aclocal"
38 if test ".`uname -s`" = ".Darwin"; then
39 export LD_LIBRARY_PATH=./extras/contrib/lib:$LD_LIBRARY_PATH
40 export DYLD_LIBRARY_PATH=./extras/contrib/lib:$DYLD_LIBRARY_PATH
41 elif test ".`uname -s`" = ".BeOS"; then
42 export LIBRARY_PATH=./extras/contrib/lib:$LIBRARY_PATH
43 export BELIBRARIES=./extras/contrib/lib:$BELIBRARIES
49 if automake-1.7 --version >/dev/null 2>&1; then
51 # If we also have 1.6 (>> 1.6.1), use it instead because it is faster
52 if automake-1.6 --version >/dev/null 2>&1; then
53 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /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][-.]*)
77 if test "${amvers}" = "none"; then
79 echo "you need automake version 1.5 or later"
84 if gettextize --version >/dev/null 2>&1; then
85 # Autopoint is available from 0.11.3, but we need 0.11.5
86 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
87 '>=' 0.11.5 >/dev/null 2>&1; then
88 # We have gettext, and a recent version! Everything is cool.
92 # User's gettext is too old. try to continue anyway.
96 # we don't have gettext. grmbl. try to continue anyway.
101 # Check for pkg-config
102 if pkg-config --version >/dev/null 2>&1; then
103 # We have pkg-config, everything is cool.
109 aclocal=aclocal${amvers}
110 automake=automake${amvers}
112 autoheader=autoheader
115 ## Generate the modules makefile, by parsing modules/**/Modules.am
119 echo "generating modules/**/Makefile.am and m4/private.m4"
121 # Prepare m4/private.m4
122 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
123 dnl Private VLC macros - generated by bootstrap
127 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
128 dnl User does not have pkg-config, so this is a no-op
129 AC_DEFUN([PKG_CHECK_MODULES], [:], [], [], [])
134 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
135 dnl User does not have gettext, so this is a no-op
136 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
141 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
142 dnl The required AM_CONDITIONAL calls
143 dnl XXX: too many conditionals make the build very slow, disabled them
144 AC_DEFUN([VLC_CONDITIONALS], [
146 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
147 dnl The required AC_SUBST calls
148 AC_DEFUN([VLC_SUBSTS], [
150 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
151 dnl The required AC_OUTPUT calls
152 dnl XXX: this feature is only supported starting from automake-1.7
153 AC_DEFUN([VLC_MAKEFILES], [AC_OUTPUT([
155 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
156 dnl Helper macro for vlc-config generation
157 AC_DEFUN([VLC_CONFIG_HELPER], [
158 cat >> vlc-config.in << BLAH
163 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
164 # Autogenerated by bootstrap - DO NOT EDIT
166 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
167 #DIST_SUBDIRS = \$(SUBDIRS)
170 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
173 mf="modules/${dir}/Modules.am"
174 basedir="`echo "${dir}" | cut -f1 -d/`"
175 # automake will not recurse for make dist if we don't define SUBDIRS = .
176 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
177 rm -f modules/${dir}/Makefile.am && cat > modules/${dir}/Makefile.am << EOF
179 # Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead
185 EXTRA_DIST = Modules.am
188 #DIST_SUBDIRS = \$(SUBDIRS)
189 libvlcdir = \$(libdir)/vlc/${basedir}
194 # There's no need for pic code on win32 so get rid of this to substantially
195 # reduce the compilation time.
203 -rm -f *.a *.so *.dll *.sl *.dylib
207 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
208 if test "\$(plugin)" != "no"; then z=\$\$(\$(VLC_CONFIG) --target plugin); for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf} | xargs`; do case "\$\$z" in */lib\$\${mod}_plugin*) echo lib\$\${mod}_plugin\$(LIBEXT);; esac; done; fi; \\
209 if test "\$(builtin)" != "no"; then z=\$\$(\$(VLC_CONFIG) --target builtin); for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf} | xargs`; do case "\$\$z" in */lib\$\${mod}.a*) echo lib\$\${mod}.a;; esac; done; fi; \\
210 if test "\$(pic)" != "no"; then z=\$\$(\$(VLC_CONFIG) --target builtin pic); for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf} | xargs`; do case "\$\$z" in */lib\$\${mod}_pic.a*) echo lib\$\${mod}_pic.a;; esac; done; fi; \\
211 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
215 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
217 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
220 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
223 # cat >> m4/private.m4-tmp1 << EOF
224 #dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
225 #dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
227 cat >> m4/private.m4-tmp4 << EOF
228 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
230 # Generation of modules/**/Makefile.am
231 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
233 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
234 # the resulting file size.
235 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
236 # work properly with any automake version I tested.
237 cat >> modules/${dir}/Makefile.am << EOF
241 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
242 clean-local: clean-${mod}
244 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
248 cat >> modules/${dir}/Makefile.am << EOF
250 L${mod}p = lib${mod}_plugin.a
251 D${mod}p = lib${mod}_plugin\$(LIBEXT)
252 L${mod}b = lib${mod}.a
253 L${mod}pic = lib${mod}_pic.a
255 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
256 B${mod} = \$(nodist_SOURCES_${mod})
259 cat >> modules/${dir}/Makefile.am << EOF
263 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
264 ${PRIVATE}BUILT_SOURCES += \$(B${mod})
267 cat >> modules/${dir}/Makefile.am << EOF
268 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
270 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
271 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
274 cat >> modules/${dir}/Makefile.am << EOF
275 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
276 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
277 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
279 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
281 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
282 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
285 cat >> modules/${dir}/Makefile.am << EOF
286 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
287 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
288 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
290 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
292 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
293 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
296 cat >> modules/${dir}/Makefile.am << EOF
297 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
298 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
299 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
301 libvlc_LIBRARIES += \$(L${mod}b) \$(L${mod}pic)
302 lib${mod}_DATA = \$(D${mod}p)
304 lib${mod}dir = \$(libdir)/vlc/${topdir}
305 ${PRIVATE}noinst_LIBRARIES += \$(L${mod}p)
306 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
307 ${PRIVATE} @case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
308 ${PRIVATE} c++) echo \$(CXXLINK) \$(lib${mod}_plugin_a_OBJECTS) \\\`\$(VLC_CONFIG) --libs plugin ${mod}\\\` ; \$(CXXLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
309 ${PRIVATE} objc) echo \$(OBJCLINK) \$(lib${mod}_plugin_a_OBJECTS) \\\`\$(VLC_CONFIG) --libs plugin ${mod}\\\` ; \$(OBJCLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
310 ${PRIVATE} c|*) echo \$(LINK) \$(lib${mod}_plugin_a_OBJECTS) \\\`\$(VLC_CONFIG) --libs plugin ${mod}\\\` ; \$(LINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
318 cat >> m4/private.m4-tmp1 << EOF
319 AM_CONDITIONAL(UNTRUE, false)
322 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
323 cat >> m4/private.m4-tmp2 << EOF
326 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
327 cat >> m4/private.m4-tmp3 << EOF
330 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
331 cat >> m4/private.m4-tmp4 << EOF
335 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
340 ### classic bootstrap stuff
344 # remove autotools cruft
345 rm -f aclocal.m4 configure config.log config.h config.h.in
346 rm -Rf autom4te.cache
347 # remove old autotools extra cruft
348 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
349 # remove new autotools extra cruft
352 # remove libtool cruft
353 rm -f ltmain.sh libtool ltconfig
354 # remove gettext cruft
357 # remove old vlc cruft
358 rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
359 # remove new vlc cruft
360 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
362 # Automake complains if these are not present
363 rm -f vlc-config.in && printf "" > vlc-config.in
364 if [ "$GETTEXT" != "yes" ]; then
365 test -d intl || mkdir intl
366 printf "" > intl/Makefile.am
367 printf "" > ABOUT-NLS
372 ${aclocal} ${ACLOCAL_ARGS}
375 ${automake} --add-missing --copy
378 ## files which need to be regenerated
380 rm -f vlc-config.in vlc-config
381 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
382 rm -f include/vlc_symbols.h
383 rm -f mozilla/vlcintf.h
389 ## Tell the user about gettext, pkg-config and sed
395 ===========================================================
396 IMPORTANT NOTE: you do not have gettext installed on your
397 system. The vlc build will work, but you will not have
398 internationalization support. We suggest installing gettext.
403 ==========================================================
404 NOTE: you have an old version of gettext installed on your
405 system. The vlc build will work, but if your system does not
406 have libintl you will not have internationalization support.
407 We suggest upgrading to gettext 0.11.5 or later.
416 ==============================================================
417 NOTE: you do not have the "pkg-config" utility on your system;
418 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
424 case "$AUTOMAKESUCKS" in
428 =============================================================
429 IMPORTANT NOTE: your version of automake has a bug which will
430 prevent proper plugin compilation. Either compile VLC with
431 the --disable-plugins flag, or use a version of automake newer
432 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
437 case "$INSTALLSUCKS" in
441 =============================================================
442 IMPORTANT NOTE: your version of automake has a bug which will
443 prevent proper installation. Do not use "make install" with this
444 version of automake, or use a version of automake newer than 1.5
445 (such as 1.6 or 1.7).