bootstrap 3.24 KB
Newer Older
1 2
#! /bin/sh

3
##  bootstrap file for the VLC media player
4
##
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
5
## Copyright (C) 2005-2008 the VideoLAN team
6
##
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
7 8
##  Authors: Sam Hocevar <sam@zoy.org>
##           Rémi Denis-Courmont <rem # videolan # org>
9

Sam Hocevar's avatar
Sam Hocevar committed
10 11
if test "$#" != "0"; then
  echo "Usage: $0"
12
  echo "  Calls autoreconf to generate m4 macros and prepare Makefiles."
13 14 15
  exit 1
fi

16
###
17
###  Get a sane environment, just in case
18
###
19 20
CYGWIN=binmode
export CYGWIN
21

22
set -e
23
set -x
24

25
##
26
## Check for various tools
27
##
28

29
ACLOCAL_ARGS="-I m4 ${ACLOCAL_ARGS}"
30

31
# Check for contrib directory
32
if test -d extras/contrib/bin; then
33
  PATH="`pwd`/extras/contrib/bin:$PATH"
34 35 36
  if test -d extras/contrib/share/aclocal; then
    ACLOCAL_ARGS="${ACLOCAL_ARGS} -I extras/contrib/share/aclocal"
  fi
37
  if test ".`uname -s`" = ".Darwin"; then
38 39 40 41
    LD_LIBRARY_PATH=./extras/contrib/lib:$LD_LIBRARY_PATH
    DYLD_LIBRARY_PATH=./extras/contrib/lib:$DYLD_LIBRARY_PATH
    export LD_LIBRARY_PATH
    export DYLD_LIBRARY_PATH
42
  elif test ".`uname -s`" = ".BeOS"; then
43 44 45 46
    LIBRARY_PATH=./extras/contrib/lib:$LIBRARY_PATH
    BELIBRARIES=./extras/contrib/lib:$BELIBRARIES
    export LIBRARY_PATH
    export BELIBRARIES
47
  fi
48
elif test ".`uname -s`" = ".Darwin"; then
49 50 51 52 53 54 55 56 57 58 59
  set +x
  echo ""
  echo "ERR: Contribs haven't been built"
  echo "ERR: Please run:"
  echo "ERR: "
  echo "ERR:    'cd extras/contrib && ./bootstrap && make && cd ../..'"
  echo "ERR: "
  echo "ERR: Make sure fink has been disabled too."
  echo ""
  set -x
  exit 1
60 61
fi

62 63 64 65 66 67 68 69
# Check for pkg-config
if pkg-config --version >/dev/null 2>&1; then
  # We have pkg-config, everything is cool.
  PKGCONFIG=yes
else
  PKGCONFIG=no
fi

70 71 72 73
##
## Generate the modules makefile, by parsing modules/**/Modules.am
##

74
set +x
75
echo "generating modules/**/Makefile.am and m4/private.m4"
76

Sam Hocevar's avatar
Sam Hocevar committed
77
# Prepare m4/private.m4
Sam Hocevar's avatar
Sam Hocevar committed
78
rm -f m4/private.m4 && cat > m4/private.m4 << EOF
79
dnl  Private VLC macros - generated by bootstrap
80 81

EOF
Gildas Bazin's avatar
 
Gildas Bazin committed
82 83

if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
84 85
dnl  User does not have pkg-config, so assume package was not found
AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
Gildas Bazin's avatar
 
Gildas Bazin committed
86 87 88 89

EOF
fi

90
cat >> m4/private.m4 << EOF
Sam Hocevar's avatar
Sam Hocevar committed
91
dnl  Helper macro for vlc-config generation
Sam Hocevar's avatar
Sam Hocevar committed
92
AC_DEFUN([VLC_CONFIG_HELPER], [
Sam Hocevar's avatar
Sam Hocevar committed
93 94
  cat >> vlc-config.in << BLAH
EOF
95 96 97

modules=""

Sam Hocevar's avatar
Sam Hocevar committed
98 99 100
rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
# Autogenerated by bootstrap - DO NOT EDIT
EXTRA_DIST = LIST
101
dist_noinst_SCRIPTS = genmf
Sam Hocevar's avatar
Sam Hocevar committed
102
SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
Sam Hocevar's avatar
Sam Hocevar committed
103

104
EOF
105

106
modules/genmf `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
107

108
cat >> m4/private.m4 << EOF
Sam Hocevar's avatar
Sam Hocevar committed
109
BLAH
110 111
])
EOF
112

113
###
114
###  classic bootstrap stuff
115
###
116
set -x
117

118
# Automake complains if these are not present
119
echo > vlc-config.in
120
cp -f INSTALL INSTALL.git
Sam Hocevar's avatar
Sam Hocevar committed
121

122
autoreconf --install --force --verbose ${ACLOCAL_ARGS}
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
123
rm -f po/Makevars.template
124
echo > ABOUT-NLS
125
mv -f INSTALL.git INSTALL
126 127

##
Sam Hocevar's avatar
Sam Hocevar committed
128
##  files which need to be regenerated
129
##
Sam Hocevar's avatar
Sam Hocevar committed
130
rm -f vlc-config.in vlc-config
131
rm -f src/misc/modules_builtin.h
132
rm -f stamp-builtin stamp-h* mozilla/stamp-pic
133

134
# Shut up
135
set +x
136

137
##
138
##  Tell the user about gettext, pkg-config and sed
139
##
140
if [ "$PKGCONFIG" = "no" ]; then
141
  cat << EOF
142 143

==============================================================
144 145
NOTE: "pkg-config" is missing from your system. Certain
libraries may not be detected properly.
146
EOF
147
fi
148

149
echo "Successfully bootstrapped"