2000-06-07 04:52:18 +04:00
|
|
|
#!/bin/sh
|
|
|
|
# Build all of the am-utils package in a directory A.<cpu-company-system>
|
|
|
|
# Used by am-utils users.
|
|
|
|
# Erez Zadok <ezk@cs.columbia.edu>
|
|
|
|
#
|
|
|
|
# run "buildall -h" to get usage
|
|
|
|
#
|
|
|
|
#set -x
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# first test if we are in the right directory to run this script
|
|
|
|
# change to the right directory
|
2000-11-20 02:42:08 +03:00
|
|
|
test -f ../config.guess && cd ..
|
|
|
|
test -f ../../config.guess && cd ../..
|
2000-06-07 04:52:18 +04:00
|
|
|
pwd=`pwd`
|
2000-11-20 02:42:08 +03:00
|
|
|
host_alias=`(cd /tmp; $pwd/config.guess.long)`
|
2000-06-07 04:52:18 +04:00
|
|
|
if test -z "$host_alias" ; then
|
|
|
|
echo "$0: must run from the source or the A. directory."
|
2000-11-20 02:42:08 +03:00
|
|
|
echo "$0: cannot find $pwd/config.guess"
|
2000-06-07 04:52:18 +04:00
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# pattern of lines to remove from config.cache (for developers only)
|
|
|
|
# Example: if you change TRY_COMPILE_NFS, redo these:
|
|
|
|
#pat='fhandle|nfs_fh|nfs_args|struct_nfs|opt'
|
|
|
|
#pat='style_|mount_trap|mtype|transport|dref'
|
|
|
|
#pat='mntent|mnttab'
|
|
|
|
#pat='nfs_args|fh_len|irix|proto|vers'
|
|
|
|
#pat='3|proto|tcp|ver|nfs_prot|mtype'
|
|
|
|
#pat='trap|style|mtype|transport|os_libs|restartable|unmount_args|yp_order'
|
|
|
|
#pat='yp_all|nsl|nis'
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# initialize variables (build command, config command, variables)
|
|
|
|
bld_cmd=""
|
|
|
|
bld_flags=""
|
|
|
|
cnf_cmd=""
|
2002-11-30 01:57:11 +03:00
|
|
|
cnf_flags="-C" # use config.cache cache file
|
2004-11-27 04:00:29 +03:00
|
|
|
inst_cmd=""
|
|
|
|
inst_flags=""
|
2000-06-07 04:52:18 +04:00
|
|
|
mkcnf_cmd=""
|
|
|
|
vars=""
|
|
|
|
expvars=""
|
|
|
|
default=yes
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# check if CFLAGS or AM_CFLAGS was passed
|
|
|
|
test -z "$CFLAGS" || vars="$vars CFLAGS=\"${CFLAGS}\""
|
|
|
|
test -z "$CFLAGS" || expvars="$expvars CFLAGS"
|
|
|
|
test -z "$AM_CFLAGS" || vars="$vars AM_CFLAGS=\"${AM_CFLAGS}\""
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# functions
|
|
|
|
|
|
|
|
add_gcc_flags1 () {
|
|
|
|
case "${CC}" in
|
|
|
|
cc | */cc )
|
|
|
|
# do nothing
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
vars="$vars AM_CFLAGS=\"-Werror\""
|
|
|
|
AM_CFLAGS="-Werror"
|
|
|
|
expvars="$expvars AM_CFLAGS"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
add_gcc_flags2 () {
|
|
|
|
case "${CC}" in
|
|
|
|
cc | */cc )
|
|
|
|
# do nothing
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
vars="$vars AM_CFLAGS=\"-Wall -Werror\""
|
|
|
|
AM_CFLAGS="-Wall -Werror"
|
|
|
|
expvars="$expvars AM_CFLAGS"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
add_shared_flags () {
|
|
|
|
cnf_cmd="$cnf_cmd --enable-shared --disable-static"
|
|
|
|
}
|
|
|
|
|
|
|
|
add_prefix_flags () {
|
|
|
|
cnf_cmd="$cnf_cmd --prefix=/usr/local/AMD"
|
|
|
|
}
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# iterate over all options, and set the command to run with any variables
|
|
|
|
while [ $# != 0 ]; do
|
|
|
|
case "$1" in
|
|
|
|
-b )
|
|
|
|
# look for GNU make if possible
|
|
|
|
gmake --version -f /dev/null > /dev/null 2>&1
|
|
|
|
if [ $? = 0 ]
|
|
|
|
then
|
|
|
|
bld_cmd="${MAKE:-gmake}"
|
|
|
|
else
|
|
|
|
bld_cmd="${MAKE:-make}"
|
|
|
|
fi
|
|
|
|
default=no
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2004-11-27 04:00:29 +03:00
|
|
|
-i )
|
|
|
|
# look for GNU make if possible
|
|
|
|
gmake --version -f /dev/null > /dev/null 2>&1
|
|
|
|
if [ $? = 0 ]
|
|
|
|
then
|
|
|
|
inst_cmd="${MAKE:-gmake} install"
|
|
|
|
else
|
|
|
|
inst_cmd="${MAKE:-make} install"
|
|
|
|
fi
|
|
|
|
default=no
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2000-06-07 04:52:18 +04:00
|
|
|
-c )
|
|
|
|
cnf_cmd="../configure --enable-debug=yes"
|
|
|
|
# add_gcc_flags1
|
|
|
|
default=no
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
-cs )
|
|
|
|
cnf_cmd="../configure --enable-debug=yes"
|
|
|
|
add_shared_flags
|
|
|
|
# add_gcc_flags1
|
|
|
|
default=no
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
-C )
|
|
|
|
cnf_cmd="../configure --enable-debug=yes"
|
|
|
|
add_gcc_flags2
|
|
|
|
default=no
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
-Cs )
|
|
|
|
cnf_cmd="../configure --enable-debug=yes"
|
|
|
|
add_shared_flags
|
|
|
|
add_gcc_flags2
|
|
|
|
default=no
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
-d )
|
|
|
|
cnf_cmd="../configure --enable-debug=yes"
|
|
|
|
add_prefix_flags
|
|
|
|
# add_gcc_flags1
|
|
|
|
default=no
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
-ds )
|
|
|
|
cnf_cmd="../configure --enable-debug=yes"
|
|
|
|
add_prefix_flags
|
|
|
|
add_shared_flags
|
|
|
|
# add_gcc_flags1
|
|
|
|
default=no
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
-D )
|
|
|
|
cnf_cmd="../configure --enable-debug=yes"
|
|
|
|
add_prefix_flags
|
|
|
|
add_gcc_flags2
|
|
|
|
default=no
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
-Ds )
|
2002-11-30 01:57:11 +03:00
|
|
|
cnf_cmd="../configure -enable-debug=yes"
|
2004-11-27 04:00:29 +03:00
|
|
|
# cnf_cmd="../configure -enable-debug=mem"
|
2000-06-07 04:52:18 +04:00
|
|
|
# cnf_cmd="../configure --prefix=/usr/local/AMD --enable-debug=yes --enable-shared --disable-static \
|
|
|
|
# --enable-cppflags=\"-I${HOME}/ldap/include -I${HOME}/hesiod/include\" \
|
|
|
|
# --enable-ldflags=\"-L${HOME}/ldap/lib -L${HOME}/hesiod/lib\""
|
|
|
|
# cnf_cmd="$cnf_cmd \
|
|
|
|
# --enable-cppflags=-I${HOME}/ldap/include \
|
|
|
|
# --enable-ldflags=-L${HOME}/ldap/lib"
|
2004-11-27 04:00:29 +03:00
|
|
|
# cnf_cmd="../configure -enable-debug=yes --enable-cppflags=-I/usr/local/include --enable-ldflags=-L/usr/local/lib"
|
2000-06-07 04:52:18 +04:00
|
|
|
add_prefix_flags
|
|
|
|
add_shared_flags
|
|
|
|
add_gcc_flags2
|
|
|
|
default=no
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
-K )
|
2003-03-09 04:12:05 +03:00
|
|
|
# mkcnf_cmd="../m4/mkconf"
|
2000-11-20 02:42:08 +03:00
|
|
|
mkcnf_cmd="../bootstrap"
|
|
|
|
if test -f bootstrap ; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "am-utils maintainer option only!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2000-06-07 04:52:18 +04:00
|
|
|
default=no
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
-q )
|
|
|
|
cnf_cmd="./config.status"
|
|
|
|
default=no
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
-- )
|
|
|
|
shift
|
2002-11-30 01:57:11 +03:00
|
|
|
cmdline_cnf_flags="$*"
|
2000-06-07 04:52:18 +04:00
|
|
|
break # from while loop
|
|
|
|
;;
|
|
|
|
|
|
|
|
-h | * )
|
|
|
|
cat <<EOF
|
2002-11-30 01:57:11 +03:00
|
|
|
Usage: buildall [-b] [-[cCdD][s]] [-K] [-q] [-h] [-- configopts]
|
2000-06-07 04:52:18 +04:00
|
|
|
-b: build only
|
|
|
|
-c: configure (debugging)
|
|
|
|
-cs: configure (debugging, shared libs)
|
|
|
|
-C: configure (strict compile, debugging)
|
|
|
|
-Cs: configure (strict compile, debugging, shared libs)
|
|
|
|
-d: configure in /usr/local/AMD (debugging)
|
|
|
|
-ds: configure in /usr/local/AMD (debugging, shared libs)
|
|
|
|
-D: configure in /usr/local/AMD (strict compile, debugging)
|
|
|
|
-Ds: configure in /usr/local/AMD (strict compile, debugging, shared libs)
|
|
|
|
-K: run mkconf to update *.in files (developers only)
|
2004-11-27 04:00:29 +03:00
|
|
|
-i: build and install
|
2001-05-13 21:32:48 +04:00
|
|
|
-q: quick configure only (run config.status)
|
2000-06-07 04:52:18 +04:00
|
|
|
-h: print usage
|
2002-11-30 01:57:11 +03:00
|
|
|
configopts: options to pass to configure (must be last and after a --)
|
2000-06-07 04:52:18 +04:00
|
|
|
You may pass variables: CFLAGS for build, MAKE for your make program
|
|
|
|
and AM_CFLAGS for additional build flags.
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# if AM_CFLAGS was set before, then add it to the configure option
|
|
|
|
if test -n "${AM_CFLAGS}"; then
|
2002-11-30 01:57:11 +03:00
|
|
|
extra_cnf_flags="--enable-am-cflags=${AM_CFLAGS}"
|
2000-06-07 04:52:18 +04:00
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|
|
|
|
|
|
|
|
# check if no options were given, and set to defaults
|
|
|
|
if test "$default" = "yes"; then
|
|
|
|
# look for GNU make if possible
|
|
|
|
gmake --version -f /dev/null > /dev/null 2>&1
|
|
|
|
if [ $? = 0 ]
|
|
|
|
then
|
|
|
|
bld_cmd="${MAKE:-gmake}"
|
|
|
|
else
|
|
|
|
bld_cmd="${MAKE:-make}"
|
|
|
|
fi
|
|
|
|
cnf_cmd="../configure"
|
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# make build directory if needed
|
|
|
|
if test -d ./A.${host_alias} ; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
mkdir ./A.${host_alias}
|
|
|
|
fi
|
2006-02-05 19:12:04 +03:00
|
|
|
echo "Configuring/building am-utils in directory ./A.${host_alias} ..."
|
2000-06-07 04:52:18 +04:00
|
|
|
echo cd ./A.${host_alias}
|
|
|
|
cd ./A.${host_alias} || exit 1
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# this is for developers only (remove config.cache entries)
|
|
|
|
if test -n "$pat"; then
|
|
|
|
if test -f config.cache; then
|
|
|
|
egrep $pat config.cache | while read i; do echo ' '$i;done
|
|
|
|
egrep -v $pat config.cache > tmp.$$ && \
|
|
|
|
mv config.cache config.cache.old && mv tmp.$$ config.cache
|
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# Some system's /bin/sh has limits/bugs which prevent it from being used
|
|
|
|
# with configure
|
|
|
|
case "${host_alias}" in
|
2002-11-30 01:57:11 +03:00
|
|
|
*hpux9* | *aix5.1* )
|
|
|
|
if test -n "$cnf_cmd"; then
|
|
|
|
if test -f /bin/bash; then
|
|
|
|
cnf_cmd="/bin/bash $cnf_cmd"
|
|
|
|
elif test -f /bin/ksh; then
|
|
|
|
cnf_cmd="/bin/ksh $cnf_cmd"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
:
|
2000-06-07 04:52:18 +04:00
|
|
|
fi
|
|
|
|
echo "WARNING: do not use /bin/make under this system."
|
|
|
|
echo "Instead, use GNU make or 'ksh ./configure' directly."
|
|
|
|
;;
|
|
|
|
mips-sgi-irix5.2)
|
|
|
|
echo "WARNING: do not use /bin/make under this system."
|
|
|
|
echo "Instead, use GNU make or ./configure directly."
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# see if need to run mkconf
|
|
|
|
if test -n "$mkcnf_cmd"; then
|
|
|
|
echo $mkcnf_cmd
|
|
|
|
$mkcnf_cmd || exit 1
|
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# see if need to [re]configure
|
|
|
|
if test -n "$cnf_cmd"; then
|
|
|
|
if test -n "$vars"; then
|
|
|
|
echo $vars
|
|
|
|
eval $vars
|
|
|
|
echo export $expvars
|
|
|
|
export $expvars
|
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|
2002-11-30 01:57:11 +03:00
|
|
|
if test -z "${cnf_flags}${extra_cnf_flags}"; then
|
2004-11-27 04:00:29 +03:00
|
|
|
echo $cnf_cmd $cmdline_cnf_flags
|
|
|
|
$cnf_cmd $cmdline_cnf_flags || exit 1
|
2000-06-07 04:52:18 +04:00
|
|
|
else
|
2004-11-27 04:00:29 +03:00
|
|
|
echo $cnf_cmd "$cnf_flags" "$extra_cnf_flags" $cmdline_cnf_flags
|
|
|
|
$cnf_cmd "$cnf_flags" "$extra_cnf_flags" $cmdline_cnf_flags || exit 1
|
2000-06-07 04:52:18 +04:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# if need to [re]build
|
|
|
|
if test -n "$bld_cmd"; then
|
2004-11-27 04:00:29 +03:00
|
|
|
echo $bld_cmd $bld_flags
|
|
|
|
$bld_cmd $bld_flags || exit 1
|
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# if need to install
|
|
|
|
if test -n "$inst_cmd"; then
|
|
|
|
echo $inst_cmd $inst_flags
|
|
|
|
$inst_cmd $inst_flags || exit 1
|
2000-06-07 04:52:18 +04:00
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|
|
|
|
|
|
|
|
##############################################################################
|