Merge remote-tracking branch 'origin/0.10'
[platform/upstream/gstreamer.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 test -n "$srcdir" || srcdir=`dirname "$0"`
5 test -n "$srcdir" || srcdir=.
6
7 olddir=`pwd`
8 cd "$srcdir"
9
10 DIE=0
11 package=gstreamer
12 srcfile=gst/gst.c
13
14 # Make sure we have common
15 if test ! -f common/gst-autogen.sh;
16 then
17   echo "+ Setting up common submodule"
18   git submodule init
19 fi
20 git submodule update
21
22 # source helper functions
23 if test ! -f common/gst-autogen.sh;
24 then
25   echo There is something wrong with your source tree.
26   echo You are missing common/gst-autogen.sh
27   exit 1
28 fi
29 . common/gst-autogen.sh
30
31 # install pre-commit hook for doing clean commits
32 if test ! \( -x .git/hooks/pre-commit -a -L .git/hooks/pre-commit \);
33 then
34     rm -f .git/hooks/pre-commit
35     ln -s ../../common/hooks/pre-commit.hook .git/hooks/pre-commit
36 fi
37
38 # GNU gettext automake support doesn't get along with git.
39 # https://bugzilla.gnome.org/show_bug.cgi?id=661128
40 touch -t 200001010000 po/gstreamer-0.10.pot
41
42 CONFIGURE_DEF_OPT='--enable-maintainer-mode --enable-failing-tests --enable-poisoning --enable-gtk-doc --enable-docbook'
43
44 autogen_options $@
45
46 printf "+ check for build tools"
47 if test ! -z "$NOCHECK"; then echo ": skipped version checks"; else  echo; fi
48 version_check "autoconf" "$AUTOCONF autoconf autoconf270 autoconf269 autoconf268 autoconf267 autoconf266 autoconf265 autoconf264 autoconf263 autoconf262" \
49               "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 62 || DIE=1
50 version_check "automake" "$AUTOMAKE automake automake-1.11" \
51               "ftp://ftp.gnu.org/pub/gnu/automake/" 1 11 || DIE=1
52 version_check "autopoint" "autopoint" \
53               "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 17 || DIE=1
54 version_check "libtoolize" "libtoolize glibtoolize" \
55               "ftp://ftp.gnu.org/pub/gnu/libtool/" 2 2 6 || DIE=1
56 version_check "pkg-config" "" \
57               "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1
58
59 die_check $DIE
60
61 aclocal_check || DIE=1
62 autoheader_check || DIE=1
63
64 die_check $DIE
65
66 # if no arguments specified then this will be printed
67 if test -z "$*" && test -z "$NOCONFIGURE"; then
68   echo "+ checking for autogen.sh options"
69   echo "  This autogen script will automatically run ./configure as:"
70   echo "  ./configure $CONFIGURE_DEF_OPT"
71   echo "  To pass any additional options, please specify them on the $0"
72   echo "  command line."
73 fi
74
75 toplevel_check $srcfile
76
77 # autopoint
78 #    older autopoint (< 0.12) has a tendency to complain about mkinstalldirs
79 if test -x mkinstalldirs; then rm mkinstalldirs; fi
80 #    first remove patch if necessary, then run autopoint, then reapply
81 if test -f po/Makefile.in.in;
82 then
83   patch -p0 -R --forward < common/gettext.patch
84 fi
85 tool_run "$autopoint" "--force" "patch -p0 < common/gettext.patch"
86 patch -p0 < common/gettext.patch
87
88 # aclocal
89 if test -f acinclude.m4; then rm acinclude.m4; fi
90
91 tool_run "$libtoolize" "--copy --force"
92 tool_run "$aclocal" "-I m4 -I common/m4 $ACLOCAL_FLAGS"
93 tool_run "$autoheader"
94
95 # touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode
96 echo timestamp > stamp-h.in 2> /dev/null
97
98 tool_run "$autoconf"
99 debug "automake: $automake"
100 tool_run "$automake" "--add-missing --copy"
101
102 test -n "$NOCONFIGURE" && {
103   echo "skipping configure stage for package $package, as requested."
104   echo "autogen.sh done."
105   exit 0
106 }
107
108 cd "$olddir"
109
110 echo "+ running configure ... "
111 test ! -z "$CONFIGURE_DEF_OPT" && echo "  ./configure default flags: $CONFIGURE_DEF_OPT"
112 test ! -z "$CONFIGURE_EXT_OPT" && echo "  ./configure external flags: $CONFIGURE_EXT_OPT"
113 echo
114
115 echo "$srcdir/configure" $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT
116 "$srcdir/configure" $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT || {
117         echo "  configure failed"
118         exit 1
119 }
120
121 echo "Now type 'make' to compile $package."
122