autogen.sh 3.66 KB
Newer Older
David Schleef's avatar
David Schleef committed
1
#!/bin/sh
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
2 3 4
# Run this to generate all the initial makefiles, etc.

DIE=0
5
package=gst-plugins-base
6
srcfile=gst/audiotestsrc/gstaudiotestsrc.c
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
7

Edward Hervey's avatar
Edward Hervey committed
8 9
# Make sure we have common
if test ! -f common/gst-autogen.sh;
10
then
Edward Hervey's avatar
Edward Hervey committed
11 12
  echo "+ Setting up common submodule"
  git submodule init
13
fi
Edward Hervey's avatar
Edward Hervey committed
14
git submodule update
15

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
16
# source helper functions
David Schleef's avatar
David Schleef committed
17
if test ! -f common/gst-autogen.sh;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
18 19 20
then
  echo There is something wrong with your source tree.
  echo You are missing common/gst-autogen.sh
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
21 22
  exit 1
fi
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
23
. common/gst-autogen.sh
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
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 29
    rm -f .git/hooks/pre-commit
    ln -s ../../common/hooks/pre-commit.hook .git/hooks/pre-commit
30 31 32
fi


33
CONFIGURE_DEF_OPT='--enable-maintainer-mode --enable-gtk-doc'
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
34

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
35
autogen_options $@
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
36

37
printf "+ check for build tools"
38
if test ! -z "$NOCHECK"; then echo " skipped"; else  echo; fi
39 40
version_check "autoconf" "$AUTOCONF autoconf autoconf270 autoconf269 autoconf268 autoconf267 autoconf266 autoconf265 autoconf264 autoconf263 autoconf262 autoconf261 autoconf260" \
              "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 60 || DIE=1
41 42
version_check "automake" "$AUTOMAKE automake automake-1.11 automake-1.10" \
              "ftp://ftp.gnu.org/pub/gnu/automake/" 1 10 || DIE=1
43
version_check "autopoint" "autopoint" \
44
              "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 17 || DIE=1
45
version_check "libtoolize" "$LIBTOOLIZE libtoolize glibtoolize" \
46
              "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 5 0 || DIE=1
47 48
version_check "pkg-config" "" \
              "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
49

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
50 51
die_check $DIE

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
52
aclocal_check || DIE=1
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
53
autoheader_check || DIE=1
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
54

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
55 56
die_check $DIE

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
57
# if no arguments specified then this will be printed
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
58
if test -z "$*"; then
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
59 60 61 62 63
  echo "+ checking for autogen.sh options"
  echo "  This autogen script will automatically run ./configure as:"
  echo "  ./configure $CONFIGURE_DEF_OPT"
  echo "  To pass any additional options, please specify them on the $0"
  echo "  command line."
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
64 65
fi

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
66 67
toplevel_check $srcfile

68 69
# autopoint
#    older autopoint (< 0.12) has a tendency to complain about mkinstalldirs
70
if test -x mkinstalldirs; then rm mkinstalldirs; fi
71 72 73
#    first remove patch if necessary, then run autopoint, then reapply
if test -f po/Makefile.in.in;
then
74
  patch -p0 -R --forward < common/gettext.patch
75
fi
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
76
tool_run "$autopoint --force"
77 78
patch -p0 < common/gettext.patch

79
tool_run "$libtoolize" "--copy --force"
80
tool_run "$aclocal" "-I m4 -I common/m4 $ACLOCAL_FLAGS"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
81
tool_run "$autoheader"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
82

83
# touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode
84
echo timestamp > stamp-h.in 2> /dev/null
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
85

86
tool_run "$autoconf"
87
tool_run "$automake" "-a -c"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
88

89 90 91
# if enable exists, add an -enable option for each of the lines in that file
if test -f enable; then
  for a in `cat enable`; do
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
92
    CONFIGURE_FILE_OPT="--enable-$a"
93 94 95 96 97 98
  done
fi

# if disable exists, add an -disable option for each of the lines in that file
if test -f disable; then
  for a in `cat disable`; do
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
99
    CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a"
100 101 102
  done
fi

103
test -n "$NOCONFIGURE" && {
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
104 105 106
  echo "+ skipping configure stage for package $package, as requested."
  echo "+ autogen.sh done."
  exit 0
107
}
108

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
109
echo "+ running configure ... "
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
110 111
test ! -z "$CONFIGURE_DEF_OPT" && echo "  ./configure default flags: $CONFIGURE_DEF_OPT"
test ! -z "$CONFIGURE_EXT_OPT" && echo "  ./configure external flags: $CONFIGURE_EXT_OPT"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
112
test ! -z "$CONFIGURE_FILE_OPT" && echo "  ./configure enable/disable flags: $CONFIGURE_FILE_OPT"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
113 114
echo

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
115
./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || {
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
116 117
        echo "  configure failed"
        exit 1
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
118 119 120
}

echo "Now type 'make' to compile $package."