📄 aclocal.m4
字号:
# This file contains common code used by all simulators.## SIM_AC_COMMON invokes AC macros used by all simulators and by the common# directory. It is intended to be invoked before any target specific stuff.# SIM_AC_OUTPUT is a cover function to AC_OUTPUT to generate the Makefile.# It is intended to be invoked last.## The simulator's configure.in should look like:## dnl Process this file with autoconf to produce a configure script.# sinclude(../common/aclocal.m4)# AC_PREREQ(2.5)dnl# AC_INIT(Makefile.in)## SIM_AC_COMMON## ... target specific stuff ...## SIM_AC_OUTPUTAC_DEFUN(SIM_AC_COMMON,[# autoconf.info says this should be called right after AC_INIT.AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in)AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)AC_CANONICAL_SYSTEMAC_ARG_PROGRAMAC_PROG_CCAC_PROG_INSTALL# Put a plausible default for CC_FOR_BUILD in Makefile.if test "x$cross_compiling" = "xno"; then CC_FOR_BUILD='$(CC)'else CC_FOR_BUILD=gccfiAC_SUBST(CC_FOR_BUILD)AC_SUBST(CFLAGS)AC_SUBST(HDEFINES)AR=${AR-ar}AC_SUBST(AR)AC_PROG_RANLIBdnl We don't use gettext, but bfd does. So we do the appropriate checksdnl to see if there are intl libraries we should link against.ALL_LINGUAS=CY_GNU_GETTEXT# Check for common headers.# FIXME: Seems to me this can cause problems for i386-windows hosts.# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h time.h)AC_CHECK_HEADERS(sys/time.h sys/resource.h)AC_CHECK_HEADERS(fcntl.h fpu_control.h)AC_CHECK_HEADERS(dlfcn.h errno.h sys/stat.h)AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)# Check for socket librariesAC_CHECK_LIB(socket, bind)AC_CHECK_LIB(nsl, gethostbyname). ${srcdir}/../../bfd/configure.hostdnl Standard (and optional) simulator options.dnl Eventually all simulators will support these.dnl Do not add any here that cannot be supported by all simulators.dnl Do not add similar but different options to a particular simulator,dnl all shall eventually behave the same way.dnl We don't use automake, but we still want to supportdnl --enable-maintainer-mode.USE_MAINTAINER_MODE=noAC_ARG_ENABLE(maintainer-mode,[ --enable-maintainer-mode Enable developer functionality.],[case "${enableval}" in yes) MAINT="" USE_MAINTAINER_MODE=yes ;; no) MAINT="#" ;; *) AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;;esacif test x"$silent" != x"yes" && test x"$MAINT" = x""; then echo "Setting maintainer mode" 6>&1fi],[MAINT="#"])dnlAC_SUBST(MAINT)dnl This is a generic option to enable special byte swappingdnl insns on *any* cpu.AC_ARG_ENABLE(sim-bswap,[ --enable-sim-bswap Use Host specific BSWAP instruction.],[case "${enableval}" in yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";; no) sim_bswap="-DWITH_BSWAP=0";; *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;esacif test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then echo "Setting bswap flags = $sim_bswap" 6>&1fi],[sim_bswap=""])dnlAC_SUBST(sim_bswap)AC_ARG_ENABLE(sim-cflags,[ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator],[case "${enableval}" in yes) sim_cflags="-O2 -fomit-frame-pointer";; trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";; no) sim_cflags="";; *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;esacif test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then echo "Setting sim cflags = $sim_cflags" 6>&1fi],[sim_cflags=""])dnlAC_SUBST(sim_cflags)dnl --enable-sim-debug is for developers of the simulatordnl the allowable values are work-in-progressAC_ARG_ENABLE(sim-debug,[ --enable-sim-debug=opts Enable debugging flags],[case "${enableval}" in yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";; no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";; *) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;esacif test x"$silent" != x"yes" && test x"$sim_debug" != x""; then echo "Setting sim debug = $sim_debug" 6>&1fi],[sim_debug=""])dnlAC_SUBST(sim_debug)dnl --enable-sim-stdio is for users of the simulatordnl It determines if IO from the program is routed through STDIO (buffered)AC_ARG_ENABLE(sim-stdio,[ --enable-sim-stdio Specify whether to use stdio for console input/output.],[case "${enableval}" in yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";; no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";; *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";;esacif test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then echo "Setting stdio flags = $sim_stdio" 6>&1fi],[sim_stdio=""])dnlAC_SUBST(sim_stdio)dnl --enable-sim-trace is for users of the simulatordnl The argument is either a bitmask of things to enable [exactly what isdnl up to the simulator], or is a comma separated list of names of tracingdnl elements to enable. The latter is only supported on simulators thatdnl use WITH_TRACE.AC_ARG_ENABLE(sim-trace,[ --enable-sim-trace=opts Enable tracing flags],[case "${enableval}" in yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";; no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";; [[-0-9]]*) sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";; [[a-z]]*) sim_trace="" for x in `echo "$enableval" | sed -e "s/,/ /g"`; do if test x"$sim_trace" = x; then sim_trace="-DWITH_TRACE='(TRACE_$x" else sim_trace="${sim_trace}|TRACE_$x" fi done sim_trace="$sim_trace)'" ;;esacif test x"$silent" != x"yes" && test x"$sim_trace" != x""; then echo "Setting sim trace = $sim_trace" 6>&1fi],[sim_trace=""])dnlAC_SUBST(sim_trace)dnl --enable-sim-profilednl The argument is either a bitmask of things to enable [exactly what isdnl up to the simulator], or is a comma separated list of names of profilingdnl elements to enable. The latter is only supported on simulators thatdnl use WITH_PROFILE.AC_ARG_ENABLE(sim-profile,[ --enable-sim-profile=opts Enable profiling flags],[case "${enableval}" in yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";; no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";; [[-0-9]]*) sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";; [[a-z]]*) sim_profile="" for x in `echo "$enableval" | sed -e "s/,/ /g"`; do if test x"$sim_profile" = x; then sim_profile="-DWITH_PROFILE='(PROFILE_$x" else sim_profile="${sim_profile}|PROFILE_$x" fi done sim_profile="$sim_profile)'" ;;esacif test x"$silent" != x"yes" && test x"$sim_profile" != x""; then echo "Setting sim profile = $sim_profile" 6>&1fi],[sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1"])dnlAC_SUBST(sim_profile)dnl Types used by common codeAC_TYPE_SIGNALdnl Detect exe extensionAC_EXEEXTdnl These are available to append to as desired.sim_link_files=sim_link_links=dnl Create tconfig.h either from simulator's tconfig.in or default onednl in common.sim_link_links=tconfig.hif test -f ${srcdir}/tconfig.inthen sim_link_files=tconfig.inelse sim_link_files=../common/tconfig.infi# targ-vals.def points to the libc macro description file.case "${target}" in*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;esacsim_link_files="${sim_link_files} ${TARG_VALS_DEF}"sim_link_links="${sim_link_links} targ-vals.def"]) dnl End of SIM_AC_COMMONdnl Additional SIM options that can (optionally) be configureddnl For optional simulator options, a macro SIM_AC_OPTION_* is defined.dnl Simulators that wish to use the relevant option specify the macrodnl in the simulator specific configure.in file between the SIM_AC_COMMONdnl and SIM_AC_OUTPUT lines.dnl Specify the running environment.dnl If the simulator invokes this in its configure.in then without this optiondnl the default is the user environment and all are runtime selectable.dnl If the simulator doesn't invoke this, only the user environment isdnl supported.dnl ??? Until there is demonstrable value in doing something more complicated,dnl let's not.AC_DEFUN(SIM_AC_OPTION_ENVIRONMENT,[AC_ARG_ENABLE(sim-environment,[ --enable-sim-environment=environment Specify mixed, user, virtual or operating environment.],[case "${enableval}" in all | ALL) sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT";; user | USER) sim_environment="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";; virtual | VIRTUAL) sim_environment="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";; operating | OPERATING) sim_environment="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";; *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-environment"); sim_environment="";;esacif test x"$silent" != x"yes" && test x"$sim_environment" != x""; then echo "Setting sim environment = $sim_environment" 6>&1fi],[sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT"])dnl])AC_SUBST(sim_environment)dnl Specify the alignment restrictions of the target architecture.dnl Without this option all possible alignment restrictions are accommodated.dnl arg[1] is hardwired target alignmentdnl arg[2] is default target alignmentAC_DEFUN(SIM_AC_OPTION_ALIGNMENT,wire_alignment="[$1]"default_alignment="[$2]"[AC_ARG_ENABLE(sim-alignment,[ --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses.],[case "${enableval}" in strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";; nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";; forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";; yes) if test x"$wire_alignment" != x; then sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}" else if test x"$default_alignment" != x; then sim_alignment="-DWITH_ALIGNMENT=${default_alignment}" else echo "No hard-wired alignment for target $target" 1>&6 sim_alignment="-DWITH_ALIGNMENT=0" fi fi;; no) if test x"$default_alignment" != x; then sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}" else if test x"$wire_alignment" != x; then sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}" else echo "No default alignment for target $target" 1>&6 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0" fi fi;; *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;esacif test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then echo "Setting alignment flags = $sim_alignment" 6>&1fi],[if test x"$default_alignment" != x; then sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"else if test x"$wire_alignment" != x; then sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}" else sim_alignment= fifi])dnl])dnlAC_SUBST(sim_alignment)dnl Conditionally compile in assertion statements.AC_DEFUN(SIM_AC_OPTION_ASSERT,[AC_ARG_ENABLE(sim-assert,[ --enable-sim-assert Specify whether to perform random assertions.],[case "${enableval}" in yes) sim_assert="-DWITH_ASSERT=1";; no) sim_assert="-DWITH_ASSERT=0";; *) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;esacif test x"$silent" != x"yes" && test x"$sim_assert" != x""; then echo "Setting assert flags = $sim_assert" 6>&1fi],[sim_assert=""])dnl])AC_SUBST(sim_assert)dnl --enable-sim-bitsize is for developers of the simulatordnl It specifies the number of BITS in the target.dnl arg[1] is the number of bits in a worddnl arg[2] is the number assigned to the most significant bitdnl arg[3] is the number of bits in an addressdnl arg[4] is the number of bits in an OpenFirmware cell.dnl FIXME: this information should be obtained from bfd/archureAC_DEFUN(SIM_AC_OPTION_BITSIZE,wire_word_bitsize="[$1]"wire_word_msb="[$2]"wire_address_bitsize="[$3]"wire_cell_bitsize="[$4]"[AC_ARG_ENABLE(sim-bitsize,[ --enable-sim-bitsize=N Specify target bitsize (32 or 64).],[sim_bitsize=case "${enableval}" in 64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";; 32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";; 64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";; 32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";; 32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31" else sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0" fi ;; 64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63" else sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0" fi ;; *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64") ;;esac# address bitsizetmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"`case x"${tmp}" in x ) ;; x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;; x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;; * ) AC_MSG_ERROR("--enable-sim-bitsize was given address size $enableval. Expected 32 or 64") ;;esac# cell bitsizetmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"`case x"${tmp}" in x ) ;; x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;; x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;; * ) AC_MSG_ERROR("--enable-sim-bitsize was given cell size $enableval. Expected 32 or 64") ;;esacif test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then echo "Setting bitsize flags = $sim_bitsize" 6>&1fi],[sim_bitsize=""if test x"$wire_word_bitsize" != x; then sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"fiif test x"$wire_word_msb" != x; then sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"fiif test x"$wire_address_bitsize" != x; then sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"fiif test x"$wire_cell_bitsize" != x; then sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"fi])dnl])AC_SUBST(sim_bitsize)dnl --enable-sim-endian={yes,no,big,little} is for simulatorsdnl that support both big and little endian targets.dnl arg[1] is hardwired target endianness.dnl arg[2] is default target endianness.AC_DEFUN(SIM_AC_OPTION_ENDIAN,[wire_endian="[$1]"default_endian="[$2]"AC_ARG_ENABLE(sim-endian,[ --enable-sim-endian=endian Specify target byte endian orientation.],[case "${enableval}" in b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -