]> git.sesse.net Git - vlc/blob - bootstrap
Generate Makefile.am in directories with Modules.am
[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   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 pkg-config
60 if pkg-config --version >/dev/null 2>&1; then
61   # We have pkg-config, everything is cool.
62   PKGCONFIG=yes
63 else
64   PKGCONFIG=no
65 fi
66
67 # Check for autopoint (GNU gettext)
68 export AUTOPOINT
69 test "$AUTOPOINT" || AUTOPOINT=autopoint
70 if ! "$AUTOPOINT" --dry-run --force >/dev/null 2>&1; then
71   AUTOPOINT=true
72 fi
73
74 ##
75 ## Generate the modules makefile, by parsing modules/**/Modules.am
76 ##
77
78 set +x
79 echo "generating modules/**/Makefile.am"
80
81 # Prepare m4/private.m4
82 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
83 dnl  Private VLC macros - generated by bootstrap
84
85 EOF
86
87 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
88 dnl  User does not have pkg-config, so assume package was not found
89 AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
90
91 EOF
92 fi
93
94 find modules/ -name Modules.am | \
95 sed -ne 's,modules/\(.*\)/Modules.am,\1,p' | \
96 while read d; do
97         sh modules/genmf "$d"
98         printf "."
99 done
100 printf "\n"
101
102 ###
103 ###  classic bootstrap stuff
104 ###
105 set -x
106
107 # Automake complains if these are not present
108 echo > ABOUT-NLS
109 cp -f INSTALL INSTALL.git
110
111 autoreconf --install --force --verbose ${ACLOCAL_ARGS}
112 rm -f po/Makevars.template ABOUT-NLS
113 echo > ABOUT-NLS
114 mv -f INSTALL.git INSTALL
115
116 ##
117 ##  files which need to be regenerated
118 ##
119 rm -f stamp-h*
120
121 # Shut up
122 set +x
123
124 ##
125 ##  Tell the user about gettext, pkg-config and sed
126 ##
127 if [ "$AUTOPOINT" = "true" ]; then
128   cat << EOF
129
130 ==============================================================
131 NOTE: GNU gettext appears to be missing or out-of-date.
132 Please install or update GNU gettext.
133 Also check if you have cvs, a dependency of autopoint.
134 Otherwise, you will not be able to build a source tarball.
135 EOF
136 fi
137
138 if [ "$PKGCONFIG" = "no" ]; then
139   cat << EOF
140
141 ==============================================================
142 NOTE: "pkg-config" is missing from your system. Certain
143 libraries may not be detected properly.
144 EOF
145 fi
146
147 echo "Successfully bootstrapped"