upload tizen1.0 source
[framework/multimedia/gstreamer0.10-ffmpeg.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 autoconf270 autoconf269 autoconf268 autoconf267 autoconf266 autoconf265 autoconf264 autoconf263 autoconf262 autoconf261 autoconf260" \
72               "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 60 || DIE=1
73 version_check "automake" "$AUTOMAKE automake automake-1.11 automake-1.10" \
74               "ftp://ftp.gnu.org/pub/gnu/automake/" 1 10 || DIE=1
75 version_check "libtoolize" "$LIBTOOLIZE libtoolize glibtoolize" \
76               "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 5 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 aclocal_check || DIE=1
83 autoheader_check || DIE=1
84
85 die_check $DIE
86
87 # if no arguments specified then this will be printed
88 if test -z "$*"; then
89   echo "+ checking for autogen.sh options"
90   echo "  This autogen script will automatically run ./configure as:"
91   echo "  ./configure $CONFIGURE_DEF_OPT"
92   echo "  To pass any additional options, please specify them on the $0"
93   echo "  command line."
94 fi
95
96 toplevel_check $srcfile
97
98 tool_run "$libtoolize" "--copy --force"
99 tool_run "$aclocal" "-I m4 -I common/m4 $ACLOCAL_FLAGS"
100 tool_run "$autoheader"
101
102 # touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo
103 echo timestamp > stamp-h.in 2> /dev/null
104
105 tool_run "$autoconf"
106 tool_run "$automake" "-a -c -Wno-portability"
107
108 # if enable exists, add an -enable option for each of the lines in that file
109 if test -f enable; then
110   for a in `cat enable`; do
111     CONFIGURE_FILE_OPT="--enable-$a"
112   done
113 fi
114
115 # if disable exists, add an -disable option for each of the lines in that file
116 if test -f disable; then
117   for a in `cat disable`; do
118     CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a"
119   done
120 fi
121
122 test -n "$NOCONFIGURE" && {
123   echo "+ skipping configure stage for package $package, as requested."
124   echo "+ autogen.sh done."
125   exit 0
126 }
127 exit 0
128 echo "+ running configure ... "
129 test ! -z "$CONFIGURE_DEF_OPT" && echo "  ./configure default flags: $CONFIGURE_DEF_OPT"
130 test ! -z "$CONFIGURE_EXT_OPT" && echo "  ./configure external flags: $CONFIGURE_EXT_OPT"
131 test ! -z "$CONFIGURE_FILE_OPT" && echo "  ./configure enable/disable flags: $CONFIGURE_FILE_OPT"
132 echo
133
134 ./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || {
135         echo "  configure failed"
136         exit 1
137 }
138
139 echo
140 echo "Now type 'make' to compile $package."