* Makefile.in (autoconf-install): New target.
[deliverable/binutils-gdb.git] / sim / common / aclocal.m4
CommitLineData
80b7b3a5 1# This file contains common code used by all simulators.
8cd89e77
DE
2#
3# SIM_AC_COMMON invokes AC macros used by all simulators and by the common
4# directory. It is intended to be invoked before any target specific stuff.
5# SIM_AC_OUTPUT is a cover function to AC_OUTPUT to generate the Makefile.
6# It is intended to be invoked last.
7#
8# The simulator's configure.in should look like:
9#
f2de7dfd
AC
10# dnl Process this file with autoconf to produce a configure script.
11# sinclude(../common/aclocal.m4)
8cd89e77
DE
12# AC_PREREQ(2.5)dnl
13# AC_INIT(Makefile.in)
f2de7dfd 14#
8cd89e77
DE
15# SIM_AC_COMMON
16#
17# ... target specific stuff ...
18#
19# SIM_AC_OUTPUT
80b7b3a5
SG
20
21AC_DEFUN(SIM_AC_COMMON,
22[
23# autoconf.info says this should be called right after AC_INIT.
24AC_CONFIG_HEADER(config.h:config.in)
25
26AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)
27AC_CANONICAL_SYSTEM
28AC_ARG_PROGRAM
29AC_PROG_CC
30AC_PROG_INSTALL
80b7b3a5
SG
31
32# Put a plausible default for CC_FOR_BUILD in Makefile.
33AC_C_CROSS
34if test "x$cross_compiling" = "xno"; then
35 CC_FOR_BUILD='$(CC)'
36else
37 CC_FOR_BUILD=gcc
38fi
39AC_SUBST(CC_FOR_BUILD)
40
41AC_SUBST(CFLAGS)
42AC_SUBST(HDEFINES)
43AR=${AR-ar}
44AC_SUBST(AR)
45AC_PROG_RANLIB
46
47. ${srcdir}/../../bfd/configure.host
48
a77aa7ec 49dnl Standard (and optional) simulator options.
80b7b3a5
SG
50dnl Eventually all simulators will support these.
51dnl Do not add any here that cannot be supported by all simulators.
52dnl Do not add similar but different options to a particular simulator,
53dnl all shall eventually behave the same way.
54
f2de7dfd
AC
55
56dnl This is a generic option to enable special byte swapping
57dnl insns on *any* cpu.
58AC_ARG_ENABLE(sim-bswap,
59[ --enable-sim-bswap Use Host specific BSWAP instruction.],
60[case "${enableval}" in
a77aa7ec 61 yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
f2de7dfd
AC
62 no) sim_bswap="-DWITH_BSWAP=0";;
63 *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
64esac
65if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
66 echo "Setting bswap flags = $sim_bswap" 6>&1
67fi],[sim_bswap=""])dnl
68AC_SUBST(sim_bswap)
69
70
80b7b3a5
SG
71AC_ARG_ENABLE(sim-cflags,
72[ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator],
73[case "${enableval}" in
74 yes) sim_cflags="-O2";;
75 trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";;
76 no) sim_cflags="";;
77 *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
78esac
79if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
80 echo "Setting sim cflags = $sim_cflags" 6>&1
81fi],[sim_cflags=""])dnl
82AC_SUBST(sim_cflags)
83
f2de7dfd 84
80b7b3a5
SG
85dnl --enable-sim-debug is for developers of the simulator
86dnl the allowable values are work-in-progress
87AC_ARG_ENABLE(sim-debug,
88[ --enable-sim-debug=opts Enable debugging flags],
89[case "${enableval}" in
90 yes) sim_debug="-DDEBUG=7";;
91 no) sim_debug="-DDEBUG=0";;
92 *) sim_debug="-DDEBUG='(${enableval})'";;
93esac
94if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
95 echo "Setting sim debug = $sim_debug" 6>&1
96fi],[sim_debug=""])dnl
97AC_SUBST(sim_debug)
98
f2de7dfd 99
a35e91c3
AC
100dnl --enable-sim-stdio is for users of the simulator
101dnl It determines if IO from the program is routed through STDIO (buffered)
102AC_ARG_ENABLE(sim-stdio,
103[ --enable-sim-stdio Specify whether to use stdio for console input/output.],
104[case "${enableval}" in
105 yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
106 no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
107 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";;
108esac
109if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
110 echo "Setting stdio flags = $sim_stdio" 6>&1
111fi],[sim_stdio=""])dnl
112AC_SUBST(sim_stdio)
113
114
115dnl --enable-sim-trace is for users of the simulator
116dnl the allowable values are work-in-progress
117AC_ARG_ENABLE(sim-trace,
118[ --enable-sim-trace=opts Enable tracing flags],
119[case "${enableval}" in
120 yes) sim_trace="-DTRACE=1 -DWITH_TRACE=1";;
121 no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
122 *) sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
123esac
124if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
125 echo "Setting sim trace = $sim_trace" 6>&1
126fi],[sim_trace=""])dnl
127AC_SUBST(sim_trace)
128
129
130dnl These are available to append to as desired.
131sim_link_files=
132sim_link_links=
133
134dnl Create tconfig.h either from simulator's tconfig.in or default one
135dnl in common.
136sim_link_links=tconfig.h
137if test -f ${srcdir}/tconfig.in
138then
139 sim_link_files=tconfig.in
140else
141 sim_link_files=../common/tconfig.in
142fi
143
144# targ-vals.def points to the libc macro description file.
145case "${target}" in
146*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
147esac
148sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
149sim_link_links="${sim_link_links} targ-vals.def"
150
151]) dnl End of SIM_AC_COMMON
152
153
154dnl Additional SIM options that can (optionally) be configured
155dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined.
156dnl Simulators that wish to use the relevant option specify the macro
157dnl in the simulator specific configure.in file between the SIM_AC_COMMON
158dnl and SIM_AC_OUTPUT lines.
159
160
161dnl Specify the alignment restrictions of the target architecture.
162dnl Without this option all possible alignment restrictions are accomidated.
163AC_DEFUN(SIM_AC_OPTION_ALIGNMENT,
164[
165AC_ARG_ENABLE(sim-alignment,
166[ --enable-sim-alignment=align Specify strict or nonstrict alignment.],
167[case "${enableval}" in
168 yes | strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
169 no | nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
170 0 | default | DEFAULT) sim_alignment="-DWITH_ALIGNMENT=0";;
171 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
172esac
173if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
174 echo "Setting alignment flags = $sim_alignment" 6>&1
175fi],[sim_alignment=""])dnl
176AC_SUBST(sim_alignment)
177])dnl
178
179
180dnl Conditionally compile in assertion statements.
181AC_DEFUN(SIM_AC_OPTION_ASSERT,
182[
183AC_ARG_ENABLE(sim-assert,
184[ --enable-sim-assert Specify whether to perform random assertions.],
185[case "${enableval}" in
186 yes) sim_assert="-DWITH_ASSERT=1";;
187 no) sim_assert="-DWITH_ASSERT=0";;
188 *) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
189esac
190if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
191 echo "Setting assert flags = $sim_assert" 6>&1
192fi],[sim_assert=""])dnl
193AC_SUBST(sim_assert)
194])
195
196
f2de7dfd
AC
197dnl --enable-sim-endian={yes,no,big,little} is for simulators
198dnl that support both big and little endian targets.
199AC_DEFUN(SIM_AC_OPTION_ENDIAN,
8cd89e77 200[
f2de7dfd
AC
201default_sim_endian="ifelse([$1],,,-DWITH_TARGET_BYTE_ORDER=[$1])"
202AC_ARG_ENABLE(sim-endian,
203[ --enable-sim-endian=endian Specify target byte endian orientation.],
204[case "${enableval}" in
205 yes) case "$target" in
206 *powerpc-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
207 *powerpcle-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
208 *) echo "Unknown target $target" 1>&6; sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
209 esac;;
210 no) sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
211 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
212 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
213 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
214esac
215if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
216 echo "Setting endian flags = $sim_endian" 6>&1
217fi],[sim_endian="${default_sim_endian}"])dnl
a77aa7ec 218AC_SUBST(sim_endian)
f2de7dfd 219])
8cd89e77 220
80b7b3a5 221
f2de7dfd
AC
222dnl --enable-sim-hostendian is for users of the simulator when
223dnl they find that AC_C_BIGENDIAN does not function correctly
224dnl (for instance in a canadian cross)
225AC_DEFUN(SIM_AC_OPTION_HOSTENDIAN,
226[
227AC_ARG_ENABLE(sim-hostendian,
228[ --enable-sim-hostendain=end Specify host byte endian orientation.],
229[case "${enableval}" in
230 no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
231 b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
232 l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
233 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
234esac
235if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
236 echo "Setting hostendian flags = $sim_hostendian" 6>&1
237fi],[
238if test "x$cross_compiling" = "xno"; then
239 AC_C_BIGENDIAN
240 if test $ac_cv_c_bigendian = yes; then
241 sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
242 else
243 sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
244 fi
245else
246 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
247fi])dnl
a77aa7ec
AC
248AC_SUBST(sim_hostendian)
249])
250
251
252AC_DEFUN(SIM_AC_OPTION_FLOAT,
253[
a35e91c3 254default_sim_floating_point="ifelse([$1],,0,[$1])"
a77aa7ec 255AC_ARG_ENABLE(sim-float,
a35e91c3 256[ --enable-sim-float Specify that the target processor has floating point hardware.],
a77aa7ec
AC
257[case "${enableval}" in
258 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
259 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
260 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
261esac
262if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
263 echo "Setting float flags = $sim_float" 6>&1
a35e91c3 264fi],[sim_float="-DWITH_FLOATING_POINT=${default_sim_floating_point}"])dnl
a77aa7ec
AC
265AC_SUBST(sim_float)
266])
267
268
269AC_DEFUN(SIM_AC_OPTION_HARDWARE,
270[
271AC_ARG_ENABLE(sim-hardware,
272[ --enable-sim-hardware=list Specify the hardware to be included in the build.],
273[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
274case "${enableval}" in
275 yes) ;;
276 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
277 ,*) hardware="${hardware}${enableval}";;
278 *,) hardware="${enableval}${hardware}";;
279 *) hardware="${enableval}"'';;
280esac
281sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
282sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
283if test x"$silent" != x"yes" && test x"$hardware" != x""; then
284 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
285fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
286sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
287sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
288if test x"$silent" != x"yes"; then
289 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
290fi])dnl
291AC_SUBST(sim_hardware)
f2de7dfd
AC
292])
293
80b7b3a5 294
f2de7dfd
AC
295dnl --enable-sim-inline is for users that wish to ramp up the simulator's
296dnl performance by inlining functions.
297AC_DEFUN(SIM_AC_OPTION_INLINE,
298[
299default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
300AC_ARG_ENABLE(sim-inline,
301[ --enable-sim-inline=inlines Specify which functions should be inlined.],
302[sim_inline=""
303case "$enableval" in
304 no) sim_inline="-DDEFAULT_INLINE=0";;
305 0) sim_inline="-DDEFAULT_INLINE=0";;
306 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
307 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
308 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
309 new_flag=""
310 case "$x" in
311 *_INLINE=*) new_flag="-D$x";;
312 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
313 *_INLINE) new_flag="-D$x=ALL_INLINE";;
314 *) new_flag="-D$x""_INLINE=ALL_INLINE";;
315 esac
316 if test x"$sim_inline" = x""; then
317 sim_inline="$new_flag"
318 else
319 sim_inline="$sim_inline $new_flag"
320 fi
321 done;;
322esac
323if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
324 echo "Setting inline flags = $sim_inline" 6>&1
325fi],[if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
326 sim_inline="${default_sim_inline}"
327 if test x"$silent" != x"yes"; then
328 echo "Setting inline flags = $sim_inline" 6>&1
329 fi
330else
331 sim_inline=""
332fi])dnl
a77aa7ec
AC
333AC_SUBST(sim_inline)
334])
335
336
337AC_DEFUN(SIM_AC_OPTION_PACKAGES,
338[
339AC_ARG_ENABLE(sim-packages,
340[ --enable-sim-packages=list Specify the packages to be included in the build.],
341[packages=disklabel
342case "${enableval}" in
343 yes) ;;
344 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
345 ,*) packages="${packages}${enableval}";;
346 *,) packages="${enableval}${packages}";;
347 *) packages="${enableval}"'';;
348esac
349sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
350sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
351if test x"$silent" != x"yes" && test x"$packages" != x""; then
352 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
353fi],[packages=disklabel
354sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
355sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
356if test x"$silent" != x"yes"; then
357 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
358fi])dnl
359AC_SUBST(sim_packages)
360])
361
362
363AC_DEFUN(SIM_AC_OPTION_REGPARM,
364[
365AC_ARG_ENABLE(sim-regparm,
366[ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.],
367[case "${enableval}" in
368 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
369 no) sim_regparm="" ;;
370 yes) sim_regparm="-DWITH_REGPARM=3";;
371 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
372esac
373if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
374 echo "Setting regparm flags = $sim_regparm" 6>&1
375fi],[sim_regparm=""])dnl
376AC_SUBST(sim_regparm)
377])
378
379
380AC_DEFUN(SIM_AC_OPTION_RESERVED_BITS,
381[
a35e91c3 382default_sim_reserved_bits="ifelse([$1],,1,[$1])"
a77aa7ec
AC
383AC_ARG_ENABLE(sim-reserved-bits,
384[ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
385[case "${enableval}" in
386 yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
387 no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
388 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";;
389esac
390if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
391 echo "Setting reserved flags = $sim_reserved_bits" 6>&1
a35e91c3 392fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
a77aa7ec
AC
393AC_SUBST(sim_reserved_bits)
394])
395
396
397AC_DEFUN(SIM_AC_OPTION_SMP,
398[
a35e91c3 399default_sim_smp="ifelse([$1],,5,[$1])"
a77aa7ec 400AC_ARG_ENABLE(sim-smp,
a35e91c3 401[ --enable-sim-smp=n Specify number of processors to configure for (default ${default_sim_smp}).],
a77aa7ec
AC
402[case "${enableval}" in
403 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
404 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
405 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
406esac
407if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
408 echo "Setting smp flags = $sim_smp" 6>&1
a35e91c3 409fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
a77aa7ec
AC
410if test x"$silent" != x"yes"; then
411 echo "Setting smp flags = $sim_smp" 6>&1
412fi])dnl
413AC_SUBST(sim_smp)
f2de7dfd 414])
80b7b3a5 415
80b7b3a5 416
a77aa7ec
AC
417AC_DEFUN(SIM_AC_OPTION_STDCALL,
418[
419AC_ARG_ENABLE(sim-stdcall,
420[ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.],
421[case "${enableval}" in
422 no) sim_stdcall="" ;;
423 std*) sim_stdcall="-DWITH_STDCALL=1";;
424 yes) sim_stdcall="-DWITH_STDCALL=1";;
425 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
426esac
427if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
428 echo "Setting function call flags = $sim_stdcall" 6>&1
429fi],[sim_stdcall=""])dnl
430AC_SUBST(sim_stdcall)
431])
432
433
a35e91c3
AC
434AC_DEFUN(SIM_AC_OPTION_XOR_ENDIAN,
435[
436default_sim_xor_endian="ifelse([$1],,8,[$1])"
437AC_ARG_ENABLE(sim-xor-endian,
438[ --enable-sim-xor-endian=n Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).],
a77aa7ec 439[case "${enableval}" in
a35e91c3
AC
440 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
441 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
442 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
a77aa7ec 443esac
a35e91c3
AC
444if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
445 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
446fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
447AC_SUBST(sim_xor_endian)
448])
a77aa7ec
AC
449
450
f2de7dfd
AC
451dnl --enable-sim-warnings is for developers of the simulator.
452dnl it enables extra GCC specific warnings.
453AC_DEFUN(SIM_AC_OPTION_WARNINGS,
454[
455AC_ARG_ENABLE(sim-warnings,
456[ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o],
457[case "${enableval}" in
458 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
459 no) sim_warnings="-w";;
460 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
461esac
462if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
463 echo "Setting warning flags = $sim_warnings" 6>&1
464fi],[sim_warnings=""])dnl
a77aa7ec 465AC_SUBST(sim_warnings)
f2de7dfd 466])
80b7b3a5 467
80b7b3a5 468
f2de7dfd
AC
469dnl Generate the Makefile in a target specific directory.
470dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
471dnl so this is a cover macro to tuck the details away of how we cope.
472dnl We cope by having autoconf generate two files and then merge them into
473dnl one afterwards. The two pieces of the common fragment are inserted into
474dnl the target's fragment at the appropriate points.
80b7b3a5 475
f2de7dfd
AC
476AC_DEFUN(SIM_AC_OUTPUT,
477[
80b7b3a5 478AC_LINK_FILES($sim_link_files, $sim_link_links)
f2de7dfd
AC
479AC_OUTPUT(Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in,
480[case "x$CONFIG_FILES" in xMakefile*)
481 echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
482 rm -f Makesim1.tmp Makesim2.tmp Makefile
483 sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
484 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
485 sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
486 -e '/^## COMMON_POST_/ r Makesim2.tmp' \
487 <Makefile.sim >Makefile
488 rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
489 ;;
490 esac
80b7b3a5 491 case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
f2de7dfd
AC
492])
493])
This page took 0.051982 seconds and 4 git commands to generate.