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 export LD_LIBRARY_PATH=./extras/contrib/lib:$LD_LIBRARY_PATH
38 export DYLD_LIBRARY_PATH=./extras/contrib/lib:$DYLD_LIBRARY_PATH
39 ACLOCAL_ARGS="${ACLOCAL_ARGS} -I extras/contrib/share/aclocal"
44 if automake-1.7 --version >/dev/null 2>&1; then
46 # If we also have 1.6 (>> 1.6.1), use it instead because it is faster
47 if automake-1.6 --version >/dev/null 2>&1; then
48 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1; then
52 elif automake-1.6 --version >/dev/null 2>&1; then
54 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.5 --version >/dev/null 2>&1; then
60 elif automake --version > /dev/null 2>&1; then
62 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
63 0|0.*|1|1.[01234]|1.[01234][-.]*)
72 if test "${amvers}" = "none"; then
74 echo "you need automake version 1.5 or later"
79 if gettextize --version >/dev/null 2>&1; then
80 # Autopoint is available from 0.11.3, but we need 0.11.5
81 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
82 '>=' 0.11.5 >/dev/null 2>&1; then
83 # We have gettext, and a recent version! Everything is cool.
87 # User's gettext is too old. try to continue anyway.
91 # we don't have gettext. grmbl. try to continue anyway.
96 # Check for pkg-config
97 if pkg-config --version >/dev/null 2>&1; then
98 # We have pkg-config, everything is cool.
104 aclocal=aclocal${amvers}
105 automake=automake${amvers}
107 autoheader=autoheader
110 ## Generate the modules makefile, by parsing modules/**/Modules.am
114 echo "generating modules/**/Makefile.am and m4/private.m4"
116 # Prepare m4/private.m4
117 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
118 dnl Private VLC macros - generated by bootstrap
122 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
123 dnl User does not have pkg-config, so this is a no-op
124 AC_DEFUN([PKG_CHECK_MODULES], [:], [], [], [])
129 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
130 dnl User does not have gettext, so this is a no-op
131 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
136 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
137 dnl The required AM_CONDITIONAL calls
138 dnl XXX: too many conditionals make the build very slow, disabled them
139 AC_DEFUN([VLC_CONDITIONALS], [
141 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
142 dnl The required AC_SUBST calls
143 AC_DEFUN([VLC_SUBSTS], [
145 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
146 dnl The required AC_OUTPUT calls
147 dnl XXX: this feature is only supported starting from automake-1.7
148 AC_DEFUN([VLC_MAKEFILES], [AC_OUTPUT([
150 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
151 dnl Helper macro for vlc-config generation
152 AC_DEFUN([VLC_CONFIG_HELPER], [
153 cat >> vlc-config.in << BLAH
158 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
159 # Autogenerated by bootstrap - DO NOT EDIT
161 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
162 #DIST_SUBDIRS = \$(SUBDIRS)
165 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
168 mf="modules/${dir}/Modules.am"
169 basedir="`echo "${dir}" | cut -f1 -d/`"
170 # automake will not recurse for make dist if we don't define SUBDIRS = .
171 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
172 rm -f modules/${dir}/Makefile.am && cat > modules/${dir}/Makefile.am << EOF
174 # Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead
180 EXTRA_DIST = Modules.am
183 #DIST_SUBDIRS = \$(SUBDIRS)
184 libvlcdir = \$(libdir)/vlc/${basedir}
189 # There's no need for pic code on win32 so get rid of this to substantially
190 # reduce the compilation time.
198 -rm -f *.a *.so *.dll *.sl *.dylib
202 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
203 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; \\
204 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; \\
205 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; \\
206 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
210 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
212 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
215 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
218 # cat >> m4/private.m4-tmp1 << EOF
219 #dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
220 #dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
222 cat >> m4/private.m4-tmp4 << EOF
223 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
225 # Generation of modules/**/Makefile.am
226 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
228 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
229 # the resulting file size.
230 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
231 # work properly with any automake version I tested.
232 cat >> modules/${dir}/Makefile.am << EOF
236 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
237 clean-local: clean-${mod}
239 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
243 cat >> modules/${dir}/Makefile.am << EOF
245 L${mod}p = lib${mod}_plugin.a
246 D${mod}p = lib${mod}_plugin\$(LIBEXT)
247 L${mod}b = lib${mod}.a
248 L${mod}pic = lib${mod}_pic.a
250 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
251 B${mod} = \$(nodist_SOURCES_${mod})
254 cat >> modules/${dir}/Makefile.am << EOF
258 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
259 ${PRIVATE}BUILT_SOURCES += \$(B${mod})
262 cat >> modules/${dir}/Makefile.am << EOF
263 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
265 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
266 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
269 cat >> modules/${dir}/Makefile.am << EOF
270 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
271 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
272 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
274 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
276 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
277 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
280 cat >> modules/${dir}/Makefile.am << EOF
281 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
282 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
283 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
285 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
287 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
288 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
291 cat >> modules/${dir}/Makefile.am << EOF
292 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
293 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
294 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
296 libvlc_LIBRARIES += \$(L${mod}b) \$(L${mod}pic)
297 lib${mod}_DATA = \$(D${mod}p)
299 lib${mod}dir = \$(libdir)/vlc/${topdir}
300 ${PRIVATE}noinst_LIBRARIES += \$(L${mod}p)
301 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
302 ${PRIVATE} @case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
303 ${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}\` ;; \\
304 ${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}\` ;; \\
305 ${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}\` ;; \\
313 cat >> m4/private.m4-tmp1 << EOF
314 AM_CONDITIONAL(UNTRUE, false)
317 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
318 cat >> m4/private.m4-tmp2 << EOF
321 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
322 cat >> m4/private.m4-tmp3 << EOF
325 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
326 cat >> m4/private.m4-tmp4 << EOF
330 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
335 ### classic bootstrap stuff
339 # remove autotools cruft
340 rm -f aclocal.m4 configure config.log config.h config.h.in
341 rm -Rf autom4te.cache
342 # remove old autotools extra cruft
343 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
344 # remove new autotools extra cruft
345 (cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh)
346 # remove libtool cruft
347 rm -f ltmain.sh libtool ltconfig
348 # remove gettext cruft
351 # remove old vlc cruft
352 rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
353 # remove new vlc cruft
354 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
356 # Automake complains if these are not present
357 rm -f vlc-config.in && printf "" > vlc-config.in
358 if [ "$GETTEXT" != "yes" ]; then
359 test -d intl || mkdir intl
360 printf "" > intl/Makefile.am
361 printf "" > ABOUT-NLS
366 ${aclocal} ${ACLOCAL_ARGS}
369 ${automake} --add-missing --copy
372 ## files which need to be regenerated
374 rm -f vlc-config.in vlc-config
375 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
376 rm -f include/vlc_symbols.h
377 rm -f mozilla/vlcintf.h
383 ## Tell the user about gettext, pkg-config and sed
389 ===========================================================
390 IMPORTANT NOTE: you do not have gettext installed on your
391 system. The vlc build will work, but you will not have
392 internationalization support. We suggest installing gettext.
397 ==========================================================
398 NOTE: you have an old version of gettext installed on your
399 system. The vlc build will work, but if your system does not
400 have libintl you will not have internationalization support.
401 We suggest upgrading to gettext 0.11.5 or later.
410 ==============================================================
411 NOTE: you do not have the "pkg-config" utility on your system;
412 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
418 case "$AUTOMAKESUCKS" in
422 =============================================================
423 IMPORTANT NOTE: your version of automake has a bug which will
424 prevent proper plugin compilation. Either compile VLC with
425 the --disable-plugins flag, or use a version of automake newer
426 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
431 case "$INSTALLSUCKS" in
435 =============================================================
436 IMPORTANT NOTE: your version of automake has a bug which will
437 prevent proper installation. Do not use "make install" with this
438 version of automake, or use a version of automake newer than 1.5
439 (such as 1.6 or 1.7).