autogen.sh 3.95 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
fi

38 39 40
# 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-base-0.10.pot
41

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

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

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

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

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

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

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

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

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

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

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

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

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

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

118 119
cd "$olddir"

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

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

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