autogen.sh : Use git 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-plugins-base
6 srcfile=gst/audiotestsrc/gstaudiotestsrc.c
7
8 # Make sure we have common
9 if test ! -f common/gst-autogen.sh;
10 then
11   echo "+ Setting up common submodule"
12   git submodule init
13 fi
14 git submodule update
15
16 # source helper functions
17 if test ! -f common/gst-autogen.sh;
18 then
19   echo There is something wrong with your source tree.
20   echo You are missing common/gst-autogen.sh
21   exit 1
22 fi
23 . common/gst-autogen.sh
24
25 CONFIGURE_DEF_OPT='--enable-maintainer-mode --enable-gtk-doc --enable-plugin-docs'
26
27 autogen_options $@
28
29 echo -n "+ check for build tools"
30 if test ! -z "$NOCHECK"; then echo " skipped"; else  echo; fi
31 version_check "autoconf" "$AUTOCONF autoconf autoconf259 autoconf257 autoconf-2.54 autoconf-2.53 autoconf-2.52" \
32               "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 52 || DIE=1
33 version_check "automake" "$AUTOMAKE automake automake-1.9 automake19 automake-1.7 automake-1.6 automake-1.5" \
34               "ftp://ftp.gnu.org/pub/gnu/automake/" 1 7 || DIE=1
35 version_check "autopoint" "autopoint" \
36               "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 17 || DIE=1
37 version_check "libtoolize" "$LIBTOOLIZE libtoolize glibtoolize" \
38               "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 5 0 || DIE=1
39 version_check "pkg-config" "" \
40               "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1
41
42 die_check $DIE
43
44 autoconf_2_52d_check || DIE=1
45 aclocal_check || DIE=1
46 autoheader_check || DIE=1
47
48 die_check $DIE
49
50 # if no arguments specified then this will be printed
51 if test -z "$*"; then
52   echo "+ checking for autogen.sh options"
53   echo "  This autogen script will automatically run ./configure as:"
54   echo "  ./configure $CONFIGURE_DEF_OPT"
55   echo "  To pass any additional options, please specify them on the $0"
56   echo "  command line."
57 fi
58
59 toplevel_check $srcfile
60
61 # autopoint
62 #    older autopoint (< 0.12) has a tendency to complain about mkinstalldirs
63 if test -x mkinstalldirs; then rm mkinstalldirs; fi
64 #    first remove patch if necessary, then run autopoint, then reapply
65 if test -f po/Makefile.in.in;
66 then
67   patch -p0 -R --forward < common/gettext.patch
68 fi
69 tool_run "$autopoint --force"
70 patch -p0 < common/gettext.patch
71
72 tool_run "$aclocal" "-I m4 -I common/m4 $ACLOCAL_FLAGS"
73 tool_run "$libtoolize" "--copy --force"
74 tool_run "$autoheader"
75
76 # touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo
77 echo timestamp > stamp-h.in 2> /dev/null
78
79 tool_run "$autoconf"
80 tool_run "$automake" "-a -c -Wno-portability"
81
82 # if enable exists, add an -enable option for each of the lines in that file
83 if test -f enable; then
84   for a in `cat enable`; do
85     CONFIGURE_FILE_OPT="--enable-$a"
86   done
87 fi
88
89 # if disable exists, add an -disable option for each of the lines in that file
90 if test -f disable; then
91   for a in `cat disable`; do
92     CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a"
93   done
94 fi
95
96 test -n "$NOCONFIGURE" && {
97   echo "+ skipping configure stage for package $package, as requested."
98   echo "+ autogen.sh done."
99   exit 0
100 }
101
102 echo "+ running configure ... "
103 test ! -z "$CONFIGURE_DEF_OPT" && echo "  ./configure default flags: $CONFIGURE_DEF_OPT"
104 test ! -z "$CONFIGURE_EXT_OPT" && echo "  ./configure external flags: $CONFIGURE_EXT_OPT"
105 test ! -z "$CONFIGURE_FILE_OPT" && echo "  ./configure enable/disable flags: $CONFIGURE_FILE_OPT"
106 echo
107
108 ./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || {
109         echo "  configure failed"
110         exit 1
111 }
112
113 echo "Now type 'make' to compile $package."