]> git.sesse.net Git - vlc/blobdiff - bootstrap
* bootstrap: Fixed a shell syntax error when pkg-config is not present.
[vlc] / bootstrap
index 43bde92246c3b6d23b0ab43b8169ebc99a51e53c..d820e27a836803b17e64728c62184bf43bdb21ad 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 ##  bootstrap file for the VLC media player
-##  $Id: bootstrap,v 1.64 2003/07/04 14:56:51 sam Exp $
+##  $Id: bootstrap,v 1.72 2003/10/07 21:13:01 sam Exp $
 ##
 ##  Authors: Sam Hocevar <sam@zoy.org>
 
@@ -20,16 +20,14 @@ export LANG
 CYGWIN=binmode
 export CYGWIN
 
+set -e
+
 ##
 ## Naively assume our system doesn't suck. Unfortunately it seldom doesn't.
 ##
 AUTOMAKESUCKS=no
 INSTALLSUCKS=no
 
-##
-## Check that our tools don't suck
-##
-
 ##
 ## Generate the modules makefile, by parsing modules/**/Modules.am
 ##
@@ -62,7 +60,6 @@ AC_DEFUN([AX_VLC_CONFIG_HELPER], [
 EOF
 
 modules=""
-count=0
 
 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
 # Autogenerated by bootstrap - DO NOT EDIT
@@ -75,11 +72,9 @@ 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/`"
+  basedir="${dir%%\/*}"
   # 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
@@ -95,13 +90,13 @@ SUBDIRS = ${subdirs}
 libvlcdir = \$(libdir)/vlc/${basedir}
 include Modules.am
 
-clean:
-       rm -f *.a *.so *.dll *.sl *.dylib
+clean: clean-local
+clean-local:
+       -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
@@ -124,9 +119,17 @@ EOF
 #   work properly with any automake version I tested.
     cat >> modules/${dir}/Makefile.am << EOF
 # The ${mod} plugin
-
+clean: clean-${mod}
 all: all-${mod}
 
+EOF
+    if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
+clean-${mod}:
+       -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
+
+EOF
+    fi
+    cat >> modules/${dir}/Makefile.am << EOF
 all-${mod}:
 if BUILD_MOZILLA
        @set fnord \$\$MAKEFLAGS; amf=\$\$2; \\
@@ -157,13 +160,13 @@ else
 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
+L${mod}p = lib${mod}_plugin.a
+D${mod}p = lib${mod}_plugin\$(LIBEXT)
+L${mod}b = lib${mod}.a
+L${mod}pic = lib${mod}_pic.a
 EOF
     if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
-B${count} = \$(nodist_SOURCES_${mod})
+B${mod} = \$(nodist_SOURCES_${mod})
 EOF
     fi
     cat >> modules/${dir}/Makefile.am << EOF
@@ -171,7 +174,7 @@ endif
 
 EOF
     if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
-${PRIVATE}BUILT_SOURCES += \$(B${count})
+${PRIVATE}BUILT_SOURCES += \$(B${mod})
 EOF
     fi
     cat >> modules/${dir}/Makefile.am << EOF
@@ -208,11 +211,11 @@ 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)
+libvlc_LIBRARIES += \$(L${mod}b) \$(L${mod}pic)
+lib${mod}_DATA = \$(D${mod}p)
 
 lib${mod}dir = \$(libdir)/vlc/${topdir}
-${PRIVATE}noinst_LIBRARIES += \$(L${count}p)
+${PRIVATE}noinst_LIBRARIES += \$(L${mod}p)
 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
 ${PRIVATE}     @case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
 ${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}\` ;; \\
@@ -252,7 +255,7 @@ echo "done."
 set -x
 
 # remove autotools cruft
-rm -f aclocal.m4 configure configure.ac.in config.log Modules.am
+rm -f aclocal.m4 configure config.log config.h config.h.in
 # remove old autotools extra cruft
 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
 # remove new autotools extra cruft
@@ -260,8 +263,12 @@ rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
 # remove libtool cruft
 rm -f ltmain.sh libtool ltconfig
 # remove gettext cruft
-rm -f m4/oldgettext.m4 ABOUT-NLS
+rm -f ABOUT-NLS
 rm -Rf intl
+# remove old vlc cruft
+rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
+# remove new vlc cruft
+rm -f stamp-builtin stamp-h* mozilla/stamp-pic
 
 # Check for gettext
 if gettextize --version >/dev/null 2>&1; then
@@ -269,7 +276,7 @@ if gettextize --version >/dev/null 2>&1; then
 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
         '>=' 0.11.5 >/dev/null 2>&1; then
   # We have gettext, and a recent version! Everything is cool.
-  autopoint || exit 1
+  autopoint=autopoint
   GETTEXT=yes
 else
   # User's gettext is too old. try to continue anyway.
@@ -281,6 +288,7 @@ dnl  User's gettext is too old, so this is a no-op
 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
 
 EOF
+  autopoint=:
   GETTEXT=old
 fi;else
   # we don't have gettext. grmbl. try to continue anyway.
@@ -292,6 +300,7 @@ dnl  User does not have gettext, so this is a no-op
 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
 
 EOF
+  autopoint=:
   GETTEXT=no
 fi
 
@@ -303,7 +312,7 @@ else
   # Not present, use a workaround.
   cat >> m4/private.m4 << EOF
 dnl  User does not have pkg-config, so this is a no-op
-AC_DEFUN([PKG_CHECK_MODULES], [])
+AC_DEFUN([PKG_CHECK_MODULES], [:])
 
 EOF
   PKGCONFIG=no
@@ -315,14 +324,14 @@ if automake-1.7 --version >/dev/null 2>&1; then
   amvers="-1.7"
   # If we also have 1.6, use it instead because it is faster
   if automake-1.6 --version >/dev/null 2>&1; then
-    if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1
-    then amvers="-1.6"
+    if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1; then
+      amvers="-1.6"
     fi
   fi
 elif automake-1.6 --version >/dev/null 2>&1; then
   amvers="-1.6"
-  if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1
-  then AUTOMAKESUCKS=yes
+  if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1; then
+    AUTOMAKESUCKS=yes
   fi
 elif automake-1.5 --version >/dev/null 2>&1; then
   INSTALLSUCKS=yes
@@ -345,16 +354,20 @@ if test "${amvers}" = "none"; then
   exit 1
 fi
 
+aclocal=aclocal${amvers}
+automake=automake${amvers}
+autoconf=autoconf
+autoheader=autoheader
+
 # Automake complains if this is not present
 rm -f vlc-config.in && printf "" > vlc-config.in
 
 # Do the rest
-aclocal${amvers} -I m4 || exit 1
-autoheader || exit 1
-
-automake${amvers} --add-missing --copy
-
-autoconf || exit 1
+${autopoint} -f
+${aclocal} -I m4
+${autoconf}
+${autoheader}
+${automake} --add-missing --copy
 
 ##
 ##  files which need to be regenerated
@@ -364,19 +377,15 @@ rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
 rm -f include/vlc_symbols.h
 rm -f mozilla/vlcintf.h
 
-##
-##  Shut up
-##
+# Shut up
 set +x
 
 ##
 ##  Tell the user about gettext, pkg-config and sed
 ##
 case "${GETTEXT}" in
-  yes)
-  ;;
-  no)
-    cat << EOF
+  yes) ;;
+  no) cat << EOF
 
 ===========================================================
 IMPORTANT NOTE: you do not have gettext installed on your
@@ -384,8 +393,7 @@ system. The vlc build will work, but you will not have
 internationalization support. We suggest installing gettext.
 EOF
   ;;
-  old)
-    cat << EOF
+  old) cat << EOF
 
 ==========================================================
 NOTE: you have an old version of gettext installed on your
@@ -397,10 +405,8 @@ EOF
 esac
 
 case "$PKGCONFIG" in
-  yes)
-  ;;
-  no)
-    cat << EOF
+  yes) ;;
+  no) cat << EOF
 
 ==============================================================
 NOTE: you do not have the "pkg-config" utility on your system;
@@ -411,10 +417,8 @@ EOF
 esac
 
 case "$AUTOMAKESUCKS" in
-  no)
-  ;;
-  yes)
-    cat << EOF
+  no) ;;
+  yes) cat << EOF
 
 =============================================================
 IMPORTANT NOTE: your version of automake has a bug which will
@@ -426,10 +430,8 @@ EOF
 esac
 
 case "$INSTALLSUCKS" in
-  no)
-  ;;
-  yes)
-    cat << EOF
+  no) ;;
+  yes) cat << EOF
 
 =============================================================
 IMPORTANT NOTE: your version of automake has a bug which will