From: <br...@us...> - 2007-07-31 07:12:38
|
Revision: 216 http://libirc.svn.sourceforge.net/libirc/?rev=216&view=rev Author: brlcad Date: 2007-07-31 00:12:31 -0700 (Tue, 31 Jul 2007) Log Message: ----------- add a bunch of boilerplate m4 macros to simplify the configure logic a bit Added Paths: ----------- trunk/libirc/m4/ trunk/libirc/m4/args.m4 trunk/libirc/m4/cache.m4 trunk/libirc/m4/mkdirp.m4 trunk/libirc/m4/search.m4 trunk/libirc/m4/stage.m4 Added: trunk/libirc/m4/args.m4 =================================================================== --- trunk/libirc/m4/args.m4 (rev 0) +++ trunk/libirc/m4/args.m4 2007-07-31 07:12:31 UTC (rev 216) @@ -0,0 +1,239 @@ +# A R G S . M 4 +# BRL-CAD +# +# Copyright (c) 2005-2007 United States Government as represented by +# the U.S. Army Research Laboratory. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +### +# +# BC_ARG_ENABLE +# +# creates a configure --enable argument that simply sets a VARIABLE as +# to whether the feature is enabled or not. The arguments expected +# include the variable name, the --enable-FEATURE name, a help string, +# and a default value. provides bc_VARIABLE and bc_VARIABLE_default +# variables. +# +# +# BC_ARG_ALIAS +# +# creates an --enable alias. argument aliases do not show up in help, +# so the only expected arguments to the macro is the variable name, +# and the FEATURE alias name. +# +# +# BC_ARG_WITH +# +# creates a configure --with argument setting one FEATURE VARIABLE if +# the value was with or without (yes/no) and another FEATURE_val for +# the actual value. provides bc_VARIABLE and bc_VARIABLE_default +# variables. +# +# +# BC_ARG_WITH_ALIAS +# +# same as BC_ARG_ALIAS except that it sets the FEATURE_val VARIABLE +# too. BC_ARG_ALIAS will work as a simplified alternative if the +# FEATURE_val variable is not used (i.e. only a yes/no matters) +# +# +# BC_WITH_FLAG_ARGS +# +# provides convenience argument handlers for specifying CFLAGS, +# LDFLAGS, CPPFLAGS, and LIBS. more specifically, it adds +# --with-cflags, --with-cppflags, --with-ldflags, --with-libs. +# +### + +AC_DEFUN([BC_ARG_ENABLE], [ + +dnl XXX this was a failed attempt to get AC_ARG_ENABLE to grok an argument name +dnl ifelse([$1], [], [errprint([ERROR: missing first argument (the variable name) to BC_ARG_ENABLE])]) +dnl _bc_arg_name=ifelse([$2], [], [$1], [$2]) +dnl _bc_arg_help=ifelse([$4], [], +dnl [ifelse([$3], [], [enable $2], [$3])], +dnl [ifelse([$3], [], [enable $2 (default=$4)], [$3 (default=$4)] )] +dnl) + +# BC_ARG_ENABLE 1:[$1] 2:[$2] 3:[$3] 4:[$4] +bc_[$1]=[$4] +bc_[$1]_default=[$4] +bc_[$1]_set=no +AC_ARG_ENABLE([$2], AC_HELP_STRING([--enable-$2], [$3 (default=$4)]), + [ + bc_[$1]_set=yes + case "x$enableval" in + x[[yY]][[eE]][[sS]]) + bc_[$1]=yes + ;; + x[[nN]][[oO]]) + bc_[$1]=no + ;; + x) + bc_[$1]=yes + ;; + x*) + AC_MSG_NOTICE([*** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***]) + AC_MSG_NOTICE([Unexpected value of [$enableval] to --enable-[$2] (expecting yes/no)]) + bc_[$1]="$enableval" + ;; + esac + ] +) +]) + + +AC_DEFUN([BC_ARG_ALIAS], [ +# BC_ARG_ALIAS 1:[$1] 2:[$2] +AC_ARG_ENABLE([$2],, + [ + bc_[$1]_set=yes + case "x$enableval" in + x[[yY]][[eE]][[sS]]) + bc_[$1]=yes + ;; + x[[nN]][[oO]]) + bc_[$1]=no + ;; + x) + bc_[$1]=yes + ;; + x*) + bc_[$1]="$enableval" + ;; + esac + ] +) +]) + + +AC_DEFUN([BC_ARG_WITH], [ +# BC_ARG_WITH 1:[$1] 2:[$2] 3:[$3] 4:[$4] 5:[$5] +bc_[$1]=[$4] +bc_[$1]_val=[$5] +bc_[$1]_default=[$4] +bc_[$1]_set=no +AC_ARG_WITH([$2], AC_HELP_STRING([--with-$2], [$3]), + [ + bc_[$1]_set=yes + case "x$withval" in + x[[yY]][[eE]][[sS]]) + bc_[$1]=yes + bc_[$1]_val=yes + ;; + x[[nN]][[oO]]) + bc_[$1]=no + bc_[$1]_val=no + ;; + x) + bc_[$1]=yes + bc_[$1]_val="$withval" + ;; + x*) + bc_[$1]=yes + bc_[$1]_val="$withval" + ;; + esac + ] +) +]) + + +AC_DEFUN([BC_ARG_WITH_ALIAS], [ +# BC_ARG_WITH_ALIAS 1:[$1] 2:[$2] +AC_ARG_WITH([$2],, + [ + bc_[$1]_set=yes + case "x$withval" in + x[[yY]][[eE]][[sS]]) + bc_[$1]=yes + bc_[$1]_val=yes + ;; + x[[nN]][[oO]]) + bc_[$1]=no + bc_[$1]_val=no + ;; + x) + bc_[$1]=yes + bc_[$1]_val="$withval" + ;; + x*) + bc_[$1]=yes + bc_[$1]_val="$withval" + ;; + esac + ] +) +]) + + +AC_DEFUN([BC_WITH_FLAG_ARGS], [ +AC_ARG_WITH(cflags, AC_HELP_STRING(--with-cflags, + [Specify additional flags to pass to the C compiler]), + [ + if test "x$withval" != "xno" ; then + CFLAGS="$CFLAGS $withval" + fi + ] +) +AC_ARG_WITH(cppflags, AC_HELP_STRING(--with-cppflags, + [Specify additional flags to pass to C preprocessor]), + [ + if test "x$withval" != "xno"; then + CPPFLAGS="$CPPFLAGS $withval" + fi + ] +) +AC_ARG_WITH(ldflags, AC_HELP_STRING(--with-ldflags, + [Specify additional flags to pass to linker]), + [ + if test "x$withval" != "xno" ; then + LDFLAGS="$LDFLAGS $withval" + fi + ] +) +AC_ARG_WITH(libs, AC_HELP_STRING(--with-libs, + [Specify additional libraries to link against]), + [ + if test "x$withval" != "xno" ; then + LIBS="$LIBS $withval" + fi + ] +) +]) + +# Local Variables: +# mode: m4 +# tab-width: 8 +# standard-indent: 4 +# indent-tabs-mode: t +# End: +# ex: shiftwidth=4 tabstop=8 Added: trunk/libirc/m4/cache.m4 =================================================================== --- trunk/libirc/m4/cache.m4 (rev 0) +++ trunk/libirc/m4/cache.m4 2007-07-31 07:12:31 UTC (rev 216) @@ -0,0 +1,112 @@ +# C A C H E . M 4 +# BRL-CAD +# +# Copyright (c) 2005-2007 United States Government as represented by +# the U.S. Army Research Laboratory. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +### +# +# BC_CONFIG_CACHE +# +# automatically enable and load the configure cache file if available +# +### + +AC_DEFUN([BC_CONFIG_CACHE], [ +AC_MSG_CHECKING([whether a configure cache exists]) +if test "x$cache_file" = "x/dev/null" ; then + configure_cache=ifelse([$1], , [config.cache.${host_os}], [$1]) + CONFIG_CACHE="" + if test -f "$configure_cache"; then + if test "x`cat $configure_cache | grep ac_cv_env_CC_value`" != "xac_cv_env_CC_value=$CC" ; then + dnl if the compiler we're using now doesn't + dnl match the compiler used in the previous + dnl cached results, invalidate it. + AC_MSG_RESULT([found but compiler differs]) + rm -f "$configure_cache" + elif test "x`cat $configure_cache | grep ac_cv_env_CPPFLAGS_value`" != "xac_cv_env_CPPFLAGS_value=$CPPFLAGS" ; then + dnl if the preprocessor flags we're using now + dnl doesn't match the flags used in the + dnl previous cached results, invalidate it. + AC_MSG_RESULT([found but preprocessor flags differ]) + rm -f "$configure_cache" + else + dnl if the configure script has been modified + dnl since the last caching, assume it to be + dnl invalid. + last_modified="`ls -Lt $configure_cache configure`" + case "x$last_modified" in + xconfigure*) + AC_MSG_RESULT([found but out of date]) + rm -f $configure_cache + ;; + esac + fi + + dnl if the cache still exists, load it + if test -f "$configure_cache" ; then + dnl go ahead and load the cache + AC_MSG_RESULT([found $configure_cache]) + case $configure_cache in + [\\/]* | ?:[\\/]* ) + . $configure_cache + ;; + *) + . ./$configure_cache + ;; + esac + fi + else + AC_MSG_RESULT([not found]) + fi + + dnl if we are on sgi, bash may choke on bad sed syntax in the cache + if test "x$host_os" != "xirix6.5" ; then + AC_MSG_NOTICE([*** Automatically caching to $configure_cache ***]) + >$configure_cache + cache_file="$configure_cache" + CONFIG_CACHE="$cache_file" + else + AC_MSG_NOTICE([Automatic caching is unavailable on IRIX]) + fi + AC_SUBST(CONFIG_CACHE) +else + AC_MSG_RESULT($cache_file) +fi +]) + +# Local Variables: +# mode: m4 +# tab-width: 8 +# standard-indent: 4 +# indent-tabs-mode: t +# End: +# ex: shiftwidth=4 tabstop=8 Added: trunk/libirc/m4/mkdirp.m4 =================================================================== --- trunk/libirc/m4/mkdirp.m4 (rev 0) +++ trunk/libirc/m4/mkdirp.m4 2007-07-31 07:12:31 UTC (rev 216) @@ -0,0 +1,77 @@ +###################################################################### +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. + +# Copyright (C) 2003, 2004 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p]) +# automake 1.10+ seems to use uppercase instead +MKDIR_P="$mkdir_p" +AC_SUBST([MKDIR_P])]) Added: trunk/libirc/m4/search.m4 =================================================================== --- trunk/libirc/m4/search.m4 (rev 0) +++ trunk/libirc/m4/search.m4 2007-07-31 07:12:31 UTC (rev 216) @@ -0,0 +1,107 @@ +# S E A R C H . M 4 +# BRL-CAD +# +# Copyright (c) 2005-2007 United States Government as represented by +# the U.S. Army Research Laboratory. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +### +# +# BC_SEARCH_DIRECTORY +# +# designates a directory that should get searched for libraries, +# headers, and binaries. optional second argument is the directory +# group name. +# +### + +### +AC_DEFUN([BC_SEARCH_DIRECTORY], [ +search_dir="$1" +search_label="$2" +bc_dir_msg="" +if test "x$search_label" = "x" ; then + bc_dir_msg="for" +else + bc_dir_msg="for $search_label in" +fi + +AC_MSG_CHECKING([$bc_dir_msg $search_dir]) +if test -d "$search_dir" ; then + bc_found=0 + if test -d "${search_dir}/bin" ; then + if test "x$PATH" = "x" ; then + PATH="${search_dir}/bin" + else + PATH="${PATH}:${search_dir}/bin" + fi + bc_found=1 + fi + if test -d "${search_dir}/include" ; then + if test "x$CPPFLAGS" = "x" ; then + CPPFLAGS="-I${search_dir}/include" + else + CPPFLAGS="${CPPFLAGS} -I${search_dir}/include" + fi + bc_found=1 + fi + if test -d "${search_dir}/lib64" ; then + if test "x$LDFLAGS" = "x" ; then + LDFLAGS="-L${search_dir}/lib64" + else + LDFLAGS="${LDFLAGS} -L${search_dir}/lib64" + fi + bc_found=1 + fi + if test -d "${search_dir}/lib" ; then + if test "x$LDFLAGS" = "x" ; then + LDFLAGS="-L${search_dir}/lib" + else + LDFLAGS="${LDFLAGS} -L${search_dir}/lib" + fi + bc_found=1 + fi + if test "x$bc_found" = "x1" ; then + AC_MSG_RESULT([found]) + else + AC_MSG_RESULT([found, but empty]) + fi +else + AC_MSG_RESULT([not found]) +fi +]) + +# Local Variables: +# mode: m4 +# tab-width: 8 +# standard-indent: 4 +# indent-tabs-mode: t +# End: +# ex: shiftwidth=4 tabstop=8 Added: trunk/libirc/m4/stage.m4 =================================================================== --- trunk/libirc/m4/stage.m4 (rev 0) +++ trunk/libirc/m4/stage.m4 2007-07-31 07:12:31 UTC (rev 216) @@ -0,0 +1,91 @@ +# S T A G E . M 4 +# BRL-CAD +# +# Copyright (c) 2005-2007 United States Government as represented by +# the U.S. Army Research Laboratory. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +### +# +# BC_BOLD +# BC_UNBOLD +# +# sets and unsets the output to bold for emphasis +# +# +# BC_CONFIGURE_STAGE +# +# outputs status on the the specified configure stage being started. +# +### + +AC_DEFUN([BC_BOLD], [ +if test -t 1 ; then + if test -f "${srcdir}/sh/shtool" ; then + ${srcdir}/sh/shtool echo -n -e %B + elif test -f "${srcdir}/misc/shtool" ; then + ${srcdir}/misc/shtool echo -n -e %B + fi +fi +]) + + +AC_DEFUN([BC_UNBOLD], [ +if test -t 1 ; then + if test -f "${srcdir}/sh/shtool" ; then + ${srcdir}/sh/shtool echo -n -e %b + elif test -f "${srcdir}/misc/shtool" ; then + ${srcdir}/misc/shtool echo -n -e %b + fi +fi +]) + + +AC_DEFUN([BC_CONFIGURE_STAGE], [ + +_bc_stage="[$1]" +_bc_status="[$2]" +_bc_stage="`echo $_bc_stage | sed 's/\(.\)/\1 /g'`" + +BC_BOLD + +AC_MSG_CHECKING([... $_bc_stage]) +AC_MSG_RESULT([($_bc_status)]) + +BC_UNBOLD +]) + +# Local Variables: +# mode: m4 +# tab-width: 8 +# standard-indent: 4 +# indent-tabs-mode: t +# End: +# ex: shiftwidth=4 tabstop=8 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |