3 ## bootstrap file for the VLC media player
4 ## $Id: bootstrap,v 1.55 2003/07/01 14:25:47 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
24 ## Naively assume our system doesn't suck. Unfortunately it seldom doesn't.
30 ## Check that our tools don't suck
34 ## Generate the modules makefile, by parsing modules/**/Modules.am
37 printf "generating modules/**/Makefile.am and m4/private.m4"
39 # Prepare Modules.am and m4/private.m4
40 rm -f Modules.am && echo > Modules.am
41 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
42 dnl Private VLC macros - generated by bootstrap
45 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
46 dnl The required AM_CONDITIONAL calls
47 dnl XXX: too many conditionals make the build very slow, disabled them
48 AC_DEFUN([AX_VLC_CONDITIONALS], [
50 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
51 dnl The required AC_SUBST calls
52 AC_DEFUN([AX_VLC_SUBSTS], [
54 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
55 dnl The required AC_OUTPUT calls
56 dnl XXX: this feature is only supported starting from automake-1.7
57 AC_DEFUN([AX_VLC_MAKEFILES], [AC_OUTPUT([
59 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
60 dnl Helper macro for vlc-config generation
61 AC_DEFUN([AX_VLC_CONFIG_HELPER], [
62 cat >> vlc-config.in << BLAH
68 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
69 # Autogenerated by bootstrap - DO NOT EDIT
71 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
72 #DIST_SUBDIRS = \$(SUBDIRS)
75 for dir in `sed -ne 's,\(modules/.*\)/Makefile,\1,p' configure.ac`
78 mf="${dir}/Modules.am"
79 basedir="`echo ${dir} | cut -f2 -d/`"
80 # automake will not recurse for make dist if we don't define SUBDIRS = .
81 subdirs="`sed -ne 's,'${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
82 #parent=`echo ${dir} | sed -e 's@[^/]*@..@g'`
83 #echo " ${dir}/Makefile" >> m4/private.m4-tmp3
84 rm -f ${dir}/Makefile.am && cat > ${dir}/Makefile.am << EOF
86 # Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead
92 EXTRA_DIST = Modules.am
95 #DIST_SUBDIRS = \$(SUBDIRS)
96 libvlcdir = \$(libdir)/vlc/${basedir}
99 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
101 count="`expr ${count} + 1`"
102 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
105 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
108 # cat >> m4/private.m4-tmp1 << EOF
109 #dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
110 #dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
112 cat >> Modules.am << EOF
113 ${dir}/lib${mod}_plugin: ${dir}/lib${mod}_plugin\$(LIBEXT)
114 ${dir}/lib${mod}_plugin\$(LIBEXT): include/vlc_symbols.h FORCE
115 cd ${dir} && \$(MAKE) lib${mod}_plugin\$(LIBEXT)
116 ${dir}/lib${mod}.a: include/vlc_symbols.h FORCE
117 cd ${dir} && \$(MAKE) lib${mod}.a
118 ${dir}/lib${mod}_pic.a: include/vlc_symbols.h FORCE
119 cd ${dir} && \$(MAKE) lib${mod}_pic.a
122 cat >> m4/private.m4-tmp4 << EOF
123 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
125 # Generation of modules/**/Makefile.am
126 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
127 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
128 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
129 # the resulting file size.
130 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
131 # work properly with any automake version I tested.
132 cat >> ${dir}/Makefile.am << EOF
138 if \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1 ; then \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT); fi
139 if \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1 ; then \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a; fi
141 if \$(VLC_CONFIG) --target builtin pic | grep "${dir}/lib${mod}_pic\\.a" >/dev/null 2>&1 ; then \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_pic.a; fi
145 L${count}p = lib${mod}_plugin.a
146 D${count}p = lib${mod}_plugin\$(LIBEXT)
147 L${count}b = lib${mod}.a
148 L${count}pic = lib${mod}_pic.a
150 if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
151 B${count}p = \$(nodist_SOURCES_${mod})
152 B${count}b = \$(nodist_SOURCES_${mod})
155 cat >> ${dir}/Makefile.am << EOF
159 if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
160 ${PRIVATE}BUILT_SOURCES += \$(B${count}p) \$(B${count}b)
163 cat >> ${dir}/Makefile.am << EOF
164 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
166 if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
167 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
170 cat >> ${dir}/Makefile.am << EOF
171 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
172 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
173 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
175 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
177 if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
178 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
181 cat >> ${dir}/Makefile.am << EOF
182 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
183 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
184 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
186 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
188 if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
189 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
192 cat >> ${dir}/Makefile.am << EOF
193 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
194 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
195 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
197 libvlc_LIBRARIES += \$(L${count}b) \$(L${count}pic)
198 lib${mod}_DATA = \$(D${count}p)
200 lib${mod}dir = \$(libdir)/vlc/${topdir}
201 ${PRIVATE}noinst_LIBRARIES += \$(L${count}p)
202 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
203 ${PRIVATE} case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
204 ${PRIVATE} c++) \$(CXXLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
205 ${PRIVATE} objc) \$(OBJCLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
206 ${PRIVATE} c|*) \$(LINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
214 cat >> m4/private.m4-tmp1 << EOF
215 AM_CONDITIONAL(UNTRUE, false)
218 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
219 cat >> m4/private.m4-tmp2 << EOF
222 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
223 cat >> m4/private.m4-tmp3 << EOF
226 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
227 cat >> m4/private.m4-tmp4 << EOF
231 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
236 ### classic bootstrap stuff
240 # remove autotools cruft
241 rm -f aclocal.m4 configure configure.ac.in config.log
242 # remove old autotools extra cruft
243 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
244 # remove new autotools extra cruft
245 (cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh)
246 # remove libtool cruft
247 rm -f ltmain.sh libtool ltconfig
248 # remove gettext cruft
249 rm -f m4/oldgettext.m4 ABOUT-NLS
253 if gettextize --version >/dev/null 2>&1; then
254 # Autopoint is available from 0.11.3, but we need 0.11.5
255 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
256 '>=' 0.11.5 >/dev/null 2>&1; then
257 # We have gettext, and a recent version! Everything is cool.
261 # User's gettext is too old. try to continue anyway.
264 echo > intl/Makefile.am
265 cat >> m4/private.m4 << EOF
266 dnl User's gettext is too old, so this is a no-op
267 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
272 # we don't have gettext. grmbl. try to continue anyway.
275 echo > intl/Makefile.am
276 cat >> m4/private.m4 << EOF
277 dnl User does not have gettext, so this is a no-op
278 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
284 # Check for pkg-config
285 if pkg-config --version >/dev/null 2>&1; then
286 # We have pkg-config, everything is cool.
289 # Not present, use a workaround.
290 cat >> m4/private.m4 << EOF
291 dnl User does not have pkg-config, so this is a no-op
292 AC_DEFUN([PKG_CHECK_MODULES], [])
300 if automake-1.7 --version >/dev/null 2>&1; then
302 # If we also have 1.6, use it instead because it is faster
303 if automake-1.6 --version >/dev/null 2>&1; then
304 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1
308 elif automake-1.6 --version >/dev/null 2>&1; then
310 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1
311 then AUTOMAKESUCKS=yes
313 elif automake-1.5 --version >/dev/null 2>&1; then
316 elif automake --version > /dev/null 2>&1; then
318 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
319 0|0.*|1|1.[01234]|1.[01234].*)
328 if test "${amvers}" = "none"; then
330 echo "you need automake version 1.5 or later"
334 # Automake complains if this is not present
335 rm -f vlc-config.in && printf "" > vlc-config.in
338 aclocal${amvers} -I m4 || exit 1
341 automake${amvers} --add-missing --copy
346 ## files which need to be regenerated
348 rm -f vlc-config.in vlc-config
349 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
350 rm -f include/vlc_symbols.h
351 rm -f mozilla/vlcintf.h
359 ## Tell the user about gettext, pkg-config and sed
367 ===========================================================
368 IMPORTANT NOTE: you do not have gettext installed on your
369 system. The vlc build will work, but you will not have
370 internationalization support. We suggest installing gettext.
376 ==========================================================
377 NOTE: you have an old version of gettext installed on your
378 system. The vlc build will work, but if your system does not
379 have libintl you will not have internationalization support.
380 We suggest upgrading to gettext 0.11.5 or later.
391 ==============================================================
392 NOTE: you do not have the "pkg-config" utility on your system;
393 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
399 case "$AUTOMAKESUCKS" in
405 =============================================================
406 IMPORTANT NOTE: your version of automake has a bug which will
407 prevent proper plugin compilation. Either compile VLC with
408 the --disable-plugins flag, or use a version of automake newer
409 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
414 case "$INSTALLSUCKS" in
420 =============================================================
421 IMPORTANT NOTE: your version of automake has a bug which will
422 prevent proper installation. Do not use "make install" with this
423 version of automake, or use a version of automake newer than 1.5
424 (such as 1.6 or 1.7).