]> Creatis software - gdcm.git/blob - autogen.sh
added autoconf tools for library (src) and C++ test (Test) compilation
[gdcm.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 srcdir=`dirname $0`
5 test -z "$srcdir" && srcdir=.
6
7 PKG_NAME="crea"
8
9 (test -f $srcdir/configure.in \
10   && test -d $srcdir/src) || {
11      echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
12      echo " top-level crea directory"
13      exit 1
14 }
15
16
17 DIE=0
18
19 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
20   echo
21   echo "**Error**: You must have \`autoconf' installed to compile Gnome."
22   echo "Download the appropriate package for your distribution,"
23   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
24   DIE=1
25 }
26
27 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
28   (libtool --version) < /dev/null > /dev/null 2>&1 || {
29     echo
30     echo "**Error**: You must have \`libtool' installed to compile Gnome."
31     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
32     echo "(or a newer version if it is available)"
33     DIE=1
34   }
35 }
36
37 grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
38   grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
39   (gettext --version) < /dev/null > /dev/null 2>&1 || {
40     echo
41     echo "**Error**: You must have \`gettext' installed to compile Gnome."
42     echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
43     echo "(or a newer version if it is available)"
44     DIE=1
45   }
46 }
47
48 (automake --version) < /dev/null > /dev/null 2>&1 || {
49   echo
50   echo "**Error**: You must have \`automake' installed to compile Gnome."
51   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
52   echo "(or a newer version if it is available)"
53   DIE=1
54   NO_AUTOMAKE=yes
55 }
56
57
58 # if no automake, don't bother testing for aclocal
59 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
60   echo
61   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
62   echo "installed doesn't appear recent enough."
63   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
64   echo "(or a newer version if it is available)"
65   DIE=1
66 }
67
68 if test "$DIE" -eq 1; then
69   exit 1
70 fi
71
72 if test -z "$*"; then
73   echo "**Warning**: I am going to run \`configure' with no arguments."
74   echo "If you wish to pass any to it, please specify them on the"
75   echo \`$0\'" command line."
76   echo
77 fi
78
79 case $CC in
80 xlc )
81   am_opt=--include-deps;;
82 esac
83
84 for coin in `find $srcdir -name configure.in -print`
85 do 
86   dr=`dirname $coin`
87   if test -f $dr/NO-AUTO-GEN; then
88     echo skipping $dr -- flagged as no auto-gen
89   else
90     echo processing $dr
91     macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
92     ( cd $dr
93       aclocalinclude="-I . $ACLOCAL_FLAGS"
94       for k in $macrodirs; do
95         if test -d $k; then
96           aclocalinclude="$aclocalinclude -I $k"
97         ##else 
98         ##  echo "**Warning**: No such directory \`$k'.  Ignored."
99         fi
100       done
101       if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
102         if grep "sed.*POTFILES" configure.in >/dev/null; then
103           : do nothing -- we still have an old unmodified configure.in
104         else
105           echo "Creating $dr/aclocal.m4 ..."
106           test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
107           echo "Running gettextize...  Ignore non-fatal messages."
108           echo "no" | gettextize --force --copy
109           echo "Making $dr/aclocal.m4 writable ..."
110           test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
111         fi
112       fi
113       if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
114         echo "Running libtoolize..."
115         libtoolize --force --copy
116       fi
117       echo "Running aclocal $aclocalinclude ..."
118       aclocal $aclocalinclude
119       if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
120         echo "Running autoheader..."
121         autoheader
122       fi
123       echo "Running automake --gnu $am_opt ..."
124       automake --add-missing --gnu $am_opt
125       echo "Running autoconf ..."
126       autoconf
127     )
128   fi
129 done
130
131 conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
132
133 if test x$NOCONFIGURE = x; then
134   echo Running $srcdir/configure $conf_flags "$@" ...
135   $srcdir/configure $conf_flags "$@" \
136   && echo Now type \`make\' to compile $PKG_NAME || exit 1
137 else
138   echo Skipping configure process.
139 fi