]> git.sesse.net Git - vlc/blob - bootstrap
It now works when there is no automake-1.5 nor automake-1.6.
[vlc] / bootstrap
1 #! /bin/sh
2
3 ##  bootstrap.sh file for vlc, the VideoLAN Client
4 ##  $Id: bootstrap,v 1.12 2002/08/28 19:48:16 massiot Exp $
5 ##
6 ##  Authors: Samuel Hocevar <sam@zoy.org>
7
8 ###
9 ###  get a sane environment
10 ###
11 export LANG=C
12
13 ###
14 ###  argument check
15 ###
16 do_po=no
17 while test $# -gt 0; do
18   case "$1" in
19     --update-po)
20       do_po=yes
21       ;;
22     *)
23       echo "unknown option $1"
24       ;;
25   esac
26   shift
27 done
28
29 ###
30 ###  classic stuff
31 ###
32 set -x
33 rm -f aclocal.m4 configure config.guess config.log config.sub ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh
34
35 # Check for gettext
36 if gettextize --version >/dev/null 2>&1
37 then
38 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
39         '>' 0.11.3 >/dev/null 2>&1
40 then
41   # We have gettext, and a recent version! Everything is cool.
42   autopoint --force
43   GETTEXT=yes
44 else
45   # What?! User is not using a recent version of gettext? We'll have to
46   # cheat a bit, then.
47   rm -f po/ChangeLog~
48   gettextize --copy --force | grep '^from the' | cut -f3 -d' '
49   # Yuck!
50   test -f po/ChangeLog~ && mv po/ChangeLog~ po/ChangeLog
51   # Yuck!
52   echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
53   GETTEXT=old
54 fi;else
55   # we don't have gettext. grmbl. try to continue anyway.
56   mkdir -p intl
57   echo > intl/Makefile.am
58   echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
59   GETTEXT=no
60 fi
61
62 # Check for automake
63 amvers="none"
64 if automake-1.6 --version >/dev/null 2>&1
65 then
66   amvers="-1.6"
67 else
68   if automake-1.5 --version >/dev/null 2>&1
69   then
70     amvers="-1.5"
71   else
72     if automake --version > /dev/null 2>&1
73     then
74       amvers=`automake --version | head -1 | cut -d\  -f 4`
75
76       if expr "$amvers" "<" "1.5" > /dev/null 2>&1
77       then amvers="none"
78       else amvers=""
79       fi
80     fi
81   fi
82 fi
83
84 if test x$amvers = xnone
85 then
86   set +x
87   echo "you need automake version 1.5 or later"
88   exit 1
89 fi
90
91 # Do the rest
92 aclocal${amvers} -I m4
93 autoheader
94 automake${amvers} --foreign --add-missing --copy
95 autoconf
96
97 # nuahahahahaha !! overwriting Makefile.in with what *I* want!
98 cp Makefile.old Makefile.in
99
100 ##
101 ##  headers which need to be regenerated because of the VLC_EXPORT macro
102 ##
103 file=src/misc/modules_plugin.h
104 rm -f $file
105 sed -e 's#.*\$[I][d]:.*# * Automatically generated from '$file'.in by bootstrap.sh#' < $file.in > $file
106 echo '#define STORE_SYMBOLS( p_symbols ) \' >> $file
107 cat include/*.h | grep '^ *VLC_EXPORT.*;' | \
108        sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/    (p_symbols)->\2_inner = \2; \\/' >> $file
109 echo '' >> $file
110
111 file=include/vlc_symbols.h
112 rm -f $file && touch $file
113 echo '/* DO NOT EDIT THIS FILE ! It was generated by bootstrap.sh */' >> $file
114 echo '' >> $file
115 echo 'struct module_symbols_t' >> $file
116 echo '{' >> $file
117 cat include/*.h | grep '^ *VLC_EXPORT.*;' | \
118        sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/    \1 (* \2_inner) \3;/' | sort >> $file
119 echo '};' >> $file
120 echo '' >> $file
121 echo '#ifdef __PLUGIN__' >> $file
122 cat include/*.h | grep '^ *VLC_EXPORT.*;' | \
123        sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/#   define \2 p_symbols->\2_inner/' | sort >> $file
124 echo '#endif /* __PLUGIN__ */' >> $file
125 echo '' >> $file
126
127
128 ##
129 ##  Glade sometimes sucks
130 ##
131 for file in gnome_interface.c gtk_interface.c
132 do
133 if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
134 then
135     rm -f /tmp/$$.$file.bak
136     cat > /tmp/$$.$file.bak << EOF
137 /* This file was created automatically by glade and fixed by bootstrap.sh */
138
139 #include <vlc/vlc.h>
140 EOF
141     sed -e 1,7d \
142         -e 's#_("-:--:--")#"-:--:--"#' \
143         -e 's#_("---")#"---"#' \
144         -e 's#_("--")#"--"#' \
145         -e 's#_("/dev/dvd")#"/dev/dvd"#' \
146         -e 's#_(\("./."\))#\1#' \
147         < modules/gui/gtk/$file >> /tmp/$$.$file.bak
148     mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
149 fi
150 done
151
152 file=gtk_support.h
153 if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
154 then
155     rm -f /tmp/$$.$file.bak
156     sed -e 's/DO NOT EDIT THIS FILE.*/This file was created automatically by glade and fixed by bootstrap.sh/ ; s/#if.*ENABLE_NLS.*/#if defined( ENABLE_NLS ) \&\& defined ( HAVE_GETTEXT )/' < modules/gui/gtk/$file > /tmp/$$.$file.bak
157     mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
158 fi
159
160 ##
161 ##  Shut up
162 ##
163 set +x
164
165 ##
166 ##  Update the potfiles because no one ever does it
167 ##
168 if test "$do_po" = "no"
169 then
170   echo "not updating potfiles. use --update-po to force doing it."
171 else
172   cd po
173   make update-po 2>&1 | grep '^[^:]*:$' | cut -f1 -d: | tr '\n' ' ' | sed 's/ $//'
174   cd ..
175 fi
176
177 ##
178 ##  Tell the user about gettext
179 ##
180 case "$GETTEXT" in
181   yes)
182   ;;
183   no)
184     echo ""
185     echo "==========================================================="
186     echo "IMPORTANT NOTE: you do not have gettext installed on your"
187     echo "system. The vlc build will work, but you will not have"
188     echo "internationalization support. We suggest installing gettext."
189   ;;
190   old)
191     echo ""
192     echo "=========================================================="
193     echo "NOTE: you have an old version of gettext installed on your"
194     echo "system. We suggest upgrading to gettext 0.11.3 or later."
195   ;;
196 esac
197