]> git.sesse.net Git - vlc/blob - bootstrap
Merge branch 'master' into lpcm_encoder
[vlc] / bootstrap
1 #! /bin/sh
2
3 ##  bootstrap file for the VLC media player
4 ##
5 ## Copyright (C) 2005-2008 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 autoreconf to generate m4 macros and prepare Makefiles."
13   exit 1
14 fi
15
16 ###
17 ###  Get a sane environment, just in case
18 ###
19 CYGWIN=binmode
20 export CYGWIN
21
22 set -e
23 set -x
24
25 cd "$(dirname "$0")"
26
27 ##
28 ## Check for various tools
29 ##
30
31 ACLOCAL_ARGS="-I m4 ${ACLOCAL_ARGS}"
32
33 # Check for contrib directory
34 if test -d extras/contrib/build/bin; then
35   PATH="`pwd`/extras/contrib/build/bin:$PATH"
36   if test -d extras/contrib/build/share/aclocal; then
37     ACLOCAL_ARGS="${ACLOCAL_ARGS} -I extras/contrib/build/share/aclocal"
38   fi
39   if test ".`uname -s`" = ".Darwin"; then
40     LD_LIBRARY_PATH=./extras/contrib/build/lib:$LD_LIBRARY_PATH
41     DYLD_LIBRARY_PATH=./extras/contrib/build/lib:$DYLD_LIBRARY_PATH
42     export LD_LIBRARY_PATH
43     export DYLD_LIBRARY_PATH
44   elif test ".`uname -s`" = ".BeOS"; then
45     LIBRARY_PATH=./extras/contrib/build/lib:$LIBRARY_PATH
46     BELIBRARIES=./extras/contrib/build/lib:$BELIBRARIES
47     export LIBRARY_PATH
48     export BELIBRARIES
49   fi
50 elif test ".`uname -s`" = ".Darwin"; then
51   set +x
52   echo ""
53   echo "ERR: Contribs haven't been built"
54   echo "ERR: Please run:"
55   echo "ERR: "
56   echo "ERR:    'cd extras/contrib && ./bootstrap && make && cd ../..'"
57   echo "ERR: "
58   echo "ERR: Make sure fink has been disabled too."
59   echo ""
60   set -x
61   exit 1
62 fi
63
64 # Check for pkg-config
65 if pkg-config --version >/dev/null 2>&1; then
66   # We have pkg-config, everything is cool.
67   PKGCONFIG=yes
68 else
69   PKGCONFIG=no
70 fi
71
72 # Check for autopoint (GNU gettext)
73 export AUTOPOINT
74 test "$AUTOPOINT" || AUTOPOINT=autopoint
75 if ! "$AUTOPOINT" --dry-run --force >/dev/null 2>&1; then
76   AUTOPOINT=true
77   echo > ABOUT-NLS
78 fi
79
80 ##
81 ## Generate the modules makefile, by parsing modules/**/Modules.am
82 ##
83
84 set +x
85 echo "generating modules/**/Makefile.am"
86
87 # Prepare m4/private.m4
88 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
89 dnl  Private VLC macros - generated by bootstrap
90
91 EOF
92
93 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
94 dnl  User does not have pkg-config, so assume package was not found
95 AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
96
97 EOF
98 fi
99
100 sh modules/genmf `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
101
102 ###
103 ###  classic bootstrap stuff
104 ###
105 set -x
106
107 # Automake complains if these are not present
108 echo > vlc-config.in
109 echo > ABOUT-NLS
110 cp -f INSTALL INSTALL.git
111
112 autoreconf --install --force --verbose ${ACLOCAL_ARGS}
113 rm -f po/Makevars.template ABOUT-NLS
114 echo > ABOUT-NLS
115 mv -f INSTALL.git INSTALL
116
117 ##
118 ##  files which need to be regenerated
119 ##
120 rm -f vlc-config.in vlc-config
121 rm -f src/misc/modules_builtin.h
122 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
123
124 # Shut up
125 set +x
126
127 ##
128 ##  Tell the user about gettext, pkg-config and sed
129 ##
130 if [ "$AUTOPOINT" = "true" ]; then
131   cat << EOF
132
133 ==============================================================
134 NOTE: GNU gettext appears to be missing or out-of-date.
135 Please install or update GNU gettext.
136 Also check if you have cvs, a dependency of autopoint.
137 Otherwise, you will not be able to build a source tarball.
138 EOF
139 fi
140
141 if [ "$PKGCONFIG" = "no" ]; then
142   cat << EOF
143
144 ==============================================================
145 NOTE: "pkg-config" is missing from your system. Certain
146 libraries may not be detected properly.
147 EOF
148 fi
149
150 echo "Successfully bootstrapped"