autogen.sh 3.9 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-good
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
12
srcfile=gst/law/alaw.c
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
13

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

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
23
# source helper functions
David Schleef's avatar
David Schleef committed
24
if test ! -f common/gst-autogen.sh;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
25 26 27
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
28 29
  exit 1
fi
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
30
. common/gst-autogen.sh
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
31

32
# install pre-commit hook for doing clean commits
33
if test ! \( -x .git/hooks/pre-commit -a -L .git/hooks/pre-commit \);
34
then
35 36
    rm -f .git/hooks/pre-commit
    ln -s ../../common/hooks/pre-commit.hook .git/hooks/pre-commit
37 38
fi

39 40 41
# GNU gettext automake support doesn't get along with git.
# https://bugzilla.gnome.org/show_bug.cgi?id=661128
touch -t 200001010000 po/gst-plugins-good-0.10.pot
42

43
CONFIGURE_DEF_OPT='--enable-maintainer-mode --enable-gtk-doc'
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
44

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
45
autogen_options $@
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
46

47
printf "+ check for build tools"
48
if test ! -z "$NOCHECK"; then echo " skipped"; else  echo; fi
49 50 51 52
version_check "autoconf" "$AUTOCONF autoconf autoconf270 autoconf269 autoconf268 autoconf267 autoconf266 autoconf265 autoconf264 autoconf263 autoconf262" \
              "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 62 || DIE=1
version_check "automake" "$AUTOMAKE automake automake-1.11" \
              "ftp://ftp.gnu.org/pub/gnu/automake/" 1 11 || DIE=1
53
version_check "autopoint" "autopoint" \
54
              "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 17 || DIE=1
55
version_check "libtoolize" "$LIBTOOLIZE libtoolize glibtoolize" \
56
              "ftp://ftp.gnu.org/pub/gnu/libtool/" 2 2 6 || DIE=1
57 58
version_check "pkg-config" "" \
              "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
59

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

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
62
aclocal_check || DIE=1
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
63
autoheader_check || DIE=1
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
64

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
65 66
die_check $DIE

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

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
76 77
toplevel_check $srcfile

78 79
# autopoint
#    older autopoint (< 0.12) has a tendency to complain about mkinstalldirs
80
if test -x mkinstalldirs; then rm mkinstalldirs; fi
81
#    first remove patch if necessary, then run autopoint, then reapply
82 83 84 85 86 87
if test -f po/Makefile.in.in;
then
  patch -p0 -R < common/gettext.patch
fi
tool_run "$autopoint --force"
patch -p0 < common/gettext.patch
88

89
tool_run "$libtoolize" "--copy --force"
90
tool_run "$aclocal" "-I m4 -I common/m4 $ACLOCAL_FLAGS"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
91
tool_run "$autoheader"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
92

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

96
tool_run "$autoconf"
97
tool_run "$automake" "-a -c"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
98

99 100 101
# 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
102
    CONFIGURE_FILE_OPT="--enable-$a"
103 104 105 106 107 108
  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
109
    CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a"
110 111 112
  done
fi

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

119 120
cd "$olddir"

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
121
echo "+ running configure ... "
122 123 124
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
125 126
echo

127
"$srcdir/configure" $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || {
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
128 129
        echo "  configure failed"
        exit 1
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
130 131 132
}

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