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