1dnl Process this file with autoconf to produce a configure script. 2 3dnl $Id: configure.in,v 1.20 2010/06/05 19:56:37 fredette Exp $ 4 5dnl Copyright (c) 2001, 2003 Matt Fredette 6dnl All rights reserved. 7dnl 8dnl Redistribution and use in source and binary forms, with or without 9dnl modification, are permitted provided that the following conditions 10dnl are met: 11dnl 1. Redistributions of source code must retain the above copyright 12dnl notice, this list of conditions and the following disclaimer. 13dnl 2. Redistributions in binary form must reproduce the above copyright 14dnl notice, this list of conditions and the following disclaimer in the 15dnl documentation and/or other materials provided with the distribution. 16dnl 3. All advertising materials mentioning features or use of this software 17dnl must display the following acknowledgement: 18dnl This product includes software developed by Matt Fredette. 19dnl 4. The name of the author may not be used to endorse or promote products 20dnl derived from this software without specific prior written permission. 21dnl 22dnl THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23dnl IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25dnl DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 26dnl INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27dnl (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28dnl SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30dnl STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31dnl ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32dnl POSSIBILITY OF SUCH DAMAGE. 33 34dnl Checks that we are given a good source directory. 35AC_INIT(ic/m68k/m68k-impl.h) 36AC_CONFIG_MACRO_DIR([m4]) 37AC_CANONICAL_SYSTEM 38AM_INIT_AUTOMAKE(tme, 0.8) 39 40dnl Write configuration out to config.h through config.h.in. 41AM_CONFIG_HEADER(config.h) 42 43dnl Checks for programs. 44AC_PROG_CC 45AC_PROG_CPP 46AC_PROG_YACC 47AC_PROG_INSTALL 48AC_PROG_MAKE_SET 49 50dnl Checks for header files. 51AC_HEADER_STDC 52AC_CHECK_HEADERS(unistd.h stdio.h memory.h stdarg.h limits.h float.h) 53AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h sys/socketio.h net/if_dl.h ioctls.h) 54AC_CHECK_HEADERS(sys/bswap.h) 55 56dnl Checks for typedefs, structures, and compiler characteristics. 57AC_C_BIGENDIAN 58AC_C_CONST 59AC_C_INLINE 60AC_C_VOLATILE 61AC_C_LONG_DOUBLE 62AC_TYPE_SIZE_T 63AC_TYPE_SIGNAL 64AC_CHECK_SIZEOF(long, 4) 65AC_CHECK_SIZEOF(int, 4) 66AC_CHECK_SIZEOF(short, 2) 67AC_CHECK_SIZEOF(float, 4) 68AC_CHECK_SIZEOF(double, 8) 69if test $ac_cv_c_long_double = yes; then 70 AC_CHECK_SIZEOF(long double, 12) 71fi 72if test $ac_cv_sizeof_int != 4 && test $ac_cv_sizeof_long != 4; then 73 AC_MSG_ERROR([can't find a 32-bit type]) 74fi 75if test $ac_cv_sizeof_int != 2 && test $ac_cv_sizeof_short != 2; then 76 AC_MSG_ERROR([can't find a 16-bit type]) 77fi 78if test $ac_cv_sizeof_long = 8; then 79 AC_CHECK_ALIGNOF(64) 80 AC_CHECK_SHIFTMAX(64) 81 AC_CHECK_SHIFTSIGNED(64) 82fi 83AC_CHECK_ALIGNOF(32) 84AC_CHECK_ALIGNOF(16) 85AC_CHECK_SHIFTMAX(8) 86AC_CHECK_SHIFTMAX(16) 87AC_CHECK_SHIFTMAX(32) 88AC_CHECK_SHIFTSIGNED(8) 89AC_CHECK_SHIFTSIGNED(16) 90AC_CHECK_SHIFTSIGNED(32) 91AC_CHECK_FLOAT_FORMAT(float) 92AC_CHECK_FLOAT_LIMITS(float, FLT_MAX/FLT_MIN) 93AC_CHECK_FLOAT_FORMAT(double) 94AC_CHECK_FLOAT_LIMITS(double, DBL_MAX/DBL_MIN) 95if test $ac_cv_c_long_double = yes; then 96 AC_CHECK_FLOAT_FORMAT(long double) 97 AC_CHECK_FLOAT_LIMITS(long double, LDBL_MAX/LDBL_MIN) 98fi 99AC_SYS_SOCKADDR_SA_LEN 100 101dnl Checks for library functions and prototypes. 102AC_PROG_GCC_TRADITIONAL 103AC_FUNC_MEMCMP 104AC_FUNC_MMAP 105AC_CHECK_FUNC_LONG(bswap16, [ 106 unsigned int x; 107 108 x = bswap16(0x1122); 109], [ 110#ifdef HAVE_SYS_BSWAP_H 111#include <sys/bswap.h> 112#endif 113]) 114AC_CHECK_FUNC_LONG(bswap32, [ 115 unsigned int x; 116 117 x = bswap32(0x11223344); 118], [ 119#ifdef HAVE_SYS_BSWAP_H 120#include <sys/bswap.h> 121#endif 122]) 123if test $ac_cv_sizeof_long = 8; then 124 AC_CHECK_FUNC_LONG(bswap64, [ 125 unsigned long x; 126 127 x = bswap64(0x11223344); 128], [ 129#ifdef HAVE_SYS_BSWAP_H 130#include <sys/bswap.h> 131#endif 132 ]) 133fi 134AC_CHECK_FUNC_LONG(isinff, 135[ 136 float x; 137 int y; 138 139 x = 1; 140 y = isinff(x); 141], [ 142#include <math.h> 143], -lm) 144 145dnl Checks for perl. 146AC_PATH_PROGS(PERL, perl4.036 perl4 perl perl5, no) 147AC_SUBST(PERL) 148 149dnl Start the list of host support. 150TME_HOSTS="posix" 151 152dnl Checks for AF_LINK. 153AC_MSG_CHECKING([for AF_LINK support]) 154AC_EGREP_CPP(_tme_has_af_link, 155[ 156#include <sys/socket.h> 157#ifdef AF_LINK 158_tme_has_af_link 159#endif 160], [ 161AC_MSG_RESULT(yes) 162AC_DEFINE(HAVE_AF_LINK, [], [Define if you have AF_LINK.]) 163], [ 164AC_MSG_RESULT(no) 165]) 166 167dnl Checks for BPF. 168tme_raw_type= 169AC_CHECK_HEADER(net/bpf.h, 170[AC_EGREP_CPP(found_BIOCSHDRCMPLT, 171[#include <net/bpf.h> 172#ifdef BIOCSHDRCMPLT 173found_BIOCSHDRCMPLT 174#endif 175], [tme_raw_type=bpf])]) 176AC_MSG_CHECKING([for raw Ethernet access method]) 177case "x$tme_raw_type" in 178xbpf) TME_HOSTS="${TME_HOSTS} bsd" ;; 179x) tme_raw_type=none ;; 180esac 181AC_MSG_RESULT($tme_raw_type) 182 183dnl Checks for X11. 184AC_PATH_XTRA 185 186dnl Checks for GTK. 187AM_PATH_GTK_2_0([], have_gtk=true, have_gtk=false) 188if $have_gtk; then 189 AC_DEFINE(HAVE_GTK, [], [Define if you are compiling with GTK.]) 190 TME_HOSTS="${TME_HOSTS} gtk" 191fi 192 193dnl Characterize any graphics displays and remember the areas of 194dnl the smallest and largest screens. 195TME_FB_XLAT_DST= 196area_smallest=0 197area_largest=0 198 199# if --with-tme-host-displays is given, characterize those given displays: 200AC_ARG_WITH(tme-host-displays, 201[ --with-tme-host-displays=DISPLAYS support host displays with these display formats]) 202for dst_key in ${with_tme_host_displays}; do 203 204 dnl Make brackets safe to use. 205 changequote(<<, >>)dnl 206 207 this_width=`echo ${dst_key} | sed -e 's/^\([0-9][0-9]*\)x\([0-9][0-9]*\)\(.*\)$/\1/'` 208 this_height=`echo ${dst_key} | sed -e 's/^\([0-9][0-9]*\)x\([0-9][0-9]*\)\(.*\)$/\2/'` 209 dst_key=`echo ${dst_key} | sed -e 's/^\([0-9][0-9]*\)x\([0-9][0-9]*\)\(.*\)$/\3/'` 210 this_area=`expr ${this_width} \* ${this_height}` 211 212 if test ${area_smallest} = 0 || test `expr ${this_area} \< ${area_smallest}` = 1; then 213 area_smallest=${this_area} 214 fi 215 if test `expr ${this_area} \> ${area_largest}` = 1; then 216 area_largest=${this_area} 217 fi 218 219 # add in this destination display key: 220 if echo " ${TME_FB_XLAT_DST} " | grep " ${dst_key} " > /dev/null 2>&1; then :; else 221 TME_FB_XLAT_DST="${TME_FB_XLAT_DST} ${dst_key}" 222 fi 223 224 dnl Make brackets the quote characters again. 225 changequote([, ])dnl 226done 227 228# if DISPLAY is set and xdpyinfo appears to work, characterize this X display: 229if test "x${DISPLAY}" != x && xdpyinfo >/dev/null 2>&1; then 230 AC_MSG_CHECKING(characteristics of X display ${DISPLAY}) 231 232 dnl Make brackets safe to use. 233 changequote(<<, >>)dnl 234 235 # get the format this display uses for bitmaps: 236 bitmap_info=`xdpyinfo | grep 'bitmap unit' | sed -e 's/bitmap unit, *bit order, *padding: *\(.*\)$/\1/'` 237 bitmap_order=`echo ${bitmap_info} | sed -e 's/\([0-9][0-9]*\), *\([LM]\)SBFirst, *\([0-9][0-9]*\).*/\2/'` 238 bitmap_pad=`echo ${bitmap_info} | sed -e 's/\([0-9][0-9]*\), *\([LM]\)SBFirst, *\([0-9][0-9]*\).*/\3/'` 239 bitmap_order=`echo ${bitmap_order} | tr A-Z a-z` 240 241 # get the format this display uses for images at its default depth. we 242 # assume that the root window is at the default depth: 243 pixmap_order=`xdpyinfo | grep 'image byte order'` 244 pixmap_order=`echo ${pixmap_order} | sed -e 's/.*image byte order: *\([LM]\)SBFirst.*/\1/' | tr A-Z a-z` 245 pixmap_depth=`xwininfo -root | grep 'Depth:'` 246 pixmap_depth=`echo ${pixmap_depth} | sed -e 's/.*Depth: *\([0-9][0-9]*\).*/\1/'` 247 pixmap_infos=`xdpyinfo | grep bits_per_pixel | tr '\n' %` 248 save_IFS=$IFS 249 IFS=% 250 for pixmap_info in $pixmap_infos; do 251 IFS=$save_IFS 252 if test "x$pixmap_info" = x; then continue; fi 253 this_pixmap_depth=`echo ${pixmap_info} | sed -e 's/.*depth \([0-9][0-9]*\), *bits_per_pixel \([0-9][0-9]*\), *scanline_pad \([0-9][0-9]*\).*/\1/'` 254 this_pixmap_bipp=`echo ${pixmap_info} | sed -e 's/.*depth \([0-9][0-9]*\), *bits_per_pixel \([0-9][0-9]*\), *scanline_pad \([0-9][0-9]*\).*/\2/'` 255 this_pixmap_pad=`echo ${pixmap_info} | sed -e 's/.*depth \([0-9][0-9]*\), *bits_per_pixel \([0-9][0-9]*\), *scanline_pad \([0-9][0-9]*\).*/\3/'` 256 if test "x${this_pixmap_depth}" = "x${pixmap_depth}"; then 257 pixmap_bipp=${this_pixmap_bipp} 258 pixmap_pad=${this_pixmap_pad} 259 break 260 fi 261 done 262 IFS=$save_IFS 263 264 # if this display's greatest depth is one, we use its 265 # bitmap format: 266 if test "x${pixmap_bipp}" = x; then 267 pixmap_bipp=1 268 pixmap_pad=${bitmap_pad} 269 270 # our translation functions can't handle the case when the bitmap 271 # bit order is different from the image byte order - doing so 272 # requires dealing with the bitmap unit size. since this 273 # situation is rare, just bail: 274 if test ${bitmap_order} != ${pixmap_order}; then 275 changequote([, ])dnl 276 AC_MSG_WARN([the X display ${DISPLAY} is monochrome and needs bitmaps with a bit order that the generic code doesn't support]) 277 changequote(<<, >>)dnl 278 pixmap_bipp= 279 fi 280 fi 281 282 # if this display seems usable: 283 if test "x${pixmap_bipp}" != x; then 284 285 # check the dimensions of all screens on this display: 286 dimensions=`xdpyinfo | grep dimensions | tr '\n' %` 287 save_IFS=$IFS 288 IFS=% 289 for dimension in $dimensions; do 290 IFS=$save_IFS 291 if test "x$dimension" = x; then continue; fi 292 this_width=`echo ${dimension} | sed -e 's/.*dimensions: *\([0-9][0-9]*\)x\([0-9][0-9]*\).*/\1/'` 293 this_height=`echo ${dimension} | sed -e 's/.*dimensions: *\([0-9][0-9]*\)x\([0-9][0-9]*\).*/\2/'` 294 this_area=`expr ${this_width} \* ${this_height}` 295 if test ${area_smallest} = 0 || test `expr ${this_area} \< ${area_smallest}` = 1; then 296 area_smallest=${this_area} 297 fi 298 if test `expr ${this_area} \> ${area_largest}` = 1; then 299 area_largest=${this_area} 300 fi 301 done 302 IFS=$save_IFS 303 304 # assume an unknown set of masks and an unknown mapping type: 305 dst_masks=_r0x0_g0x0_b0x0 306 dst_map= 307 value_visual=", unknown visual" 308 309 # if the depth is greater than one: 310 if test "x${pixmap_depth}" != 1; then 311 312 # we assume that the root window uses the default visual: 313 visual=`xwininfo -root | grep 'Visual Class:' | sed -e 's/^ *Visual Class: *\([A-Za-z][A-Za-z]*\).*$/\1/'` 314 315 # get any primary masks for this visual: 316 case "x${visual}" in 317 xDirectColor | xTrueColor) 318 dst_masks=`xdpyinfo | $EGREP '(visual id|class|blue masks):' | $EGREP -C1 $visual | grep 'blue masks' | head -1` 319 dst_masks=`echo ${dst_masks} | sed -e 's/^.*blue masks: *\(.*\)/\1/'` 320 value_visual=", rgb masks ${dst_masks}" 321 dst_masks=`echo ${dst_masks} | sed -e 's/^/_r/' -e 's/, /_g/' -e 's/, /_b/'` 322 ;; 323 xStaticGray | xGrayScale | xStaticColor | xPseudoColor) 324 dst_masks= 325 value_visual=", no subfields" 326 ;; 327 *) ;; 328 esac 329 330 # get the mapping type for this visual: 331 case "x${visual}" in 332 xStaticGray | xStaticColor | xPseudoColor) 333 dst_map="ml" 334 ;; 335 xDirectColor) 336 dst_map="mi" 337 value_visual="${value_visual}, indexed" 338 ;; 339 xGrayScale | xTrueColor) 340 dst_map="ml" 341 value_visual="${value_visual}, linear" 342 ;; 343 *) ;; 344 esac 345 fi 346 347 dnl Make brackets the quote characters again. 348 changequote([, ])dnl 349 350 # finish the characterization: 351 if test "x${pixmap_bipp}" = "x${pixmap_depth}"; then 352 value= 353 else 354 value=" (${pixmap_bipp} bits per pixel)" 355 fi 356 AC_MSG_RESULT([${pixmap_depth}-bit${value} ${pixmap_order}sb-first images with ${pixmap_pad}-bit padding${value_visual}]) 357 dst_key="d${pixmap_depth}b${pixmap_bipp}s0p${pixmap_pad}o${pixmap_order}${dst_map}${dst_masks}" 358 359 # add in this destination display key: 360 if echo " ${TME_FB_XLAT_DST} " | grep " ${dst_key} " > /dev/null 2>&1; then :; else 361 TME_FB_XLAT_DST="${TME_FB_XLAT_DST} ${dst_key}" 362 fi 363 fi 364fi 365AC_SUBST(TME_FB_XLAT_DST) 366 367dnl Configures for the system(s) to emulate. 368systems=all 369if echo " ${systems} " | grep ' all ' > /dev/null 2>&1; then 370 systems="sun2 sun3 sun4" 371 if test $ac_cv_sizeof_long = 8 || test "x${GCC}" = "xyes"; then 372 systems="${systems} sunultra1" 373 fi 374fi 375TME_MACHINE_SUBDIRS= 376TME_IC_SUBDIRS= 377TME_ICS= 378TME_SERIAL_SUBDIRS= 379TME_SERIALS= 380TME_BUS_SUBDIRS= 381TME_FB_XLAT_SRC= 382bus_size_max=32 383recode_size_guest_max=0 384for system in $systems; do 385 386 # dispatch on the machine type to get more machines, ICs, and 387 # buses to compile: 388 case ${system} in 389 390 # the sun2: 391 sun2) 392 machines="sun sun2" 393 ics="m68k am9513 mm58167 z8530 i825x6" 394 buses="multibus" 395 fb_xlats="1152x900d1b1s0p32om" 396 bus_size=32 397 recode_size_guest=0 398 ;; 399 400 # the sun3: 401 sun3) 402 machines="sun sun3" 403 ics="m68k isil7170 z8530 i825x6 ieee754 ncr5380" 404 buses="multibus" 405 fb_xlats="1152x900d1b1s0p32om 1152x900d8b8s0p32ommi8 1152x900d1b1s0p32omccmi8" 406 bus_size=32 407 recode_size_guest=0 408 ;; 409 410 # the sun4: 411 sun4) 412 machines="sun sun4" 413 ics="sparc isil7170 z8530 am7930 am7990 ieee754 ncr53c9x mk48txx lsi64854 nec765" 414 buses="sbus" 415 fb_xlats="1152x900d1b1s0p32om 1152x900d8b8s0p32ommi8 1152x900d1b1s0p32omccmi8" 416 bus_size=32 417 recode_size_guest=32 418 ;; 419 420 # the sun Ultra-1: 421 sunultra1) 422 machines="sun sun4u" 423 ics="sparc stp22xx z8530 am7990 ieee754 ncr53c9x ncr89c105 mk48txx lsi64854 nec765 stp2024 ad184x" 424 buses="sbus" 425 fb_xlats="1152x900d1b1s0p32om 1152x900d8b8s0p32ommi8 1152x900d1b1s0p32omccmi8" 426 bus_size=64 427 recode_size_guest=64 428 ;; 429 430 *) 431 AC_MSG_ERROR([don't know how to emulate ${machine}]) 432 ;; 433 esac 434 435 # update the maximum bus size: 436 if test `expr ${bus_size_max} \< ${bus_size}` = 1; then 437 bus_size_max=$bus_size 438 fi 439 440 # update the maximum recode guest size: 441 if test `expr ${recode_size_guest_max} \< ${recode_size_guest}` = 1; then 442 recode_size_guest_max=$recode_size_guest 443 fi 444 445 # add in the new machines, ICs, serials, and buses to compile: 446 for machine in $machines; do 447 if echo " ${TME_MACHINE_SUBDIRS} " | grep " ${machine} " > /dev/null 2>&1; then :; else 448 TME_MACHINE_SUBDIRS="${TME_MACHINE_SUBDIRS} ${machine}" 449 fi 450 done 451 for ic in $ics; do 452 if test -d $srcdir/ic/$ic; then 453 if echo " ${TME_IC_SUBDIRS} " | grep " ${ic} " > /dev/null 2>&1; then :; else 454 TME_IC_SUBDIRS="${TME_IC_SUBDIRS} ${ic}" 455 fi 456 else 457 ic="tme_ic_${ic}.la" 458 if echo " ${TME_ICS} " | grep " ${ic} " > /dev/null 2>&1; then :; else 459 TME_ICS="${TME_ICS} ${ic}" 460 fi 461 fi 462 done 463 for serial in $serials; do 464 if test -d $srcdir/serial/$serial; then 465 if echo " ${TME_SERIAL_SUBDIRS} " | grep " ${serial} " > /dev/null 2>&1; then :; else 466 TME_SERIAL_SUBDIRS="${TME_SERIAL_SUBDIRS} ${serial}" 467 fi 468 else 469 serial="tme_serial_${serial}.la" 470 if echo " ${TME_SERIALS} " | grep " ${serial} " > /dev/null 2>&1; then :; else 471 TME_SERIALS="${TME_SERIALS} ${serial}" 472 fi 473 fi 474 done 475 for bus in $buses; do 476 if echo " ${TME_BUS_SUBDIRS} " | grep " ${bus} " > /dev/null 2>&1; then :; else 477 TME_BUS_SUBDIRS="${TME_BUS_SUBDIRS} ${bus}" 478 fi 479 done 480 481 # add in the new frame buffer translations to compile: 482 for fb_xlat in $fb_xlats; do 483 if echo " ${TME_FB_XLAT_SRC} " | grep " ${fb_xlat} " > /dev/null 2>&1; then :; else 484 TME_FB_XLAT_SRC="${TME_FB_XLAT_SRC} ${fb_xlat}" 485 fi 486 487 dnl Make brackets safe to use. 488 changequote(<<, >>)dnl 489 490 # calculate the area of this frame buffer multiplied by 100: 491 this_width=`echo ${fb_xlat} | sed -e 's/^\([0-9][0-9]*\)x\([0-9][0-9]*\)\(.*\)$/\1/'` 492 this_height=`echo ${fb_xlat} | sed -e 's/^\([0-9][0-9]*\)x\([0-9][0-9]*\)\(.*\)$/\2/'` 493 this_area=`expr ${this_width} \* ${this_height} \* 100` 494 495 dnl Make brackets the quote characters again. 496 changequote([, ])dnl 497 498 # if this frame buffer would consume at least 70 percent of 499 # the smallest destination screen, make an xlat function that 500 # scales this frame buffer down by two: 501 if test ${area_smallest} = 0; then 502 percentage=100 503 else 504 percentage=`expr ${this_area} / ${area_smallest}` 505 fi 506 if test `expr ${percentage} \> 70` = 1; then 507 src_key="${fb_xlat}_h" 508 if echo " ${TME_FB_XLAT_SRC} " | grep " ${src_key} " > /dev/null 2>&1; then :; else 509 TME_FB_XLAT_SRC="${TME_FB_XLAT_SRC} ${src_key}" 510 fi 511 fi 512 513 # if this frame buffer would consume less than 30 percent of 514 # the largest destination screen, make an xlat function that 515 # scales this frame buffer up by two: 516 if test ${area_largest} = 0; then 517 percentage=0 518 else 519 percentage=`expr ${this_area} / ${area_largest}` 520 fi 521 if test `expr ${percentage} \< 30` = 1; then 522 src_key="${fb_xlat}_d" 523 if echo " ${TME_FB_XLAT_SRC} " | grep " ${src_key} " > /dev/null 2>&1; then :; else 524 TME_FB_XLAT_SRC="${TME_FB_XLAT_SRC} ${src_key}" 525 fi 526 fi 527 done 528done 529AC_SUBST(TME_MACHINE_SUBDIRS) 530AC_SUBST(TME_IC_SUBDIRS) 531AC_SUBST(TME_ICS) 532AC_SUBST(TME_SERIAL_SUBDIRS) 533AC_SUBST(TME_SERIALS) 534AC_SUBST(TME_BUS_SUBDIRS) 535AC_SUBST(TME_FB_XLAT_SRC) 536 537dnl The list of host support is finished. 538AC_SUBST(TME_HOSTS) 539 540dnl Configure recode. 541AC_ARG_ENABLE(recode, 542[ --enable-recode enable recode (dynamic binary translation) (default=if target supports)], 543[ ], [enable_recode=]) 544if test "${recode_size_guest_max}" = 0; then 545 enable_recode=no 546 recode_size_guest_max=1 547fi 548if test "x${enable_recode}" = no; then 549 recode_hosts= 550else 551 AC_MSG_CHECKING([for target recode support]) 552 553 dnl Make brackets safe to use. 554 changequote(<<, >>)dnl 555 556 # get the host maximum guest size: 557 case "${target_cpu}" in 558 i[3456789]86) 559 recode_size_guest_max_host=64 560 ;; 561 x86_64) 562 recode_size_guest_max_host=128 563 ;; 564 *) recode_size_guest_max_host= ;; 565 esac 566 567 # get the host recode parts: 568 case "${target}" in 569 i[3456789]86-*-netbsd* | x86_64-*-netbsd* | i[3456789]86-*-linux*) 570 recode_hosts="mmap x86" 571 ;; 572 *) recode_hosts= ;; 573 esac 574 575 dnl Make brackets the quote characters again. 576 changequote([, ])dnl 577 578 if test "x${recode_hosts}" = x; then 579 AC_MSG_RESULT([no]) 580 if test "x${enable_recode}" = xrequired; then 581 AC_MSG_ERROR([recode required but not supported on ${target}]) 582 fi 583 else 584 if test "x${recode_size_guest_max_host}" = x; then 585 AC_MSG_ERROR([internal error - no maximum recode guest size for ${target_cpu}]) 586 fi 587 if test `expr ${recode_size_guest_max} \> ${recode_size_guest_max_host}` = 1; then 588 recode_size_guest_max=$recode_size_guest_max_host 589 fi 590 AC_MSG_RESULT([up to ${recode_size_guest_max}-bit guests using ${recode_hosts}]) 591 fi 592fi 593 594dnl Configure miscellaneous target support. 595AC_MSG_CHECKING([for target miscellaneous support]) 596changequote(<<, >>)dnl 597case "${target}" in 598i[3456789]86-* | x86_64-*) misc_hosts="x86" ;; 599*) misc_hosts=no ;; 600esac 601changequote([, ])dnl 602AC_MSG_RESULT([${misc_hosts}]) 603if test "x${misc_hosts}" = xno; then 604 misc_hosts= 605fi 606 607dnl Configure for libtool. 608LT_CONFIG_LTDL_DIR([libltdl]) 609LT_INIT([dlopen]) 610LTDL_INIT 611TME_PREOPEN= 612if test $enable_shared = no; then 613 TME_PREOPEN='`sort -u $(top_builddir)/tme-preopen.txt`' 614fi 615AC_SUBST(TME_PREOPEN) 616 617dnl Configure debugging and/or warnings. 618AC_ARG_ENABLE(debug, 619[ --enable-debug compile debuggable libraries and programs (default=don't)], 620[ ], [enable_debug=no]) 621if test "x$enable_debug" = "xyes"; then 622 CFLAGS="${CFLAGS-} -g -O0" 623 CXXFLAGS="${CXXFLAGS-} -g3 -O0" 624else 625 CPPFLAGS="${CPPFLAGS-} -DTME_NO_LOG -DTME_NO_DEBUG_LOCKS -DTME_NO_AUDIT_ATOMICS -DNDEBUG" 626fi 627AC_ARG_ENABLE(warnings, 628[ --disable-warnings don't compile with warnings turned on (default=do)], 629[ ], [enable_warnings=yes]) 630if test "x$enable_warnings" = "xyes" -a "x$GCC" = "xyes"; then 631 CFLAGS="${CFLAGS-} -Wundef -Wall -Werror" 632 CXXFLAGS="${CXXFLAGS-} -W" 633fi 634 635dnl Some code isn't alias-clean. 636CFLAGS_NO_STRICT_ALIASING= 637if test "x$GCC" = "xyes"; then 638 CFLAGS_NO_STRICT_ALIASING=" -fno-strict-aliasing" 639fi 640AC_SUBST(CFLAGS_NO_STRICT_ALIASING) 641 642dnl Generate tmeconfig.h. The whether-to-generate logic is cribbed 643dnl from glib-1.2.1's configure.in. 644dnl See that file for an explanation. 645AC_OUTPUT_COMMANDS([ 646 647## Generate our configure-time sources in two 648## cases: 649## 1. `config.status' is run either explicitly, or via configure. 650## Esp. not when it is run in `Makefile' to generate makefiles and 651## config.h 652## 2. CONFIG_OTHER is set explicitly 653## 654## Case 1 is difficult. We know that `automake' sets one of 655## CONFIG_FILES or CONFIG_HEADERS to empty. This heuristic works 656## only when AM_CONFIG_HEADER is set, however. 657 658case "x$CONFIG_OTHER" in 659*tmeconfig.h) gen_tmeconfig_h=yes 660;; 661esac 662if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then 663 # Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1 664 if test "x${CONFIG_OTHER}" = x; then 665 gen_tmeconfig_h=yes 666 fi 667fi 668 669## If we're generating tmeconfig.h: 670if test "x$gen_tmeconfig_h" = xyes; then 671 outfile=tmeconfig.h 672 echo "$as_me: creating $outfile" 673 cat <<TMEEOF > ${outfile}-tmp 674/* tmeconfig.h 675 * 676 * This is an automatically generated file - please modify 'configure.in'. 677 */ 678 679#ifndef _TMECONFIG_H 680#define _TMECONFIG_H 681 682TMEEOF 683 sed -e '/FLOAT_FORMAT/ s/#[[:space:]]*define[[:space:]]\{1,\}\([A-Za-z0-9_]\{1,\}\)[[:space:]]\{1,\}\([A-Za-z0-9_]\{1,\}\)/#define TME_\1 TME_FLOAT_FORMAT_\2/' \ 684 -e '/FLOAT_FORMAT/!s/#[[:space:]]*define[[:space:]]\{1,\}/&_TME_/' config.h >> ${outfile}-tmp 685 echo '#define TME_BUSMAX_LOG2 TME_BUS'${bus_size_max}'_LOG2' >> ${outfile}-tmp 686 echo '#define TME_HAVE_RECODE (' \ 687 `if test "x${recode_hosts}" = x; then echo 0; else echo 1; fi` ')' >> ${outfile}-tmp 688 echo '#define TME_RECODE_SIZE_GUEST_MAX TME_RECODE_SIZE_'${recode_size_guest_max} >> ${outfile}-tmp 689 echo '#define TME_RELEASE_MAJOR (' \ 690 `echo $VERSION | sed -e 's,^\([0-9][0-9]*\)\.[0-9][0-9]*$,\1,'` ')' >> ${outfile}-tmp 691 echo '#define TME_RELEASE_MINOR (' \ 692 `echo $VERSION | sed -e 's,^[0-9][0-9]*\.\([0-9][0-9]*\)$,\1,'` ')' >> ${outfile}-tmp 693 echo '#define TME_BUILD_TARGET "'$target'"' >> ${outfile}-tmp 694 if test $ac_cv_sizeof_long = 8; then 695 echo '#define TME_HAVE_INT64_T' >> ${outfile}-tmp 696 echo '#define _TME_PRI64 "l"' >> ${outfile}-tmp 697 echo 'typedef signed long tme_int64_t;' >> ${outfile}-tmp 698 echo 'typedef unsigned long tme_uint64_t;' >> ${outfile}-tmp 699 fi 700 if test $ac_cv_sizeof_int = 4; then 701 echo '#define _TME_PRI32 ""' >> ${outfile}-tmp 702 echo 'typedef signed int tme_int32_t;' >> ${outfile}-tmp 703 echo 'typedef unsigned int tme_uint32_t;' >> ${outfile}-tmp 704 elif test $ac_cv_sizeof_long = 4; then 705 echo '#define _TME_PRI32 "l"' >> ${outfile}-tmp 706 echo 'typedef signed long tme_int32_t;' >> ${outfile}-tmp 707 echo 'typedef unsigned long tme_uint32_t;' >> ${outfile}-tmp 708 fi 709 if test $ac_cv_sizeof_int = 2; then 710 echo 'typedef signed int tme_int16_t;' >> ${outfile}-tmp 711 echo 'typedef unsigned int tme_uint16_t;' >> ${outfile}-tmp 712 elif test $ac_cv_sizeof_short = 2; then 713 echo 'typedef signed short tme_int16_t;' >> ${outfile}-tmp 714 echo 'typedef unsigned short tme_uint16_t;' >> ${outfile}-tmp 715 fi 716 echo 'typedef signed char tme_int8_t;' >> ${outfile}-tmp 717 echo 'typedef unsigned char tme_uint8_t;' >> ${outfile}-tmp 718 cat <<TMEEOF >> ${outfile}-tmp 719 720/* features that aren't currently controlled by a configure option: */ 721#define TME_THREADS_SJLJ 722 723#endif /* !_TMECONFIG_H */ 724TMEEOF 725 if cmp -s ${outfile}-tmp $outfile; then 726 echo "$as_me: $outfile is unchanged" 727 rm -f ${outfile}-tmp 728 else 729 mv ${outfile}-tmp ${outfile} 730 fi 731 732 outfile=tme/recode-host.h 733 echo "$as_me: creating $outfile" 734 cat <<TMEEOF > ${outfile}-tmp 735/* recode-host.h 736 * 737 * This is an automatically generated file - please modify 'configure.in'. 738 */ 739 740TMEEOF 741 for host in ${recode_hosts}; do 742 echo '#include <tme/host/recode-'${host}'.h>' >> ${outfile}-tmp 743 done 744 delim='#define TME_RECODE_HOST_IC \' 745 for host in ${recode_hosts}; do 746 echo ${delim} >> ${outfile}-tmp 747 echo -n ' TME_RECODE_'`echo ${host} | tr '[a-z]' '[A-Z]'`'_IC' >> ${outfile}-tmp 748 delim='; \' 749 done 750 echo '' >> ${outfile}-tmp 751 if cmp -s ${outfile}-tmp $outfile; then 752 echo "$as_me: $outfile is unchanged" 753 rm -f ${outfile}-tmp 754 else 755 mv ${outfile}-tmp ${outfile} 756 fi 757 758 outfile=libtme/recode-host.c 759 echo "$as_me: creating $outfile" 760 cat <<TMEEOF > ${outfile}-tmp 761/* recode-host.c 762 * 763 * This is an automatically generated file - please modify 'configure.in'. 764 */ 765 766TMEEOF 767 for host in ${recode_hosts}; do 768 if test -d ${srcdir}/libtme/host/${host}; then 769 echo '#include "libtme/host/'${host}'/recode-'${host}'.c"' >> ${outfile}-tmp 770 else 771 echo '#include "libtme/host/recode-'${host}'.c"' >> ${outfile}-tmp 772 fi 773 done 774 if cmp -s ${outfile}-tmp $outfile; then 775 echo "$as_me: $outfile is unchanged" 776 rm -f ${outfile}-tmp 777 else 778 mv ${outfile}-tmp ${outfile} 779 fi 780 781 outfile=libtme/misc-host.c 782 echo "$as_me: creating $outfile" 783 cat <<TMEEOF > ${outfile}-tmp 784/* misc-host.c 785 * 786 * This is an automatically generated file - please modify 'configure.in'. 787 */ 788 789TMEEOF 790 for host in ${misc_hosts}; do 791 if test -d ${srcdir}/libtme/host/${host}; then 792 echo '#include "libtme/host/'${host}'/misc-'${host}'.c"' >> ${outfile}-tmp 793 else 794 echo '#include "libtme/host/misc-'${host}'.c"' >> ${outfile}-tmp 795 fi 796 done 797 echo '#include "libtme/misc.c"' >> ${outfile}-tmp 798 if cmp -s ${outfile}-tmp $outfile; then 799 echo "$as_me: $outfile is unchanged" 800 rm -f ${outfile}-tmp 801 else 802 mv ${outfile}-tmp ${outfile} 803 fi 804 805fi 806], [ 807recode_hosts="$recode_hosts" 808recode_size_guest_max="$recode_size_guest_max" 809misc_hosts="$misc_hosts" 810srcdir="$srcdir" 811PACKAGE="$PACKAGE" 812VERSION="$VERSION" 813target="$target" 814ac_cv_sizeof_int="$ac_cv_sizeof_int" 815ac_cv_sizeof_long="$ac_cv_sizeof_long" 816ac_cv_sizeof_short="$ac_cv_sizeof_short" 817bus_size_max="$bus_size_max" 818]) 819 820dnl Writes files. 821AC_OUTPUT(Makefile 822 tme/Makefile 823 tme/ic/Makefile 824 tme/machine/Makefile 825 tme/generic/Makefile 826 tme/scsi/Makefile 827 tme/host/Makefile 828 tme/bus/Makefile 829 libtme/Makefile 830 libtme/host/Makefile 831 libtme/host/x86/Makefile 832 ic/Makefile 833 ic/m68k/Makefile 834 ic/ieee754/Makefile 835 ic/sparc/Makefile 836 ic/stp22xx/Makefile 837 machine/Makefile 838 machine/sun/Makefile 839 machine/sun2/Makefile 840 machine/sun3/Makefile 841 machine/sun4/Makefile 842 machine/sun4u/Makefile 843 host/Makefile 844 host/posix/Makefile 845 host/bsd/Makefile 846 host/gtk/Makefile 847 bus/Makefile 848 bus/multibus/Makefile 849 bus/sbus/Makefile 850 serial/Makefile 851 scsi/Makefile 852 generic/Makefile 853 tmesh/Makefile 854 tools/Makefile) 855 856