62c8327ad1726f9cfe06ea288a07804bdee267a1
[platform/upstream/gst-libav.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 DIE=0
5 package=gst-ffmpeg
6 srcfile=configure.ac
7
8 # FFMPEG specific properties
9 . ./ffmpegrev
10
11 # a quick cvs co if necessary to alleviate the pain - may remove this
12 # when developers get a clue ;)
13 if test ! -d common; 
14 then 
15   echo "+ getting common/ from cvs"
16   cvs co common 
17 fi
18
19 if test ! -f $FFMPEG_CO_DIR/configure
20 then
21         # checkout ffmpeg from its repository
22         rm -rf $FFMPEG_CO_DIR
23         echo "+ getting ffmpeg from svn"
24         svn -r $FFMPEG_REVISION co $FFMPEG_SVN $FFMPEG_CO_DIR
25 else
26     # update ffmpeg from its repository
27     echo "+ updating ffmpeg checkout"
28     svn -r $FFMPEG_REVISION up $FFMPEG_CO_DIR
29 fi
30
31
32 # source helper functions
33 if test ! -f common/gst-autogen.sh;
34 then
35   echo There is something wrong with your source tree.
36   echo You are missing common/gst-autogen.sh
37   exit 1
38 fi
39 . common/gst-autogen.sh
40
41 # Let's check if we can disable the building of the ffmpeg binary
42 can_disable=`$FFMPEG_CO_DIR/configure --help | grep 'disable-ffmpeg' | wc -l`
43
44 if [ $can_disable != "0" ]
45 then
46     CONFIGURE_DEF_OPT="--disable-ffmpeg"
47 fi
48
49 # Let's clear the 'exit 1' command when we post an Unknown option
50 echo "Patching ffmpeg ./configure"
51 sed -e '/Unknown option/ {
52 N
53 N
54 s/exit 1/#/
55 }' $FFMPEG_CO_DIR/configure > $FFMPEG_CO_DIR/configure.tmp
56 mv $FFMPEG_CO_DIR/configure.tmp $FFMPEG_CO_DIR/configure
57 chmod +x $FFMPEG_CO_DIR/configure
58
59 autogen_options $@
60
61 echo -n "+ check for build tools"
62 if test ! -z "$NOCHECK"; then echo " skipped"; else  echo; fi
63 version_check "autoconf" "$AUTOCONF autoconf autoconf-2.54 autoconf-2.53 autoconf-2.52" \
64               "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 52 || DIE=1
65 version_check "automake" "$AUTOMAKE automake automake-1.9 automake-1.7 automake-1.6 automake-1.5" \
66               "ftp://ftp.gnu.org/pub/gnu/automake/" 1 6 || DIE=1
67 version_check "libtoolize" "$LIBTOOLIZE libtoolize libtoolize14 glibtoolize" \
68               "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 4 0 || DIE=1
69 version_check "pkg-config" "" \
70               "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1
71
72 die_check $DIE
73
74 autoconf_2_52d_check || DIE=1
75 aclocal_check || DIE=1
76 autoheader_check || DIE=1
77
78 die_check $DIE
79
80 # if no arguments specified then this will be printed
81 if test -z "$*"; then
82   echo "+ checking for autogen.sh options"
83   echo "  This autogen script will automatically run ./configure as:"
84   echo "  ./configure $CONFIGURE_DEF_OPT"
85   echo "  To pass any additional options, please specify them on the $0"
86   echo "  command line."
87 fi
88
89 toplevel_check $srcfile
90
91 tool_run "$aclocal" "-I m4 -I common/m4 $ACLOCAL_FLAGS"
92 tool_run "$libtoolize" "--copy --force"
93 tool_run "$autoheader"
94
95 # touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo
96 echo timestamp > stamp-h.in 2> /dev/null
97
98 tool_run "$autoconf"
99 tool_run "$automake" "-a -c"
100
101 # if enable exists, add an -enable option for each of the lines in that file
102 if test -f enable; then
103   for a in `cat enable`; do
104     CONFIGURE_FILE_OPT="--enable-$a"
105   done
106 fi
107
108 # if disable exists, add an -disable option for each of the lines in that file
109 if test -f disable; then
110   for a in `cat disable`; do
111     CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a"
112   done
113 fi
114
115 test -n "$NOCONFIGURE" && {
116   echo "+ skipping configure stage for package $package, as requested."
117   echo "+ autogen.sh done."
118   exit 0
119 }
120
121 echo "+ running configure ... "
122 test ! -z "$CONFIGURE_DEF_OPT" && echo "  ./configure default flags: $CONFIGURE_DEF_OPT"
123 test ! -z "$CONFIGURE_EXT_OPT" && echo "  ./configure external flags: $CONFIGURE_EXT_OPT"
124 test ! -z "$CONFIGURE_FILE_OPT" && echo "  ./configure enable/disable flags: $CONFIGURE_FILE_OPT"
125 echo
126
127 ./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || {
128         echo "  configure failed"
129         exit 1
130 }
131
132 echo
133 echo "Now type 'make' to compile $package."