sim: move from common.m4 to SIM_AC_COMMON
[deliverable/binutils-gdb.git] / sim / common / aclocal.m4
index c1c81645792a85cf2e97e647f9963bec826e004b..11398f5cb42d6accb6a3b9d35afac439f15371f4 100644 (file)
@@ -8,9 +8,9 @@
 # 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_PREREQ(2.64)dnl
 # AC_INIT(Makefile.in)
+# sinclude(../common/aclocal.m4)
 #
 # SIM_AC_COMMON
 #
 #
 # SIM_AC_OUTPUT
 
-AC_DEFUN(SIM_AC_COMMON,
+# Include global overrides and fixes for Autoconf.
+m4_include(../../config/override.m4)
+sinclude([../../config/zlib.m4])
+
+AC_DEFUN([SIM_AC_COMMON],
 [
+AC_REQUIRE([AC_PROG_CC])
 # autoconf.info says this should be called right after AC_INIT.
 AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in)
 AC_CANONICAL_SYSTEM
 AC_ARG_PROGRAM
-AC_PROG_CC
 AC_PROG_INSTALL
 
 # Put a plausible default for CC_FOR_BUILD in Makefile.
@@ -44,7 +48,7 @@ AC_PROG_RANLIB
 dnl We don't use gettext, but bfd does.  So we do the appropriate checks
 dnl to see if there are intl libraries we should link against.
 ALL_LINGUAS=
-ZW_GNU_GETTEXT_SISTER_DIR
+ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
 
 # Check for common headers.
 # FIXME: Seems to me this can cause problems for i386-windows hosts.
@@ -59,6 +63,10 @@ AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
 AC_CHECK_LIB(socket, bind)
 AC_CHECK_LIB(nsl, gethostbyname)
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+AM_ZLIB
+
 . ${srcdir}/../../bfd/configure.host
 
 dnl Standard (and optional) simulator options.
@@ -200,6 +208,10 @@ if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
 fi],[sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1"])dnl
 AC_SUBST(sim_profile)
 
+ACX_PKGVERSION([GDB])
+ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/])
+AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
+AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
 
 dnl Types used by common code
 AC_TYPE_SIGNAL
@@ -245,7 +257,7 @@ dnl If the simulator doesn't invoke this, only the user environment is
 dnl supported.
 dnl ??? Until there is demonstrable value in doing something more complicated,
 dnl let's not.
-AC_DEFUN(SIM_AC_OPTION_ENVIRONMENT,
+AC_DEFUN([SIM_AC_OPTION_ENVIRONMENT],
 [
 AC_ARG_ENABLE(sim-environment,
 [  --enable-sim-environment=environment        Specify mixed, user, virtual or operating environment.],
@@ -269,7 +281,7 @@ 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 alignment
 dnl arg[2] is default target alignment
-AC_DEFUN(SIM_AC_OPTION_ALIGNMENT,
+AC_DEFUN([SIM_AC_OPTION_ALIGNMENT],
 wire_alignment="[$1]"
 default_alignment="[$2]"
 [
@@ -318,7 +330,7 @@ AC_SUBST(sim_alignment)
 
 
 dnl Conditionally compile in assertion statements.
-AC_DEFUN(SIM_AC_OPTION_ASSERT,
+AC_DEFUN([SIM_AC_OPTION_ASSERT],
 [
 AC_ARG_ENABLE(sim-assert,
 [  --enable-sim-assert                 Specify whether to perform random assertions.],
@@ -342,7 +354,7 @@ dnl arg[2] is the number assigned to the most significant bit
 dnl arg[3] is the number of bits in an address
 dnl arg[4] is the number of bits in an OpenFirmware cell.
 dnl FIXME: this information should be obtained from bfd/archure
-AC_DEFUN(SIM_AC_OPTION_BITSIZE,
+AC_DEFUN([SIM_AC_OPTION_BITSIZE],
 wire_word_bitsize="[$1]"
 wire_word_msb="[$2]"
 wire_address_bitsize="[$3]"
@@ -408,7 +420,7 @@ dnl --enable-sim-endian={yes,no,big,little} is for simulators
 dnl 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,
+AC_DEFUN([SIM_AC_OPTION_ENDIAN],
 [
 wire_endian="[$1]"
 default_endian="[$2]"
@@ -458,7 +470,7 @@ AC_SUBST(sim_endian)
 dnl --enable-sim-hostendian is for users of the simulator when
 dnl they find that AC_C_BIGENDIAN does not function correctly
 dnl (for instance in a canadian cross)
-AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN,
+AC_DEFUN([SIM_AC_OPTION_HOSTENDIAN],
 [
 AC_ARG_ENABLE(sim-hostendian,
 [  --enable-sim-hostendian=end         Specify host byte endian orientation.],
@@ -490,7 +502,7 @@ dnl It specifies the presence of hardware floating point
 dnl And optionally the bitsize of the floating point register.
 dnl arg[1] specifies the presence (or absence) of floating point hardware
 dnl arg[2] specifies the number of bits in a floating point register
-AC_DEFUN(SIM_AC_OPTION_FLOAT,
+AC_DEFUN([SIM_AC_OPTION_FLOAT],
 [
 default_sim_float="[$1]"
 default_sim_float_bitsize="[$2]"
@@ -519,7 +531,7 @@ AC_SUBST(sim_float)
 
 
 dnl The argument is the default cache size if none is specified.
-AC_DEFUN(SIM_AC_OPTION_SCACHE,
+AC_DEFUN([SIM_AC_OPTION_SCACHE],
 [
 default_sim_scache="ifelse([$1],,0,[$1])"
 AC_ARG_ENABLE(sim-scache,
@@ -539,7 +551,7 @@ AC_SUBST(sim_scache)
 
 
 dnl The argument is the default model if none is specified.
-AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL,
+AC_DEFUN([SIM_AC_OPTION_DEFAULT_MODEL],
 [
 default_sim_default_model="ifelse([$1],,0,[$1])"
 AC_ARG_ENABLE(sim-default-model,
@@ -559,7 +571,7 @@ dnl --enable-sim-hardware is for users of the simulator
 dnl arg[1] Enable sim-hw by default? ("yes" or "no")
 dnl arg[2] is a space separated list of devices that override the defaults
 dnl arg[3] is a space separated list of extra target specific devices.
-AC_DEFUN(SIM_AC_OPTION_HARDWARE,
+AC_DEFUN([SIM_AC_OPTION_HARDWARE],
 [
 if test x"[$1]" = x"yes"; then
   sim_hw_p=yes
@@ -567,10 +579,11 @@ else
   sim_hw_p=no
 fi
 if test "[$2]"; then
-  hardware="core pal glue"
+  hardware="[$2]"
 else
-  hardware="core pal glue [$3]"
+  hardware="cfi core pal glue"
 fi
+hardware="$hardware [$3]"
 sim_hw_cflags="-DWITH_HW=1"
 sim_hw="$hardware"
 sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
@@ -621,7 +634,7 @@ dnl --enable-sim-inline is for users that wish to ramp up the simulator's
 dnl performance by inlining functions.
 dnl Guarantee that unconfigured simulators do not do any inlining
 sim_inline="-DDEFAULT_INLINE=0"
-AC_DEFUN(SIM_AC_OPTION_INLINE,
+AC_DEFUN([SIM_AC_OPTION_INLINE],
 [
 default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
 AC_ARG_ENABLE(sim-inline,
@@ -666,7 +679,7 @@ fi])dnl
 AC_SUBST(sim_inline)
 
 
-AC_DEFUN(SIM_AC_OPTION_PACKAGES,
+AC_DEFUN([SIM_AC_OPTION_PACKAGES],
 [
 AC_ARG_ENABLE(sim-packages,
 [  --enable-sim-packages=list          Specify the packages to be included in the build.],
@@ -692,7 +705,7 @@ fi])dnl
 AC_SUBST(sim_packages)
 
 
-AC_DEFUN(SIM_AC_OPTION_REGPARM,
+AC_DEFUN([SIM_AC_OPTION_REGPARM],
 [
 AC_ARG_ENABLE(sim-regparm,
 [  --enable-sim-regparm=nr-parm                Pass parameters in registers instead of on the stack - x86/GCC specific.],
@@ -709,7 +722,7 @@ fi],[sim_regparm=""])dnl
 AC_SUBST(sim_regparm)
 
 
-AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
+AC_DEFUN([SIM_AC_OPTION_RESERVED_BITS],
 [
 default_sim_reserved_bits="ifelse([$1],,1,[$1])"
 AC_ARG_ENABLE(sim-reserved-bits,
@@ -726,7 +739,7 @@ fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
 AC_SUBST(sim_reserved_bits)
 
 
-AC_DEFUN(SIM_AC_OPTION_SMP,
+AC_DEFUN([SIM_AC_OPTION_SMP],
 [
 default_sim_smp="ifelse([$1],,5,[$1])"
 AC_ARG_ENABLE(sim-smp,
@@ -746,7 +759,7 @@ fi])dnl
 AC_SUBST(sim_smp)
 
 
-AC_DEFUN(SIM_AC_OPTION_STDCALL,
+AC_DEFUN([SIM_AC_OPTION_STDCALL],
 [
 AC_ARG_ENABLE(sim-stdcall,
 [  --enable-sim-stdcall=type           Use an alternative function call/return mechanism - x86/GCC specific.],
@@ -763,7 +776,7 @@ fi],[sim_stdcall=""])dnl
 AC_SUBST(sim_stdcall)
 
 
-AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
+AC_DEFUN([SIM_AC_OPTION_XOR_ENDIAN],
 [
 default_sim_xor_endian="ifelse([$1],,8,[$1])"
 AC_ARG_ENABLE(sim-xor-endian,
@@ -782,7 +795,7 @@ AC_SUBST(sim_xor_endian)
 
 dnl --enable-build-warnings is for developers of the simulator.
 dnl it enables extra GCC specific warnings.
-AC_DEFUN(SIM_AC_OPTION_WARNINGS,
+AC_DEFUN([SIM_AC_OPTION_WARNINGS],
 [
 # NOTE: Don't add -Wall or -Wunused, they both include
 # -Wunused-parameter which reports bogus warnings.
@@ -866,7 +879,7 @@ dnl We cope by having autoconf generate two files and then merge them into
 dnl one afterwards.  The two pieces of the common fragment are inserted into
 dnl the target's fragment at the appropriate points.
 
-AC_DEFUN(SIM_AC_OUTPUT,
+AC_DEFUN([SIM_AC_OUTPUT],
 [
 AC_LINK_FILES($sim_link_files, $sim_link_links)
 dnl Make @cgen_breaks@ non-null only if the sim uses CGEN.
@@ -893,9 +906,10 @@ AC_OUTPUT
 ])
 
 sinclude(../../config/gettext-sister.m4)
+sinclude(../../config/acx.m4)
 
 dnl --enable-cgen-maint support
-AC_DEFUN(SIM_AC_OPTION_CGEN_MAINT,
+AC_DEFUN([SIM_AC_OPTION_CGEN_MAINT],
 [
 cgen_maint=no
 dnl Default is to use one in build tree.
@@ -929,71 +943,3 @@ AC_SUBST(CGEN_MAINT)
 AC_SUBST(cgendir)
 AC_SUBST(cgen)
 ])
-dnl FIXME: When upgrading to modern autoconf, remove
-dnl        SIM_CHECK_MEMBER and SIM_CHECK_MEMBERS et al and use
-dnl        AC_CHECK_MEMBERS from autoconf.
-dnl
-dnl Translated from a FC2 autoconf-2.59-3 installation.
-dnl  AC_CHECK_MEMBER(AGGREGATE.MEMBER,
-dnl                  [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
-dnl                  [INCLUDES])
-dnl
-dnl  ---------------------------------------------------------
-dnl  AGGREGATE.MEMBER is for instance `struct passwd.pw_gecos', shell
-dnl  variables are not a valid argument.
-AC_DEFUN([SIM_CHECK_MEMBER],
-dnl Extract the aggregate name, and the member name
-[AC_CACHE_CHECK([for $1], [ac_]patsubst([$1], [[\. ]], [_]),
-[ac_]patsubst([$1], [[\. ]], [_])[=no;]
-AC_TRY_COMPILE([$4],[
-dnl AGGREGATE ac_aggr;
-static ]patsubst([$1], [\..*])[ ac_aggr;
-dnl ac_aggr.MEMBER;
-if (ac_aggr.]patsubst([$1], [^[^.]*\.])[)
-return 0;],[ac_]patsubst([$1], [[\. ]], [_])[=yes;],
-AC_TRY_COMPILE([$4],[
-dnl AGGREGATE ac_aggr;
-static ]patsubst([$1], [\..*])[ ac_aggr;
-dnl ac_aggr.MEMBER;
-if (sizeof ac_aggr.]patsubst([$1], [^[^.]*\.])[)
-return 0;],
-[ac_]patsubst([$1], [[\. ]], [_])[=yes;],
-[ac_]patsubst([$1], [[\. ]], [_])[=no;]))
-[if test [$]ac_]patsubst([$1], [[\. ]], [_])[ = yes; then :; [$2]
-else :; [$3]
-fi])
-])dnl SIM_CHECK_MEMBER
-dnl
-dnl Translated from a FC2 autoconf-2.59-3 installation.
-dnl  SIM_CHECK_MEMBERS([AGGREGATE.MEMBER, ...])
-dnl except we just work with a limited set of fixed includes.
-dnl
-AC_DEFUN([SIM_CHECK_MEMBERS_1],
-[ifelse($#, 1,
-[SIM_CHECK_MEMBER([$1],
-AC_DEFINE_UNQUOTED([HAVE_]translit([$1], [a-z .], [A-Z__]), 1,
-[Define to 1 if ]patsubst([$1],
-[^[^.]*\.])[ is a member of ]patsubst([$1], [\..*])[. ]),,
-[#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif])],
-[SIM_CHECK_MEMBER([$1],
-AC_DEFINE_UNQUOTED([HAVE_]translit([$1], [a-z .], [A-Z__]), 1,
-[Define to 1 if ]patsubst([$1],
-[^[^.]*\.])[ is a member of ]patsubst([$1], [\..*])[. ]),,
-[#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif])
-SIM_CHECK_MEMBERS_1(builtin(shift,$@))])])dnl SIM_CHECK_MEMBERS
-dnl
-AC_DEFUN([SIM_CHECK_MEMBERS],
-[ifelse($#, 1, [SIM_CHECK_MEMBERS_1($1)],
-[errprint(__file__:__line__:
-[This SIM_CHECK_MEMBERS only supports one argument,]
-[the list of struct tests])])])dnl SIM_CHECK_MEMBERS
This page took 0.027179 seconds and 4 git commands to generate.