http://linux-ntfs.sourceforge.net/snapshots/ntfsprogs-200309071734.tar.bz2
[ntfsprogs.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 DIE=0
5
6 if test x$srcdir = x; then
7   srcdir=.
8 fi
9
10 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
11   echo
12   echo "**Error**: You must have \`autoconf' installed to compile Linux-NTFS."
13   echo "Download the appropriate package for your distribution,"
14   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
15   DIE=1
16 }
17
18 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
19   (libtool --version) < /dev/null > /dev/null 2>&1 || {
20     echo
21     echo "**Error**: You must have \`libtool' installed to compile Linux-NTFS."
22     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
23     echo "(or a newer version if it is available)"
24     DIE=1
25   }
26 }
27
28 (automake --version) < /dev/null > /dev/null 2>&1 || {
29   echo
30   echo "**Error**: You must have \`automake' installed to compile Linux-NTFS."
31   echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.3.tar.gz"
32   echo "(or a newer version if it is available)"
33   DIE=1
34   NO_AUTOMAKE=yes
35 }
36
37 # if no automake, don't bother testing for aclocal
38 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
39   echo
40   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
41   echo "installed doesn't appear recent enough."
42   echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.3.tar.gz"
43   echo "(or a newer version if it is available)"
44   DIE=1
45 }
46
47 if test "$DIE" -eq 1; then
48   exit 1
49 fi
50
51 if test -z "$*"; then
52   echo "**Warning**: I am going to run \`configure' with no arguments."
53   echo "If you wish to pass any to it, please specify them on the"
54   echo \`$0\'" command line."
55   echo
56 fi
57
58 case $CC in
59 xlc )
60   am_opt=--include-deps;;
61 esac
62
63 for coin in `find $srcdir -name configure.ac -print`
64 do 
65   dr=`dirname $coin`
66   if test -f $dr/NO-AUTO-GEN; then
67     echo skipping $dr -- flagged as no auto-gen
68   else
69     echo processing $dr
70     macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
71     ( cd $dr
72       macrosdir=`find . -name macros -print`
73       aclocalinclude="$ACLOCAL_FLAGS"
74       for k in $macrodirs; do
75         if test -d $k; then
76           aclocalinclude="$aclocalinclude -I $k"
77         fi
78       done
79       if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
80         if test -z "$NO_LIBTOOLIZE" ; then 
81           echo "Running libtoolize..."
82           libtoolize --force --copy
83         fi
84       fi
85       echo "Running aclocal $aclocalinclude ..."
86       aclocal $aclocalinclude || {
87         echo
88         echo "**Error**: aclocal failed. This may mean that you have not"
89         echo "installed all of the packages you need, or you may need to"
90         echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
91         echo "for the prefix where you installed the packages whose"
92         echo "macros were not found"
93         exit 1
94       }
95
96       if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
97         echo "Running autoheader..."
98         autoheader || { echo "**Error**: autoheader failed."; exit 1; }
99       fi
100       echo "Running automake --gnu $am_opt ..."
101       automake --add-missing --gnu $am_opt ||
102         { echo "**Error**: automake failed."; exit 1; }
103       echo "Running autoconf ..."
104       autoconf || { echo "**Error**: autoconf failed."; exit 1; }
105     ) || exit 1
106   fi
107 done
108
109 conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
110
111 if test x$NOCONFIGURE = x; then
112   echo Running $srcdir/configure $conf_flags "$@" ...
113   $srcdir/configure $conf_flags "$@" \
114   && echo Now type \`make\' to compile $PKG_NAME || exit 1
115 else
116   echo Skipping configure process.
117 fi