-rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
-dnl The required AM_CONDITIONAL calls
-dnl XXX: too many conditionals make the build very slow, disabled them
-AC_DEFUN([AX_VLC_CONDITIONALS], [
-EOF
-rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
-dnl The required AC_SUBST calls
-AC_DEFUN([AX_VLC_SUBSTS], [
-EOF
-rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
-dnl The required AC_OUTPUT calls
-dnl XXX: this feature is only supported starting from automake-1.7
-AC_DEFUN([AX_VLC_MAKEFILES], [AC_OUTPUT([
-EOF
-rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
-dnl Helper macro for vlc-config generation
-AC_DEFUN([AX_VLC_CONFIG_HELPER], [
- cat >> vlc-config.in << BLAH
-EOF
-
-modules=""
-count=0
-
-rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
-# Autogenerated by bootstrap - DO NOT EDIT
-EXTRA_DIST = LIST
-SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
-#DIST_SUBDIRS = \$(SUBDIRS)
-EOF
-
-for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
-do
- printf "."
- mf="modules/${dir}/Modules.am"
- basedir="`echo ${dir} | cut -f1 -d/`"
- # automake will not recurse for make dist if we don't define SUBDIRS = .
- subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
- #parent=`echo ${dir} | sed -e 's@[^/]*@..@g'`
- #echo " modules/${dir}/Makefile" >> m4/private.m4-tmp3
- rm -f modules/${dir}/Makefile.am && cat > modules/${dir}/Makefile.am << EOF
-
-# Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead
-
-NULL =
-libvlc_LIBRARIES =
-noinst_LIBRARIES =
-noinst_HEADERS =
-EXTRA_DIST = Modules.am
-BUILT_SOURCES =
-SUBDIRS = ${subdirs}
-#DIST_SUBDIRS = \$(SUBDIRS)
-libvlcdir = \$(libdir)/vlc/${basedir}
-include Modules.am
-
-clean:
- rm -f *.a *.so *.dll *.sl *.dylib
-
-EOF
- for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
- do
- count="`expr ${count} + 1`"
- if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
- PRIVATE='#'; else
- PRIVATE=''; fi
- if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
- NODIST=''; else
- NODIST='#'; fi
-# cat >> m4/private.m4-tmp1 << EOF
-#dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
-#dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
-#EOF
- cat >> m4/private.m4-tmp4 << EOF
- ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
-EOF
-# Generation of modules/**/Makefile.am
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
-# S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
-# the resulting file size.
-# - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
-# work properly with any automake version I tested.
- cat >> modules/${dir}/Makefile.am << EOF
-# The ${mod} plugin
-
-all: all-${mod}
-
-all-${mod}:
-if BUILD_MOZILLA
- if \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1 ; then \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT); fi; \\
- if \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1 ; then \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a; fi; \\
- 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
-else
- if \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1 ; then \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT); fi; \\
- if \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1 ; then \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a; fi
-endif
-
-if UNTRUE
-L${count}p = lib${mod}_plugin.a
-D${count}p = lib${mod}_plugin\$(LIBEXT)
-L${count}b = lib${mod}.a
-L${count}pic = lib${mod}_pic.a
-EOF
- if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
-B${count}p = \$(nodist_SOURCES_${mod})
-B${count}b = \$(nodist_SOURCES_${mod})
-EOF
- fi
- cat >> modules/${dir}/Makefile.am << EOF
-endif
-
-EOF
- if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
-${PRIVATE}BUILT_SOURCES += \$(B${count}p) \$(B${count}b)
-EOF
- fi
- cat >> modules/${dir}/Makefile.am << EOF
-${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
-EOF
- if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
-${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
-EOF
- fi
- cat >> modules/${dir}/Makefile.am << EOF
-lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
-lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
-lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
-
-lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
-EOF
- if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
-nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
-EOF
- fi
- cat >> modules/${dir}/Makefile.am << EOF
-lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
-lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
-lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
-
-lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
-EOF
- if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
-nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
-EOF
- fi
- cat >> modules/${dir}/Makefile.am << EOF
-lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
-lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
-lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
-
-libvlc_LIBRARIES += \$(L${count}b) \$(L${count}pic)
-lib${mod}_DATA = \$(D${count}p)
-
-lib${mod}dir = \$(libdir)/vlc/${topdir}
-${PRIVATE}noinst_LIBRARIES += \$(L${count}p)
-${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
-${PRIVATE} case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
-${PRIVATE} c++) \$(CXXLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
-${PRIVATE} objc) \$(OBJCLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
-${PRIVATE} c|*) \$(LINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
-${PRIVATE} esac