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.8 --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.9 --version >/dev/null 2>&1; then
59 # If we also have 1.6 (>> 1.6.1), use it instead because it is faster
60 if 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
65 elif automake-1.7 --version >/dev/null 2>&1; then
67 # If we also have 1.6 (>> 1.6.1), use it instead because it is faster
68 if automake-1.6 --version >/dev/null 2>&1; then
69 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1; then
73 elif automake-1.6 --version >/dev/null 2>&1; then
75 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1; then
78 elif automake-1.5 --version >/dev/null 2>&1; then
81 elif automake --version > /dev/null 2>&1; then
83 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
84 0|0.*|1|1.[01234]|1.[01234][-.]*)
95 if test "${amvers}" = "none"; then
97 echo "you need automake version 1.5 or later"
102 if gettextize --version >/dev/null 2>&1; then
103 # Autopoint is available from 0.11.3, but we need 0.11.5
104 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
105 '>=' 0.11.5 >/dev/null 2>&1; then
106 # We have gettext, and a recent version! Everything is cool.
110 # User's gettext is too old. try to continue anyway.
114 # we don't have gettext. grmbl. try to continue anyway.
119 # Check for pkg-config
120 if pkg-config --version >/dev/null 2>&1; then
121 # We have pkg-config, everything is cool.
127 aclocal=aclocal${amvers}
128 automake=automake${amvers}
130 autoheader=autoheader
133 ## Generate the modules makefile, by parsing modules/**/Modules.am
137 echo "generating modules/**/Makefile.am and m4/private.m4"
139 # Prepare m4/private.m4
140 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
141 dnl Private VLC macros - generated by bootstrap
145 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
146 dnl User does not have pkg-config, so this is a no-op
147 AC_DEFUN([PKG_CHECK_MODULES], [:], [], [], [])
152 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
153 dnl User does not have gettext, so this is a no-op
154 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
159 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
160 dnl The required AM_CONDITIONAL calls
161 dnl XXX: too many conditionals make the build very slow, disabled them
162 AC_DEFUN([VLC_CONDITIONALS], [
164 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
165 dnl The required AC_SUBST calls
166 AC_DEFUN([VLC_SUBSTS], [
168 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
169 dnl The required AC_OUTPUT calls
170 dnl XXX: this feature is only supported starting from automake-1.7
171 AC_DEFUN([VLC_MAKEFILES], [AC_OUTPUT([
173 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
174 dnl Helper macro for vlc-config generation
175 AC_DEFUN([VLC_CONFIG_HELPER], [
176 cat >> vlc-config.in << BLAH
181 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
182 # Autogenerated by bootstrap - DO NOT EDIT
184 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
185 #DIST_SUBDIRS = \$(SUBDIRS)
188 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
191 mf="modules/${dir}/Modules.am"
192 basedir="`echo "${dir}" | cut -f1 -d/`"
193 # automake will not recurse for make dist if we don't define SUBDIRS = .
194 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
195 rm -f modules/${dir}/Makefile.am && cat > modules/${dir}/Makefile.am << EOF
197 # Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead
203 EXTRA_DIST = Modules.am
206 #DIST_SUBDIRS = \$(SUBDIRS)
207 libvlcdir = \$(libdir)/vlc/${basedir}
212 # There's no need for pic code on win32 so get rid of this to substantially
213 # reduce the compilation time.
221 -rm -f *.a *.so *.dll *.sl *.dylib
225 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
226 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; \\
227 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; \\
228 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; \\
229 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
233 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
235 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
238 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
241 # cat >> m4/private.m4-tmp1 << EOF
242 #dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
243 #dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
245 cat >> m4/private.m4-tmp4 << EOF
246 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
248 # Generation of modules/**/Makefile.am
249 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
250 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
251 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
252 # the resulting file size.
253 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
254 # work properly with any automake version I tested.
255 cat >> modules/${dir}/Makefile.am << EOF
259 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
260 clean-local: clean-${mod}
262 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
266 cat >> modules/${dir}/Makefile.am << EOF
268 L${mod}p = lib${mod}_plugin.a
269 D${mod}p = lib${mod}_plugin\$(LIBEXT)
270 L${mod}b = lib${mod}.a
271 L${mod}pic = lib${mod}_pic.a
273 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
274 B${mod} = \$(nodist_SOURCES_${mod})
277 cat >> modules/${dir}/Makefile.am << EOF
281 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
282 ${PRIVATE}BUILT_SOURCES += \$(B${mod})
285 cat >> modules/${dir}/Makefile.am << EOF
286 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
288 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
289 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
292 cat >> modules/${dir}/Makefile.am << EOF
293 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
294 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
295 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
297 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
299 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
300 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
303 cat >> modules/${dir}/Makefile.am << EOF
304 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
305 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
306 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
308 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
310 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
311 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
314 cat >> modules/${dir}/Makefile.am << EOF
315 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
316 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
317 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
319 libvlc_LIBRARIES += \$(L${mod}b) \$(L${mod}pic)
320 lib${mod}_DATA = \$(D${mod}p)
322 lib${mod}dir = \$(libdir)/vlc/${topdir}
323 ${PRIVATE}noinst_LIBRARIES += \$(L${mod}p)
324 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
325 ${PRIVATE} @case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
326 ${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}\` ;; \\
327 ${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}\` ;; \\
328 ${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}\` ;; \\
336 cat >> m4/private.m4-tmp1 << EOF
337 AM_CONDITIONAL(UNTRUE, false)
340 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
341 cat >> m4/private.m4-tmp2 << EOF
344 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
345 cat >> m4/private.m4-tmp3 << EOF
348 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
349 cat >> m4/private.m4-tmp4 << EOF
353 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
358 ### classic bootstrap stuff
362 # remove autotools cruft
363 rm -f aclocal.m4 configure config.log config.h config.h.in
364 rm -Rf autom4te.cache
365 # remove old autotools extra cruft
366 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
367 # remove new autotools extra cruft
370 # remove libtool cruft
371 rm -f ltmain.sh libtool ltconfig
372 # remove gettext cruft
375 # remove old vlc cruft
376 rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
377 # remove new vlc cruft
378 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
380 # Automake complains if these are not present
381 rm -f vlc-config.in && printf "" > vlc-config.in
382 if [ "$GETTEXT" != "yes" ]; then
383 test -d intl || mkdir intl
384 printf "" > intl/Makefile.am
385 printf "" > ABOUT-NLS
390 ${aclocal} ${ACLOCAL_ARGS}
393 ${automake} --add-missing --copy
396 ## files which need to be regenerated
398 rm -f vlc-config.in vlc-config
399 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
400 rm -f include/vlc_symbols.h
401 rm -f mozilla/vlcintf.h
407 ## Tell the user about gettext, pkg-config and sed
413 ===========================================================
414 IMPORTANT NOTE: you do not have gettext installed on your
415 system. The vlc build will work, but you will not have
416 internationalization support. We suggest installing gettext.
421 ==========================================================
422 NOTE: you have an old version of gettext installed on your
423 system. The vlc build will work, but if your system does not
424 have libintl you will not have internationalization support.
425 We suggest upgrading to gettext 0.11.5 or later.
434 ==============================================================
435 NOTE: you do not have the "pkg-config" utility on your system;
436 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
442 case "$AUTOMAKESUCKS" in
446 =============================================================
447 IMPORTANT NOTE: your version of automake has a bug which will
448 prevent proper plugin compilation. Either compile VLC with
449 the --disable-plugins flag, or use a version of automake newer
450 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
455 case "$INSTALLSUCKS" in
459 =============================================================
460 IMPORTANT NOTE: your version of automake has a bug which will
461 prevent proper installation. Do not use "make install" with this
462 version of automake, or use a version of automake newer than 1.5
463 (such as 1.6 or 1.7).