autogen.sh: avoid touching .po files during 'make'
[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-ugly
6 srcfile=ext/mad/gstmad.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 # install pre-commit hook for doing clean commits
26 if test ! \( -x .git/hooks/pre-commit -a -L .git/hooks/pre-commit \);
27 then
28     rm -f .git/hooks/pre-commit
29     ln -s ../../common/hooks/pre-commit.hook .git/hooks/pre-commit
30 fi
31
32 # GNU gettext automake support doesn't get along with git.
33 # https://bugzilla.gnome.org/show_bug.cgi?id=661128
34 touch -t 200001010000 po/$package-0.10.pot
35
36 CONFIGURE_DEF_OPT='--enable-maintainer-mode --enable-gtk-doc'
37
38 autogen_options $@
39
40 printf "+ check for build tools"
41 if test ! -z "$NOCHECK"; then echo " skipped"; else  echo; fi
42 version_check "autoconf" "$AUTOCONF autoconf autoconf270 autoconf269 autoconf268 autoconf267 autoconf266 autoconf265 autoconf264 autoconf263 autoconf262 autoconf261 autoconf260" \
43               "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 60 || DIE=1
44 version_check "automake" "$AUTOMAKE automake automake-1.11 automake-1.10" \
45               "ftp://ftp.gnu.org/pub/gnu/automake/" 1 10 || DIE=1
46 version_check "autopoint" "autopoint" \
47               "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 17 || DIE=1
48 version_check "libtoolize" "$LIBTOOLIZE libtoolize glibtoolize" \
49               "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 5 0 || DIE=1
50 version_check "pkg-config" "" \
51               "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1
52
53 die_check $DIE
54
55 autoconf_2_52d_check || DIE=1
56 aclocal_check || DIE=1
57 autoheader_check || DIE=1
58
59 die_check $DIE
60
61 # if no arguments specified then this will be printed
62 if test -z "$*"; then
63   echo "+ checking for autogen.sh options"
64   echo "  This autogen script will automatically run ./configure as:"
65   echo "  ./configure $CONFIGURE_DEF_OPT"
66   echo "  To pass any additional options, please specify them on the $0"
67   echo "  command line."
68 fi
69
70 toplevel_check $srcfile
71
72 # autopoint
73 #    older autopoint (< 0.12) has a tendency to complain about mkinstalldirs
74 if test -x mkinstalldirs; then rm mkinstalldirs; fi
75 #    first remove patch if necessary, then run autopoint, then reapply
76 if test -f po/Makefile.in.in;
77 then
78   patch -p0 -R < common/gettext.patch
79 fi
80 tool_run "$autopoint --force"
81 patch -p0 < common/gettext.patch
82
83 tool_run "$libtoolize" "--copy --force"
84 tool_run "$aclocal" "-I m4 -I common/m4 $ACLOCAL_FLAGS"
85 tool_run "$autoheader"
86
87 # touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode
88 echo timestamp > stamp-h.in 2> /dev/null
89
90 tool_run "$autoconf"
91 tool_run "$automake" "-a -c"
92
93 # if enable exists, add an -enable option for each of the lines in that file
94 if test -f enable; then
95   for a in `cat enable`; do
96     CONFIGURE_FILE_OPT="--enable-$a"
97   done
98 fi
99
100 # if disable exists, add an -disable option for each of the lines in that file
101 if test -f disable; then
102   for a in `cat disable`; do
103     CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a"
104   done
105 fi
106
107 test -n "$NOCONFIGURE" && {
108   echo "+ skipping configure stage for package $package, as requested."
109   echo "+ autogen.sh done."
110   exit 0
111 }
112
113 echo "+ running configure ... "
114 test ! -z "$CONFIGURE_DEF_OPT" && echo "  ./configure default flags: $CONFIGURE_DEF_OPT"
115 test ! -z "$CONFIGURE_EXT_OPT" && echo "  ./configure external flags: $CONFIGURE_EXT_OPT"
116 test ! -z "$CONFIGURE_FILE_OPT" && echo "  ./configure enable/disable flags: $CONFIGURE_FILE_OPT"
117 echo
118
119 ./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || {
120         echo "  configure failed"
121         exit 1
122 }
123
124 echo "Now type 'make' to compile $package."