morphbr@534: #!/bin/sh
morphbr@534: # Run this to generate all the initial makefiles, etc.
morphbr@534: 
morphbr@534: DIE=0
morphbr@534: package=libgnomevfs2-mythtv
morphbr@534: srcfile=configure.ac
morphbr@534: 
morphbr@534: # a quick cvs co if necessary to alleviate the pain - may remove this
morphbr@534: # when developers get a clue ;)
morphbr@534: if test ! -d common; 
morphbr@534: then 
morphbr@534:   echo "+ getting common/ from cvs"
morphbr@534:   cvs co common 
morphbr@534: fi
morphbr@534: 
morphbr@534: # source helper functions
morphbr@534: if test ! -f common/autogen-helper.sh;
morphbr@534: then
morphbr@534:   echo There is something wrong with your source tree.
morphbr@534:   echo You are missing common/autogen-helper.sh
morphbr@534:   exit 1
morphbr@534: fi
morphbr@534: . common/autogen-helper.sh
morphbr@534: 
morphbr@534: CONFIGURE_DEF_OPT='--enable-maintainer-mode'
morphbr@534: 
morphbr@534: autogen_options $*
morphbr@534: 
morphbr@534: echo -n "+ check for build tools"
morphbr@534: if test ! -z "$NOCHECK"; then echo " skipped"; else  echo; fi
morphbr@534: version_check "autoconf" "$AUTOCONF autoconf autoconf-2.54 autoconf-2.53" \
morphbr@534:               "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 53 || DIE=1
morphbr@534: version_check "automake" "$AUTOMAKE automake automake-1.9 automake-1.8 automake-1.7 automake-1.6" \
morphbr@534:               "ftp://ftp.gnu.org/pub/gnu/automake/" 1 6 || DIE=1
morphbr@534: version_check "libtoolize" "$LIBTOOLIZE libtoolize" \
morphbr@534:               "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 5 0 || DIE=1
morphbr@534: version_check "pkg-config" "" \
morphbr@534:               "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1
morphbr@534: 
morphbr@534: die_check $DIE
morphbr@534: 
morphbr@534: aclocal_check || DIE=1
morphbr@534: autoheader_check || DIE=1
morphbr@534: 
morphbr@534: die_check $DIE
morphbr@534: 
morphbr@534: # if no arguments specified then this will be printed
morphbr@534: if test -z "$*"; then
morphbr@534:   echo "+ checking for autogen.sh options"
morphbr@534:   echo "  This autogen script will automatically run ./configure as:"
morphbr@534:   echo "  ./configure $CONFIGURE_DEF_OPT"
morphbr@534:   echo "  To pass any additional options, please specify them on the $0"
morphbr@534:   echo "  command line."
morphbr@534: fi
morphbr@534: 
morphbr@534: toplevel_check $srcfile
morphbr@534: 
morphbr@534: tool_run "$aclocal" "-I m4 $ACLOCAL_FLAGS"
morphbr@534: tool_run "$libtoolize" "--copy --force"
morphbr@534: tool_run "$autoheader"
morphbr@534: 
morphbr@534: # touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo
morphbr@534: echo timestamp > stamp-h.in 2> /dev/null
morphbr@534: 
morphbr@534: tool_run "$autoconf"
morphbr@534: tool_run "$automake" "-a -c"
morphbr@534: 
morphbr@534: # if enable exists, add an -enable option for each of the lines in that file
morphbr@534: if test -f enable; then
morphbr@534:   for a in `cat enable`; do
morphbr@534:     CONFIGURE_FILE_OPT="--enable-$a"
morphbr@534:   done
morphbr@534: fi
morphbr@534: 
morphbr@534: # if disable exists, add an -disable option for each of the lines in that file
morphbr@534: if test -f disable; then
morphbr@534:   for a in `cat disable`; do
morphbr@534:     CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a"
morphbr@534:   done
morphbr@534: fi
morphbr@534: 
morphbr@534: test -n "$NOCONFIGURE" && {
morphbr@534:   echo "+ skipping configure stage for package $package, as requested."
morphbr@534:   echo "+ autogen.sh done."
morphbr@534:   exit 0
morphbr@534: }
morphbr@534: 
morphbr@534: echo "+ running configure ... "
morphbr@534: test ! -z "$CONFIGURE_DEF_OPT" && echo "  ./configure default flags: $CONFIGURE_DEF_OPT"
morphbr@534: test ! -z "$CONFIGURE_EXT_OPT" && echo "  ./configure external flags: $CONFIGURE_EXT_OPT"
morphbr@534: test ! -z "$CONFIGURE_FILE_OPT" && echo "  ./configure enable/disable flags: $CONFIGURE_FILE_OPT"
morphbr@534: echo
morphbr@534: 
morphbr@534: ./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || {
morphbr@534:         echo "  configure failed"
morphbr@534:         exit 1
morphbr@534: }
morphbr@534: 
morphbr@534: echo "Now type 'make' to compile $package."