]> git.sesse.net Git - vlc/blob - bootstrap
Don't put in SUBDIRS dir without Makefile
[vlc] / bootstrap
1 #! /bin/sh
2
3 ##  bootstrap file for the VLC media player
4 ##
5 ## Copyright (C) 2005-2006 the VideoLAN team
6 ##
7 ##  Authors: Sam Hocevar <sam@zoy.org>
8 ##           RĂ©mi Denis-Courmont <rem # videolan # org>
9
10 if test "$#" != "0"; then
11   echo "Usage: $0"
12   echo "  Calls automake, autoconf, autoheader, autopoint and other auto* to generate"
13   echo "  m4 macros and prepare Makefiles."
14   exit 1
15 fi
16
17 ###
18 ###  Get a sane environment, just in case
19 ###
20 CYGWIN=binmode
21 export CYGWIN
22
23 set -e
24 set -x
25
26 ##
27 ## Check for various tools
28 ##
29
30 ACLOCAL_ARGS="-I m4 ${ACLOCAL_ARGS}"
31
32 # Check for contrib directory
33 if test -d extras/contrib/bin; then
34   export PATH="`pwd`/extras/contrib/bin:$PATH"
35   if test -d extras/contrib/share/aclocal; then
36     ACLOCAL_ARGS="${ACLOCAL_ARGS} -I extras/contrib/share/aclocal"
37   fi
38   if test ".`uname -s`" = ".Darwin"; then
39     export LD_LIBRARY_PATH=./extras/contrib/lib:$LD_LIBRARY_PATH
40     export DYLD_LIBRARY_PATH=./extras/contrib/lib:$DYLD_LIBRARY_PATH
41   elif test ".`uname -s`" = ".BeOS"; then
42     export LIBRARY_PATH=./extras/contrib/lib:$LIBRARY_PATH
43     export BELIBRARIES=./extras/contrib/lib:$BELIBRARIES
44   fi
45 elif test ".`uname -s`" = ".Darwin"; then
46   set +x
47   echo ""
48   echo "ERR: Contribs haven't been built"
49   echo "ERR: Please run:"
50   echo "ERR: "
51   echo "ERR:    'cd extras/contrib && ./bootstrap && make && cd ../..'"
52   echo "ERR: "
53   echo "ERR: Make sure fink has been disabled too."
54   echo ""
55   set -x
56   exit 1
57 fi
58
59 # Check for autoconf
60 rm -f m4/autoconf260.m4
61 case "$(autoreconf --version|head -n 1)" in
62   *2.59*)
63     echo "Enabling provisional autoconf 2.59 work-around. Update autoconf ASAP."
64     echo "Press Enter to continue"
65     read
66     cp -f extras/buildsystem/autotools/m4/autoconf260.m4 m4/
67     ;;
68 esac
69
70 # Check for pkg-config
71 if pkg-config --version >/dev/null 2>&1; then
72   # We have pkg-config, everything is cool.
73   PKGCONFIG=yes
74 else
75   PKGCONFIG=no
76 fi
77
78 ##
79 ## Generate the modules makefile, by parsing modules/**/Modules.am
80 ##
81
82 set +x
83 echo "generating modules/**/Makefile.am and m4/private.m4"
84
85 # Prepare m4/private.m4
86 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
87 dnl  Private VLC macros - generated by bootstrap
88
89 EOF
90
91 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
92 dnl  User does not have pkg-config, so assume package was not found
93 AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
94
95 EOF
96 fi
97
98 cat >> m4/private.m4 << EOF
99 dnl  Helper macro for vlc-config generation
100 AC_DEFUN([VLC_CONFIG_HELPER], [
101   cat >> vlc-config.in << BLAH
102 EOF
103
104 modules=""
105
106 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
107 # Autogenerated by bootstrap - DO NOT EDIT
108 EXTRA_DIST = LIST
109 dist_noinst_SCRIPTS = genmf
110 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
111
112 EOF
113
114 modules/genmf `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
115
116 cat >> m4/private.m4 << EOF
117 BLAH
118 ])
119 EOF
120
121 ###
122 ###  classic bootstrap stuff
123 ###
124 set -x
125
126 # Automake complains if these are not present
127 echo > vlc-config.in
128 mkdir -p intl
129 cp -f INSTALL INSTALL.svn
130
131 autoreconf --install --force ${ACLOCAL_ARGS}
132 rm -f po/Makevars.template
133 echo > ABOUT-NLS
134 mv -f INSTALL.svn INSTALL
135
136 ##
137 ##  files which need to be regenerated
138 ##
139 rm -f vlc-config.in vlc-config
140 rm -f src/misc/modules_builtin.h
141 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
142
143 # Shut up
144 set +x
145
146 ##
147 ##  Tell the user about gettext, pkg-config and sed
148 ##
149 if [ "$PKGCONFIG" = "no" ]; then
150   cat << EOF
151
152 ==============================================================
153 NOTE: you do not have the "pkg-config" utility on your system;
154 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
155 reliable.
156 EOF
157 fi
158
159 echo "Successfully bootstrapped"