autogen definitions conftest.tpl; /* */ author = "Bruce Korb "; /* Time-stamp: "2007-07-04 09:31:45 bkorb" * Last Modified: $Date: 2007/07/04 20:51:18 $ * by: bkorb * * This file is part of AutoGen. * * AutoGen copyright (c) 1992-2007 Bruce Korb - all rights reserved * * AutoGen 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 3 of the License, or * (at your option) any later version. * * AutoGen 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, see . * ------------------------------------------------------------------- * $Id: misc.def,v 4.20 2007/07/04 20:51:18 bkorb Exp $ * ------------------------------------------------------------------- */ group = ag; version = "$Revision: 4.20 $"; output-file = ag_macros.m4; test = { name = shell; type = disable; check = 'using shell scripts'; action = { act-type = define; }; action = { act-type = script; act-text = <<- _EOF_ AC_SUBST(OPTS_TESTDIR) AC_SUBST(AGEN5_TESTS) OPTS_TESTDIR=test AGEN5_TESTS='$(SHELL_TESTS) $(NOSHELL_TESTS)' _EOF_; }; action = { no; act-type = script; act-text = <<- _EOF_ TOP_DIRLIST='$(NOSHELL_DIRS) $(XML2AG_DIR)' OPTS_TESTDIR= AGEN5_TESTS='$(NOSHELL_TESTS)' _EOF_; }; conditional = DO_SHELL_CMDS; doc = <<- _EOF_ If you wish to use AutoGen as a CGI service, template shell scripts should be disabled. It is extremely dangerous to allow text to be interpreted by a shell. To ensure that that cannot happen accidentally, it is best to completely disable subshell services by specifying, --disable-shell. In the default, enabled state, the "yes-subst[itution]" will enable the getdefs, columns and doc subdirectory builds. _EOF_; }; #ifdef NOT_YET test = { name = daemon; type = enable; check = 'using autogen as a daemon'; action = { act-type = define; }; doc = <<- _EOF_ AutoGen may be used as a daemon process. It will accept definitions either over a socket connection or through a pipe fattach-ed to a file. Which is selected by the argument to the @code{--daemon} option. _EOF_; }; #endif test = { name = setjmp; type = link; check = 'setjmp() links okay'; code = <<- _EOCode_ #include jmp_buf bf; if (setjmp(bf)) return 0; return 0; _EOCode_; action = { act-type = script; act-text = 'AC_DEFINE(HAVE_WORKING_SETJMP, 1, [setjmp links okay])'; }; }; test = { name = sigsetjmp; type = link; check = 'sigsetjmp() links okay'; code = <<- _EOCode_ #include sigjmp_buf bf; if (sigsetjmp(bf,0)) return 0; return 0; _EOCode_; action = { act-type = script; act-text = 'AC_DEFINE(HAVE_WORKING_SIGSETJMP, 1, [sigsetjmp links okay])'; }; }; test = { name = guile; type = withlib; check = "a working libguile can be found"; code = <<- _END_OF_CODE_ #include #include #if ((SCM_MAJOR_VERSION * 100) + SCM_MINOR_VERSION) > 108 choke me #endif int main () { SCM fumble = SCM_UNDEFINED; SCM bumble = SCM_UNDEFINED; SCM stumble= SCM_UNDEFINED; long lstumble; stumble = scm_cons( fumble, bumble ); stumble = scm_display( fumble, bumble ); lstumble = scm_ilength( fumble ); stumble = scm_makstr( 1, 2 ); stumble = gh_eval_str( "stumble" ); scm_misc_error( "oops", "bad", bumble ); stumble = scm_num_eq_p( fumble, bumble ); scm_wrong_type_arg( "oops", 1, bumble ); return 0; } _END_OF_CODE_; run-mode = link; config = { cflags-arg = 'compile'; libs-arg = 'link'; }; action = { yes; act-type = script; act-text = ' CPPFLAGS="${ag_save_CPPFLAGS}"' "\n" ' LIBS="${ag_save_LIBS}"'; }; action = { no; act-type = script; asis; act-text = ' AC_MSG_ERROR([Cannot find working libguile])'; }; doc = <<- _END_OF_DOC_ AutoGen won't work without Guile, so either the methods for finding the header and libraries must be provided, or guile-config must be found in the executable path, or we have to find the stuff in /usr or /usr/local. Since the Guile interface changes so wildly from release to release, we have to explicitly accept every new minor revision. Sorry about that. _END_OF_DOC_; }; test = { name = guile_version; type = test; check = "the guile version"; code = <<- _END_OF_CODE_ pkginfo=`dpkg --list 2>/dev/null | egrep 'guile-[0-9.]-dev'` if test -n "${pkginfo}" then echo ${pkginfo} | sed -e 's/.*guile-//' -e 's/-dev.*//' else v=`( guile-config --version 2>&1 ) | sed 's/.*Guile version *//'` test -z "${v}" && v=`guile --version | sed 's/.*Guile *//;1q'` test -z "${v}" && exit 1 echo ${v} fi _END_OF_CODE_; code-quoting = asis; action = { yes; act-type = script; asis; act-text = <<- _END_OF_SCRIPT_ set -- `IFS=' .' ; echo ${ag_cv_test_guile_version}` i=${3} test -z "${i}" && i=0 GUILE_VERSION=`expr ${1} \* 100000 + ${2} \* 1000 + ${i}` AC_DEFINE_UNQUOTED(GUILE_VERSION, ${GUILE_VERSION}, define to Guile version expression) AC_SUBST(GUILE_VERSION) _END_OF_SCRIPT_; }; action = { no; act-type = script; act-text = <<- _END_OF_SCRIPT_ AC_MSG_ERROR([Cannot determine Guile version number]) _END_OF_SCRIPT_; }; doc = <<- _END_OF_DOC_ We have to vary our interface all over the place because Guile keeps changing. Use a single version number. Fail if we cannot determine it. _END_OF_DOC_; }; test = { name = "eval_string"; type = link; check = "scm_primitive_eval_x links"; cflags = "${ag_cv_with_libguile_cflags}"; libs = "${ag_cv_with_libguile_libs}"; code = "#include \n#include \n" "SCM res = scm_primitive_eval_x( SCM_UNDEFINED );"; action = { no; asis; act-type = script; act-text = <<- _END_OF_SCRIPT_ AC_DEFINE([scm_primitive_eval_x], [scm_eval_x], [Define this if no scm_primitive_eval_x]) AC_DEFINE([scm_t_port], [scm_port], [Define this if no scm_t_port]) _END_OF_SCRIPT_; }; doc = <<- _END_OF_DOC_ Guile 1.4 does not have scm_primitive_eval_x, but scm_eval_x will work as well. If this is necessary, then the port type structure will be named "scm_port" instead of "scm_t_port", too. _END_OF_DOC_; }; test = { name = "xml2"; type = "withlib"; check = "a working libxml2 can be found"; code = <<- _END_OF_CODE_ #include #include int main () { xmlDocPtr p = xmlParseFile( "mumble.xml" ); } _END_OF_CODE_; config = { cflags-arg = '--cflags'; libs-arg = '--libs'; }; action = { yes; act-type = script; act-text = 'CPPFLAGS="${ag_save_CPPFLAGS}"' "\n" ' LIBS="${ag_save_LIBS}"' "\n" ' '; }; run-mode = "link"; conditional = HAVE_XML_LIB; doc = <<- _END_OF_DOC_ xml2ag won't work without libxml2, so either the methods for finding the header and libraries must be provided, or xml2-config must be found in the executable path. _END_OF_DOC_; }; test = { name = "fattach"; type = "run"; check = "fattach runs"; code = <<- _END_OF_CODE_ int fds[2]; pipe(fds); return fattach(fds[0],__FILE__); _END_OF_CODE_; run-mode = "null"; code-mode = "body"; action = { yes; act-type=define; act-text = "1"; }; doc = "fattach(3) is available but non-functional on some systems."; }; test = { name = "connld"; type = "run"; check = "connld works"; code = <<- _END_OF_CODE_ int fds[2]; pipe(fds); return ioctl( fds[0], I_PUSH, "connld" ); _END_OF_CODE_; run-mode = "null"; code-mode = "body"; action = { yes; act-type=define; act-text = "1"; }; doc = "fattach(3) is available but non-functional on some systems."; }; test = { name = solaris_sysinfo; type = run; check = "sysinfo(2) is Solaris"; action = { act-type = define; }; code = <<- _EOF_ #include int main() { char z[ 256 ]; long sz = sysinfo( SI_SYSNAME, z, sizeof( z )); return (sz > 0) ? 0 : 1; } _EOF_; doc = "Check that the Solaris compliant sysinfo(2) call works properly.\n" "Linux has its own special alternative."; }; test = { name = strcspn; type = run; check = "strcspn matches prototype and works"; action = { act-type = define; }; action = { no; act-type = script; act-text = 'COMPATOBJ="$COMPATOBJ strcspn.lo"'; }; code = <<- _EOF_ #include int main (int argc, char** argv) { char zRej[] = "reject"; char zAcc[] = "a-ok-eject"; return strcspn( zAcc, zRej ) - 5; } _EOF_; doc = <<- _EODoc_ Not all systems have strcspn(3). See if we need to substitute. To make this work, you have to do horrible things. In one of your Makefile.am files, you must make an explicit rule to make this object. It should look like this: strcspn.lo : $(top_srcdir)/compat/strcspn.c $(LTCOMPILE) -o $@ -c $(top_srcdir)/compat/strcspn.c and you must include ``@COMPATOBJ@'' in a LIBADD somewhere and, finally, you must add another artificial dependency, something like: makeshell.lo : genshell.c @COMPATOBJ@ It is all pretty horrific, but I have found nothing else that works. _EODoc_; }; test = { name = sys_siglist; type = run; check = "there is a global text array sys_siglist"; action = { act-type = define; }; code = <<- _EOF_ #include int main() { char const* pz = sys_siglist[1]; return (pz != 0) ? 0 : 1; } _EOF_; doc = "Check that the POSIX compliant regular expression compiler\n" "is available in the POSIX specified manner, and it works."; }; test = { name = uname_syscall; type = run; check = "uname(2) is POSIX"; action = { act-type = define; }; code = <<- _EOF_ #include int main() { struct utsname unm; return uname( &unm ); } _EOF_; doc = "Check that the POSIX compliant uname(2) call works properly."; }; test = { name = long_long; type = compile; check = "long long ints"; action = { act-type = define; }; code = "long long i;"; doc = "See if long long works"; }; test = { name = "ldflags"; type = "test"; check = "runtime library dirs can be specified"; code = <<- _END_OF_CODE_ echo 'int main() { return 0; }' > conftest.$ac_ext libs="${LIBS}" LIBS="${LIBS} -Wl,-R/tmp" if (eval $ac_link) > /dev/null 2>&1 then echo '-Wl,-R' ; rm -f conftest* ; exit 0 ; fi LIBS="${libs} -R/tmp" if (eval $ac_link) > /dev/null 2>&1 then echo '-R' ; rm -f conftest* ; exit 0 ; fi rm -f conftest* ; exit 1 _END_OF_CODE_; code-quoting = asis; action = { yes; act-type=subst; act-text = "${ag_cv_test_ldflags}"; }; doc = <<- _END_OF_DOC_ This test determines whether `-R/path/to/libs' or `-Wl,-R/path/to/libs' should be used to find a runtime dynamic library. _END_OF_DOC_; }; test = { name = debug; type = enable; check = 'wanting autogen debugging'; action = { act-type = define; }; /* * What to do for non-default */ action = { act-type = script; asis; act-text = <<- _EOF_ AC_DEFINE([DEBUG_ENABLED], [1], [Define this if debugging is enabled]) CFLAGS="-g `echo $CFLAGS|sed 's%-g *%%g;s%-O[0-9]* *%%g'`" f=`which dmalloc 2>/dev/null` [ -n "$f" ] && LIBS="${LIBS} -ldmalloc" _EOF_; }; doc = <<- _EOF_ This option will enable two debugging options for AutoGen. viz., --show-defs (dump out the definition tree) and --show-shell (print out all shell commands via `set -x') _EOF_; }; do-always = <<- _END_ALWAYS_ INVOKE_LIBOPTS_MACROS AC_CHECK_DECLS([sigsetjmp],,, [#include ]) AC_CHECK_FUNCS(fopencookie funopen, break) case "${ac_cv_func_fopencookie}${ac_cv_func_funopen}" in *yes* ) AC_DEFINE([ENABLE_FMEMOPEN], 1, "Define if we can use it") ;; esac AC_C_INLINE AC_CACHE_CHECK([for static inline], [snv_cv_static_inline], [ AC_TRY_COMPILE([static inline foo(bar) int bar; { return bar; }], [return foo(0);], [snv_cv_static_inline='static inline'], [snv_cv_static_inline='static']) ]) AC_DEFINE_UNQUOTED(SNV_INLINE, ${snv_cv_static_inline}, [define to static or static inline]) [if test "X${libopts_cv_with_libregex}" = Xno then echo "I cannot detect POSIX compliant regcomp/regexec routines. These are required for AutoGen to work correctly. If you have such a library present on your system, you must specify it by setting the LIBS environment variable, e.g., \"LIBS='-lregex'\". If you do not have such a library on your system, then you should download and install, for example, the one from: ftp://ftp.gnu.org/gnu/rx/" >&2] AC_MSG_ERROR([Cannot find working POSIX regex library]) [fi] AC_PROG_GREP AC_PROG_EGREP AC_PROG_FGREP _END_ALWAYS_; /* misc.def ends here */