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

4 5 6 7 8 9
test -n "$srcdir" || srcdir=`dirname "$0"`
test -n "$srcdir" || srcdir=.

olddir=`pwd`
cd "$srcdir"

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
10
DIE=0
11
package=gst-plugins-base
12
srcfile=gst/audiotestsrc/gstaudiotestsrc.c
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
13

Edward Hervey's avatar
Edward Hervey committed
14 15
# Make sure we have common
if test ! -f common/gst-autogen.sh;
16
then
Edward Hervey's avatar
Edward Hervey committed
17 18
  echo "+ Setting up common submodule"
  git submodule init
19
fi
Edward Hervey's avatar
Edward Hervey committed
20
git submodule update
21

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
22
# source helper functions
David Schleef's avatar
David Schleef committed
23
if test ! -f common/gst-autogen.sh;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
24 25 26
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
27 28
  exit 1
fi
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
29
. common/gst-autogen.sh
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
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 35
    rm -f .git/hooks/pre-commit
    ln -s ../../common/hooks/pre-commit.hook .git/hooks/pre-commit
36 37 38
fi


39
CONFIGURE_DEF_OPT='--enable-maintainer-mode --enable-gtk-doc'
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
40

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
41
autogen_options $@
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
42

43
printf "+ check for build tools"
44
if test ! -z "$NOCHECK"; then echo " skipped"; else  echo; fi
45 46
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
47 48
version_check "automake" "$AUTOMAKE automake automake-1.11 automake-1.10" \
              "ftp://ftp.gnu.org/pub/gnu/automake/" 1 10 || DIE=1
49
version_check "autopoint" "autopoint" \
50
              "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 17 || DIE=1
51
version_check "libtoolize" "$LIBTOOLIZE libtoolize glibtoolize" \
52
              "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 5 0 || DIE=1
53 54
version_check "pkg-config" "" \
              "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
55

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

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
58
aclocal_check || DIE=1
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
59
autoheader_check || DIE=1
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
60

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
61 62
die_check $DIE

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
63
# if no arguments specified then this will be printed
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
64
if test -z "$*"; then
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
65 66 67 68 69
  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
70 71
fi

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
72 73
toplevel_check $srcfile

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

85
tool_run "$libtoolize" "--copy --force"
86
tool_run "$aclocal" "-I m4 -I common/m4 $ACLOCAL_FLAGS"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
87
tool_run "$autoheader"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
88

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

92
tool_run "$autoconf"
93
tool_run "$automake" "-a -c"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
94

95 96 97
# 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
98
    CONFIGURE_FILE_OPT="--enable-$a"
99 100 101 102 103 104
  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
105
    CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a"
106 107 108
  done
fi

109
test -n "$NOCONFIGURE" && {
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
110 111 112
  echo "+ skipping configure stage for package $package, as requested."
  echo "+ autogen.sh done."
  exit 0
113
}
114

115 116
cd "$olddir"

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
117
echo "+ running configure ... "
118 119 120
test ! -z "$CONFIGURE_DEF_OPT" && echo "  $srcdir/configure default flags: $CONFIGURE_DEF_OPT"
test ! -z "$CONFIGURE_EXT_OPT" && echo "  $srcdir/configure external flags: $CONFIGURE_EXT_OPT"
test ! -z "$CONFIGURE_FILE_OPT" && echo "  $srcdir/configure enable/disable flags: $CONFIGURE_FILE_OPT"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
121 122
echo

123
"$srcdir/configure" $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || {
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
124 125
        echo "  configure failed"
        exit 1
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
126 127 128
}

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