Automatic update of common submodule
[platform/upstream/gstreamer.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 have_svn=`which svn`
8 # FFMPEG specific properties
9 . ./ffmpegrev
10
11 # make sure we have common
12 if test ! -f common/gst-autogen.sh; 
13 then 
14   echo "+ Setting up common submodule"
15   git submodule init
16 fi
17 git submodule update
18
19 if test -x $have_svn && [ $have_svn ];
20 then
21     co_ffmpeg=no
22
23     if test ! -f $FFMPEG_CO_DIR/configure; then
24       co_ffmpeg=yes
25     else
26       if ! svn info gst-libs/ext/ffmpeg | grep "URL: $FFMPEG_SVN" > /dev/null; then
27         echo "FFmpeg checkout is on the wrong branch. Re-fetching."
28         co_ffmpeg=yes
29       fi
30     fi
31
32     if [ "$co_ffmpeg" = "yes" ]; then
33         # checkout ffmpeg from its repository
34         rm -rf $FFMPEG_CO_DIR
35         echo "+ getting ffmpeg from svn"
36         svn -r $FFMPEG_REVISION co $FFMPEG_SVN $FFMPEG_CO_DIR
37     else
38         # update ffmpeg from its repository
39         echo "+ updating ffmpeg checkout"
40         svn -r $FFMPEG_REVISION up $FFMPEG_CO_DIR
41     fi
42     if [ "x$FFMPEG_EXTERNALS_REVISION" != "x" ]; then
43         echo "+ updating externals"
44         svn update -r $FFMPEG_EXTERNALS_REVISION $FFMPEG_CO_DIR/libswscale
45     fi
46 else
47     echo "Subversion needed for ffmpeg checkout, please install and/or add to \$PATH"
48     exit 0
49 fi
50
51 # source helper functions
52 if test ! -f common/gst-autogen.sh;
53 then
54   echo There is something wrong with your source tree.
55   echo You are missing common/gst-autogen.sh
56   exit 1
57 fi
58 . common/gst-autogen.sh
59
60 # install pre-commit hook for doing clean commits
61 if test ! \( -x .git/hooks/pre-commit -a -L .git/hooks/pre-commit \);
62 then
63     rm -f .git/hooks/pre-commit
64     ln -s ../../common/hooks/pre-commit.hook .git/hooks/pre-commit
65 fi
66
67 autogen_options $@
68
69 printf "+ check for build tools"
70 if test ! -z "$NOCHECK"; then echo " skipped"; else  echo; fi
71 version_check "autoconf" "$AUTOCONF autoconf autoconf-2.54 autoconf-2.53 autoconf-2.52" \
72               "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 52 || DIE=1
73 version_check "automake" "$AUTOMAKE automake automake-1.11 automake-1.10 automake-1.9 automake-1.7 automake-1.6 automake-1.5" \
74               "ftp://ftp.gnu.org/pub/gnu/automake/" 1 6 || DIE=1
75 version_check "libtoolize" "$LIBTOOLIZE libtoolize libtoolize14 glibtoolize" \
76               "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 4 0 || DIE=1
77 version_check "pkg-config" "" \
78               "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1
79
80 die_check $DIE
81
82 autoconf_2_52d_check || DIE=1
83 aclocal_check || DIE=1
84 autoheader_check || DIE=1
85
86 die_check $DIE
87
88 # if no arguments specified then this will be printed
89 if test -z "$*"; then
90   echo "+ checking for autogen.sh options"
91   echo "  This autogen script will automatically run ./configure as:"
92   echo "  ./configure $CONFIGURE_DEF_OPT"
93   echo "  To pass any additional options, please specify them on the $0"
94   echo "  command line."
95 fi
96
97 toplevel_check $srcfile
98
99 tool_run "$libtoolize" "--copy --force"
100 tool_run "$aclocal" "-I common/m4 $ACLOCAL_FLAGS"
101 tool_run "$autoheader"
102
103 # touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo
104 echo timestamp > stamp-h.in 2> /dev/null
105
106 tool_run "$autoconf"
107 tool_run "$automake" "-a -c -Wno-portability"
108
109 # if enable exists, add an -enable option for each of the lines in that file
110 if test -f enable; then
111   for a in `cat enable`; do
112     CONFIGURE_FILE_OPT="--enable-$a"
113   done
114 fi
115
116 # if disable exists, add an -disable option for each of the lines in that file
117 if test -f disable; then
118   for a in `cat disable`; do
119     CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a"
120   done
121 fi
122
123 test -n "$NOCONFIGURE" && {
124   echo "+ skipping configure stage for package $package, as requested."
125   echo "+ autogen.sh done."
126   exit 0
127 }
128
129 echo "+ running configure ... "
130 test ! -z "$CONFIGURE_DEF_OPT" && echo "  ./configure default flags: $CONFIGURE_DEF_OPT"
131 test ! -z "$CONFIGURE_EXT_OPT" && echo "  ./configure external flags: $CONFIGURE_EXT_OPT"
132 test ! -z "$CONFIGURE_FILE_OPT" && echo "  ./configure enable/disable flags: $CONFIGURE_FILE_OPT"
133 echo
134
135 ./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || {
136         echo "  configure failed"
137         exit 1
138 }
139
140 echo
141 echo "Now type 'make' to compile $package."