| 1 |
# actest.m4 -*- autoconf -*- |
| 2 |
# Additional Autoconf macros to ease testing. |
| 3 |
|
| 4 |
# AC_STATE_SAVE(FILE) |
| 5 |
# ------------------ |
| 6 |
# Save the environment, except for those variables we are allowed to touch. |
| 7 |
# This is to check no test touches the user name space. |
| 8 |
# FIXME: There are surely better ways. Explore for instance if |
| 9 |
# we can ask help from AC_SUBST. We have the right to touch what |
| 10 |
# is AC_SUBST'ed. |
| 11 |
# - ^ac_ |
| 12 |
# Autoconf's shell name space. |
| 13 |
# - prefix and exec_prefix |
| 14 |
# are kept undefined (NONE) until AC_OUTPUT which then sets them to |
| 15 |
# `/usr/local' and `${prefix}' for make. |
| 16 |
# - CONFIG_STATUS and DEFS |
| 17 |
# Set by AC_OUTPUT. |
| 18 |
# - F77_DUMMY_MAIN |
| 19 |
# Set by AC_F77_DUMMY_MAIN. |
| 20 |
# - ALLOCA|NEED_SETGID|KMEM_GROUP |
| 21 |
# AC_FUNCs from acspecific. |
| 22 |
# - AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|RANLIB|SET_MAKE|YACC |
| 23 |
# AC_PROGs from acspecific |
| 24 |
# - _|@|.[*#?].|LINENO|OLDPWD|PIPESTATUS|RANDOM|SECONDS |
| 25 |
# Some variables some shells use and change. |
| 26 |
# `.[*#?].' catches `$#' etc. which are displayed like this: |
| 27 |
# | '!'=18186 |
| 28 |
# | '#'=0 |
| 29 |
# | '$'=6908 |
| 30 |
# - POW_LIB |
| 31 |
# From acfunctions.m4. |
| 32 |
# |
| 33 |
# Some `egrep' choke on such a big regex (e.g., SunOS 4.1.3). In this |
| 34 |
# case just don't pay attention to the env. It would be great |
| 35 |
# to keep the error message but we can't: that would break AT_CHECK. |
| 36 |
m4_defun([AC_STATE_SAVE], |
| 37 |
[(set) 2>&1 | |
| 38 |
$EGREP -v -e 'm4_join([|], |
| 39 |
[^a[cs]_], |
| 40 |
[^((exec_)?prefix|DEFS|CONFIG_STATUS)=], |
| 41 |
[^(CC|CFLAGS|CPP|GCC|CXX|CXXFLAGS|CXXCPP|GXX|F77|FFLAGS|FLIBS|G77)=], |
| 42 |
[^(LIBS|LIBOBJS|LDFLAGS)=], |
| 43 |
[^INSTALL(_(DATA|PROGRAM|SCRIPT))?=], |
| 44 |
[^(CYGWIN|ISC|MINGW32|MINIX|EMXOS2|XENIX|EXEEXT|OBJEXT)=], |
| 45 |
[^(X_(CFLAGS|(EXTRA_|PRE_)?LIBS)|x_(includes|libraries)|(have|no)_x)=], |
| 46 |
[^(host|build|target)(_(alias|cpu|vendor|os))?=], |
| 47 |
[^(cross_compiling)=], |
| 48 |
[^(interpval|PATH_SEPARATOR)=], |
| 49 |
[^(F77_DUMMY_MAIN|f77_(case|underscore))=], |
| 50 |
[^(COLLECT_(GCC|GCC_OPTIONS|LTO_WRAPPER)|(COMPILER|LIBRARY)_PATH)=], |
| 51 |
[^(ALLOCA|GETLOADAVG_LIBS|KMEM_GROUP|NEED_SETGID|POW_LIB)=], |
| 52 |
[^(AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|RANLIB|SET_MAKE|YACC)=], |
| 53 |
[^(GREP|EGREP|FGREP|ToD)=], |
| 54 |
[^(_|@|.[*#?].|LINENO|OLDPWD|PIPESTATUS|RANDOM|SECONDS)=])' 2>/dev/null | |
| 55 |
# There may be variables spread on several lines, eg IFS, remove the dead |
| 56 |
# lines. |
| 57 |
grep '^m4_defn([m4_re_word])=' >state-env.$1 |
| 58 |
test $? = 0 || rm -f state-env.$1 |
| 59 |
|
| 60 |
ls -1 | $EGREP -v '^(at-|state-|config\.|conftest\.dSYM)' | sort >state-ls.$1 |
| 61 |
])# AC_STATE_SAVE |