3 ## bootstrap file for the VLC media player
4 ## $Id: bootstrap,v 1.82 2003/11/06 10:09:16 sam Exp $
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 if automake-1.7 --version >/dev/null 2>&1; then
36 # If we also have 1.6 (>> 1.6.1), use it instead because it is faster
37 if automake-1.6 --version >/dev/null 2>&1; then
38 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1; then
42 elif automake-1.6 --version >/dev/null 2>&1; then
44 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1; then
47 elif automake-1.5 --version >/dev/null 2>&1; then
50 elif automake --version > /dev/null 2>&1; then
52 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
53 0|0.*|1|1.[01234]|1.[01234][-.]*)
62 if test "${amvers}" = "none"; then
64 echo "you need automake version 1.5 or later"
69 if gettextize --version >/dev/null 2>&1; then
70 # Autopoint is available from 0.11.3, but we need 0.11.5
71 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
72 '>=' 0.11.5 >/dev/null 2>&1; then
73 # We have gettext, and a recent version! Everything is cool.
77 # User's gettext is too old. try to continue anyway.
81 # we don't have gettext. grmbl. try to continue anyway.
86 # Check for pkg-config
87 if pkg-config --version >/dev/null 2>&1; then
88 # We have pkg-config, everything is cool.
94 aclocal=aclocal${amvers}
95 automake=automake${amvers}
100 ## Generate the modules makefile, by parsing modules/**/Modules.am
104 echo "generating modules/**/Makefile.am and m4/private.m4"
106 # Prepare m4/private.m4
107 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
108 dnl Private VLC macros - generated by bootstrap
112 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
113 dnl User does not have pkg-config, so this is a no-op
114 AC_DEFUN([PKG_CHECK_MODULES], [:], [], [], [])
119 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
120 dnl User does not have gettext, so this is a no-op
121 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
126 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
127 dnl The required AM_CONDITIONAL calls
128 dnl XXX: too many conditionals make the build very slow, disabled them
129 AC_DEFUN([AX_VLC_CONDITIONALS], [
131 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
132 dnl The required AC_SUBST calls
133 AC_DEFUN([AX_VLC_SUBSTS], [
135 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
136 dnl The required AC_OUTPUT calls
137 dnl XXX: this feature is only supported starting from automake-1.7
138 AC_DEFUN([AX_VLC_MAKEFILES], [AC_OUTPUT([
140 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
141 dnl Helper macro for vlc-config generation
142 AC_DEFUN([AX_VLC_CONFIG_HELPER], [
143 cat >> vlc-config.in << BLAH
148 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
149 # Autogenerated by bootstrap - DO NOT EDIT
151 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
152 #DIST_SUBDIRS = \$(SUBDIRS)
155 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
158 mf="modules/${dir}/Modules.am"
159 basedir="${dir%%\/*}"
160 # automake will not recurse for make dist if we don't define SUBDIRS = .
161 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
162 rm -f modules/${dir}/Makefile.am && cat > modules/${dir}/Makefile.am << EOF
164 # Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead
170 EXTRA_DIST = Modules.am
173 #DIST_SUBDIRS = \$(SUBDIRS)
174 libvlcdir = \$(libdir)/vlc/${basedir}
179 # There's no need for pic code on win32 so get rid of this to substantially
180 # reduce the compilation time.
188 -rm -f *.a *.so *.dll *.sl *.dylib
192 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
193 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; \\
194 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; \\
195 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; \\
196 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
200 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
202 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
205 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
208 # cat >> m4/private.m4-tmp1 << EOF
209 #dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
210 #dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
212 cat >> m4/private.m4-tmp4 << EOF
213 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
215 # Generation of modules/**/Makefile.am
216 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
217 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
218 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
219 # the resulting file size.
220 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
221 # work properly with any automake version I tested.
222 cat >> modules/${dir}/Makefile.am << EOF
226 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
227 clean-local: clean-${mod}
229 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
233 cat >> modules/${dir}/Makefile.am << EOF
235 L${mod}p = lib${mod}_plugin.a
236 D${mod}p = lib${mod}_plugin\$(LIBEXT)
237 L${mod}b = lib${mod}.a
238 L${mod}pic = lib${mod}_pic.a
240 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
241 B${mod} = \$(nodist_SOURCES_${mod})
244 cat >> modules/${dir}/Makefile.am << EOF
248 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
249 ${PRIVATE}BUILT_SOURCES += \$(B${mod})
252 cat >> modules/${dir}/Makefile.am << EOF
253 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
255 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
256 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
259 cat >> modules/${dir}/Makefile.am << EOF
260 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
261 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
262 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
264 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
266 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
267 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
270 cat >> modules/${dir}/Makefile.am << EOF
271 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
272 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
273 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
275 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
277 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
278 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
281 cat >> modules/${dir}/Makefile.am << EOF
282 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
283 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
284 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
286 libvlc_LIBRARIES += \$(L${mod}b) \$(L${mod}pic)
287 lib${mod}_DATA = \$(D${mod}p)
289 lib${mod}dir = \$(libdir)/vlc/${topdir}
290 ${PRIVATE}noinst_LIBRARIES += \$(L${mod}p)
291 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
292 ${PRIVATE} @case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
293 ${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}\` ;; \\
294 ${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}\` ;; \\
295 ${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}\` ;; \\
303 cat >> m4/private.m4-tmp1 << EOF
304 AM_CONDITIONAL(UNTRUE, false)
307 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
308 cat >> m4/private.m4-tmp2 << EOF
311 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
312 cat >> m4/private.m4-tmp3 << EOF
315 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
316 cat >> m4/private.m4-tmp4 << EOF
320 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
325 ### classic bootstrap stuff
329 # remove autotools cruft
330 rm -f aclocal.m4 configure config.log config.h config.h.in
331 rm -Rf autom4te.cache
332 # remove old autotools extra cruft
333 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
334 # remove new autotools extra cruft
335 (cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh)
336 # remove libtool cruft
337 rm -f ltmain.sh libtool ltconfig
338 # remove gettext cruft
341 # remove old vlc cruft
342 rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
343 # remove new vlc cruft
344 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
346 # Automake complains if these are not present
347 rm -f vlc-config.in && printf "" > vlc-config.in
348 if [ "$GETTEXT" != "yes" ]; then
349 test -d intl || mkdir intl
350 printf "" > intl/Makefile.am
351 printf "" > ABOUT-NLS
359 ${automake} --add-missing --copy
362 ## files which need to be regenerated
364 rm -f vlc-config.in vlc-config
365 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
366 rm -f include/vlc_symbols.h
367 rm -f mozilla/vlcintf.h
373 ## Tell the user about gettext, pkg-config and sed
379 ===========================================================
380 IMPORTANT NOTE: you do not have gettext installed on your
381 system. The vlc build will work, but you will not have
382 internationalization support. We suggest installing gettext.
387 ==========================================================
388 NOTE: you have an old version of gettext installed on your
389 system. The vlc build will work, but if your system does not
390 have libintl you will not have internationalization support.
391 We suggest upgrading to gettext 0.11.5 or later.
400 ==============================================================
401 NOTE: you do not have the "pkg-config" utility on your system;
402 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
408 case "$AUTOMAKESUCKS" in
412 =============================================================
413 IMPORTANT NOTE: your version of automake has a bug which will
414 prevent proper plugin compilation. Either compile VLC with
415 the --disable-plugins flag, or use a version of automake newer
416 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
421 case "$INSTALLSUCKS" in
425 =============================================================
426 IMPORTANT NOTE: your version of automake has a bug which will
427 prevent proper installation. Do not use "make install" with this
428 version of automake, or use a version of automake newer than 1.5
429 (such as 1.6 or 1.7).