Use new text accessors.
[geda-gaf/berndj.git] / libgeda / autogen.sh
blobcc0c7cfdab19c4aabf0843a815f7a0c37ba16e5a
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
4 # This file came from glade-2.0.0 with modifications for gEDA/gaf.
5 # Ales Hvezda 11/09/2003
7 srcdir=`dirname $0`
8 test -z "$srcdir" && srcdir=.
9 configure_script=configure.ac.in
11 # If "recreate_configure_only" is specified on the command line as the first
12 # argument, then enter a special mode to rebuild configure only. If we add
13 # arguments to this script, then this has to be made a bit more intelligent.
14 if test "$1" = "recreate_configure_only"; then
15 recreate_configure_only=1
16 else
17 recreate_configure_only=0
20 # Automake required version
21 AM_1=1 # Major number
22 AM_2=6
23 AM_3=0 # Minor number
25 # Possible names for libtool/libtoolize
26 libtoolize_candidates="libtoolize glibtoolize"
28 DIE=0
30 (test -f $srcdir/$configure_script) || {
31 echo -n "**Error**: Directory [ $srcdir ] does not look like the"
32 echo " top-level package directory"
33 exit 1
36 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
37 echo
38 echo "**Error**: You must have \`autoconf' installed."
39 echo "Download the appropriate package for your distribution,"
40 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
41 DIE=1
44 (grep "^AM_PROG_LIBTOOL" $srcdir/$configure_script >/dev/null) && {
45 LIBTOOLIZE=`which $libtoolize_candidates 2>/dev/null | head -n1`
46 (! test -z "$LIBTOOLIZE") || {
47 echo
48 echo "**Error**: You must have \`libtool' installed."
49 echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
50 DIE=1
54 (grep "^AM_GNU_GETTEXT" $srcdir/$configure_script >/dev/null) && {
55 (grep "sed.*POTFILES" $srcdir/$configure_script) > /dev/null || \
56 (autopoint --version) < /dev/null > /dev/null 2>&1 || {
57 echo
58 echo "**Error**: You must have \`gettext' installed."
59 echo "You can get it from: http://www.gnu.org/software/gettext"
60 DIE=1
64 (automake --version) < /dev/null > /dev/null 2>&1 || {
65 echo
66 echo "**Error**: You must have \`automake' installed."
67 echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
68 DIE=1
69 NO_AUTOMAKE=yes
72 # check automake version. Test came from gpsd version 2.34. cnieves 2007-02-10
73 if [ -z "$NO_AUTOMAKE" ]; then
74 AM_VERSION=`automake --version | sed -n -e 's#[^0-9]* \([0-9]*\)\.\([0-9]*\)\.*\([0-9]*\).*$#\1 \2 \3#p'`
75 AM_V1=`echo $AM_VERSION | awk '{print $1}'`
76 AM_V2=`echo $AM_VERSION | awk '{print $2}'`
77 AM_V3=`echo $AM_VERSION | awk '{print $3}'`
79 if [ "$AM_1" -gt "$AM_V1" ]; then
80 AM_ERROR=1
81 else
82 if [ "$AM_1" -eq "$AM_V1" ]; then
83 if [ "$AM_2" -gt "$AM_V2" ]; then
84 AM_ERROR=1
85 else
86 if [ "$AM_2" -eq "$AM_V2" ]; then
87 if [ -n "$AM_V3" -a "$AM_3" -gt "$AM_V3" ]; then
88 AM_ERROR=1
95 if [ -n "$AM_ERROR" ]; then
96 echo
97 echo "**Error**: Found automake version $AM_V1.$AM_V2.$AM_V3"
98 echo "You must have \`automake' version $AM_1.$AM_2.$AM_3 or greater installed."
99 echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
100 DIE=1
106 # if no automake, don't bother testing for aclocal
107 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
108 echo
109 echo "**Error**: Missing \`aclocal'. The version of \`automake'"
110 echo "installed doesn't appear recent enough."
111 echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
112 DIE=1
115 if test "$DIE" -eq 1; then
116 exit 1
119 # Don't run configure automatically.
120 #if test -z "$*"; then
121 # echo "**Warning**: I am going to run \`configure' with no arguments."
122 # echo "If you wish to pass any to it, please specify them on the"
123 # echo \`$0\'" command line."
124 # echo
127 case $CC in
128 xlc )
129 am_opt=--include-deps;;
130 esac
132 # Create the configure.ac from the configure.ac.in file.
133 # The below line to get the gettext version isn't the most robust construct
134 # because if gettext changes its version output format, this will break.
135 echo autogen.sh creating configure.ac
136 installed_gettext_version=`gettext --version | grep gettext | awk '{print $4}'`
137 cat $configure_script | \
138 sed "s/%INSTALLED_GETTEXT_VERSION%/$installed_gettext_version/" > configure.ac
139 configure_script=configure.ac
141 for coin in $srcdir/$configure_script
143 dr=`dirname $coin`
144 if test -f $dr/NO-AUTO-GEN; then
145 echo skipping $dr -- flagged as no auto-gen
146 else
147 echo processing $dr
148 ( cd $dr
150 aclocalinclude="$ACLOCAL_FLAGS"
152 if test "$recreate_configure_only" = "0"; then
153 # Only run these if we are NOT in the recreate_configure_only mode
154 if grep "^AM_GNU_GETTEXT" $configure_script >/dev/null; then
155 echo "autogen.sh running: autopoint ..."
156 echo "no" | autopoint --force
158 if grep "^IT_PROG_INTLTOOL" $configure_script >/dev/null; then
159 echo "autogen.sh running: intltoolize ..."
160 echo "no" | intltoolize --force --copy --automake
162 if grep "^AM_PROG_LIBTOOL" $configure_script >/dev/null; then
163 echo "autogen.sh running: libtoolize ..."
164 $LIBTOOLIZE --force --copy
168 echo "autogen.sh running: aclocal $aclocalinclude ..."
169 aclocal $aclocalinclude
170 status=$?
171 if test ! "$status" = 0; then
172 echo autogen.sh exiting...
173 exit $status
176 if grep "^AM_CONFIG_HEADER" $configure_script >/dev/null; then
177 echo "autogen.sh running: autoheader ..."
178 autoheader
181 if test "$recreate_configure_only" = "0"; then
182 # Only run these if we are NOT in the recreate_configure_only mode
183 echo "autogen.sh running: automake $am_opt ..."
184 automake --copy --add-missing --gnu $am_opt
187 echo "autogen.sh running: autoconf ..."
188 autoconf
191 done
194 # Don't run configure.
195 #conf_flags="--enable-maintainer-mode"
197 #if test x$NOCONFIGURE = x; then
198 # echo Running $srcdir/configure $conf_flags "$@" ...
199 # $srcdir/configure $conf_flags "$@" \
200 # && echo Now type \`make\' to compile. || exit 1
201 #else
202 # echo Skipping configure process.