1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695
|
dnl Written by Peter Ekberg, peda@lysator.liu.se
dnl Process this file with autoconf to produce a configure script.
AC_DEFUN(PE_PATH_SVGA_INCLUDES,
[
AC_ARG_ENABLE(svga-includes,
[ --enable-svga-includes=DIR
SVGAlib include files are in DIR],
[
dnl User specified where includes are.
if test "x$enableval" = x; then
pe_cv_svga_includes=NONE
else
pe_cv_svga_includes="$enableval"
fi
],
[
AC_CACHE_VAL(pe_cv_svga_includes, [
dnl User did not specify where includes are.
dnl Check first if they are in the compiler include path.
AC_TRY_CPP([
#include <vga.h>
#include <vgagl.h>
#include <vgakeyboard.h>
],
[
dnl Includes are in the compiler include path.
pe_cv_svga_includes=NONE
],
[
dnl Includes are not in the compiler include path.
dnl Try to locate them.
for pe_dir in \
/usr/local/svga/include \
/usr/local/include \
/usr/include \
; \
do
if test -r "$pe_dir/vga.h" && \
test -r "$pe_dir/vgagl.h" && \
test -r "$pe_dir/vgakeyboard.h"; then
pe_cv_svga_includes="$pe_dir"
break
fi
done
])
if test "x$pe_cv_svga_includes" = x; then
pe_cv_svga_includes=no
fi
])
])
])
AC_DEFUN(PE_PATH_SVGA_LIBRARIES,
[
AC_ARG_ENABLE(svga-libraries,
[ --enable-svga-libraries=DIR
SVGAlib library files are in DIR],
[
dnl User specified where libraries are.
if test "x$enableval" = x; then
pe_cv_svga_libraries=NONE
else
pe_cv_svga_libraries="$enableval"
fi
],
[
AC_CACHE_VAL(pe_cv_svga_libraries, [
dnl User did not specify where libraries are.
pe_libs="$LIBS"
LIBS="$LIBS -lvga"
if test "$pe_cv_svga_includes" != NONE; then
pe_cflags="$CFLAGS"
CFLAGS="-I$pe_cv_svga_includes $CFLAGS"
fi
AC_TRY_LINK([#include <vga.h>],
[
vga_init();
],
[
dnl Libraries are found without -L{path}.
pe_cv_svga_libraries=NONE
],
[
dnl Libraries are not found without -L{path}.
dnl Try to locate them.
for pe_dir in \
/usr/local/svga/lib \
/usr/local/lib/svga \
/usr/local/lib \
/usr/lib \
/lib \
; \
do
if test -r "$pe_dir/libvga.so.1"; then
pe_cv_svga_libraries="$pe_dir"
break
fi
done
if test "x$pe_cv_svga_libraries" = x; then
pe_cv_svga_libraries=no
fi
])
LIBS="$pe_libs"
if test "$pe_cv_svga_includes" != NONE; then
CFLAGS="$pe_cflags"
fi
])
])
])
AC_DEFUN(PE_PATH_SVGA,
[
AC_MSG_CHECKING(for SVGAlib)
AC_ARG_WITH(svga,
[ --with-svga use SVGAlib],
[
if test "x$withval" = xno; then
no_svga=yes
fi
])
if test "x$no_svga" = x; then
PE_PATH_SVGA_INCLUDES
PE_PATH_SVGA_LIBRARIES
if test "$pe_cv_svga_includes" != no && \
test "$pe_cv_svga_libraries" != no; then
AC_MSG_RESULT(
[headers $pe_cv_svga_includes, libraries $pe_cv_svga_libraries])
if test "$pe_cv_svga_includes" != NONE; then
SVGA_CFLAGS="-I$pe_cv_svga_includes"
fi
if test "$pe_cv_svga_libraries" != NONE; then
SVGA_LIBS="-L$pe_cv_svga_libraries"
fi
AC_SUBST(SVGA_CFLAGS)
AC_SUBST(SVGA_LIBS)
else
AC_MSG_RESULT(no)
no_svga=yes
fi
else
AC_MSG_RESULT(disabled)
fi
])
AC_DEFUN(PE_HEADER_VGAKEYBOARD_DEFINE_P,
[
AC_REQUIRE([PE_PATH_SVGA])
pe_cppflags="$CPPFLAGS"
CPPFLAGS="$SVGA_CFLAGS $CPPFLAGS"
AC_CHECK_HEADER(vgakeyboard.h, [
AC_CACHE_CHECK(if vgakeyboard.h defines SCANCODE_P,
pe_cv_header_vgakeyboard_define_p, [
AC_EGREP_CPP([scancode_p_defined], [
#include <vgakeyboard.h>
#ifdef SCANCODE_P
int scancode_p_defined;
#endif],
[pe_cv_header_vgakeyboard_define_p=yes],
[pe_cv_header_vgakeyboard_define_p=no])
])
], [no_svga=yes])
if test "x$pe_cv_header_vgakeyboard_define_p" = xyes; then
AC_DEFINE(HAVE_DEFINE_SCANCODE_P)
fi
CPPFLAGS="$pe_cppflags"
])
AC_DEFUN(PE_HEADER_VGA_HAS_VGA_GETMODENUMBER,
[
AC_REQUIRE([PE_PATH_SVGA])
pe_cppflags="$CPPFLAGS"
CPPFLAGS="$SVGA_CFLAGS $CPPFLAGS"
pe_libs="$LIBS"
LIBS="$LIBS $SVGA_LIBS -lvga"
AC_CACHE_CHECK(if vga.h has vga_getmodenumber,
pe_cv_header_vga_has_vga_getmodenumber, [
AC_TRY_LINK([#include <vga.h>],
[
vga_getmodenumber("G320x200x256");
],
[pe_cv_header_vga_has_vga_getmodenumber=yes],
[pe_cv_header_vga_has_vga_getmodenumber=no])
])
if test "x$pe_cv_header_vga_has_vga_getmodenumber" = xyes; then
AC_DEFINE(HAVE_VGA_GETMODENUMBER)
fi
CPPFLAGS="$pe_cppflags"
LIBS="$pe_libs"
])
AC_DEFUN(PE_PATH_PBM_INCLUDES,
[
AC_ARG_ENABLE(pbm-includes,
[ --enable-pbm-includes=DIR
pbm include files are in DIR],
[
dnl User specified where includes are.
if test "x$enableval" = x; then
pe_cv_pbm_includes=NONE
else
pe_cv_pbm_includes="$enableval"
fi
],
[
AC_CACHE_VAL(pe_cv_pbm_includes, [
dnl User did not specify where includes are.
dnl Check first if they are in the compiler include path.
AC_TRY_CPP([
#include <pnm.h>
],
[
dnl Includes are in the compiler include path.
pe_cv_pbm_includes=NONE
],
[
dnl Includes are not in the compiler include path.
dnl Try to locate them.
for pe_dir in \
/usr/local/pbm/include/X11 \
/usr/local/pbm/include \
/usr/local/include/X11 \
/usr/local/include \
/usr/pbm/include/X11 \
/usr/pbm/include \
/usr/include/X11 \
/usr/include \
; \
do
if test -r "$pe_dir/pnm.h" && \
test -r "$pe_dir/ppm.h" && \
test -r "$pe_dir/pgm.h" && \
test -r "$pe_dir/pbm.h"; then
pe_cv_pbm_includes="$pe_dir"
break
fi
done
])
if test "x$pe_cv_pbm_includes" = x; then
pe_cv_pbm_includes=no
fi
])
])
])
AC_DEFUN(PE_PATH_PBM_LIBRARIES,
[
AC_ARG_ENABLE(pbm-libraries,
[ --enable-pbm-libraries=DIR
pbm library files are in DIR],
[
dnl User specified where libraries are.
if test "x$enableval" = x; then
pe_cv_pbm_libraries=NONE
else
pe_cv_pbm_libraries="$enableval"
fi
],
[
AC_CACHE_VAL(pe_cv_pbm_libraries, [
dnl User did not specify where libraries are.
pe_libs="$LIBS"
LIBS="$LIBS -lpnm -lppm -lpgm -lpbm"
if test "$pe_cv_pbm_includes" != NONE; then
pe_cflags="$CFLAGS"
CFLAGS="-I$pe_cv_pbm_includes $CFLAGS"
fi
AC_TRY_LINK([#include <pnm.h>],
[
pnm_allocarray(4, 6);
],
[
dnl Libraries are found without -L{path}.
pe_cv_pbm_libraries=NONE
],
[
dnl Libraries are not found without -L{path}.
dnl Try to locate them.
for pe_dir in \
/usr/local/pbm/lib \
/usr/local/lib/pbm \
/usr/local/lib \
/usr/pbm/lib \
/usr/lib/pbm \
/usr/lib \
/lib \
; \
do
if test -r "$pe_dir/libpnm.so.1"; then
pe_cv_pbm_libraries="$pe_dir"
break
fi
done
if test "x$pe_cv_pbm_libraries" = x; then
pe_cv_pbm_libraries=no
fi
])
LIBS="$pe_libs"
if test "$pe_cv_pbm_includes" != NONE; then
CFLAGS="$pe_cflags"
fi
])
])
])
AC_DEFUN(PE_PATH_PBM,
[
AC_MSG_CHECKING(for pbm)
AC_ARG_WITH(pbm,
[ --with-pbm use pbm, required to rebuild datasrc/title.c],
[
if test "x$withval" = xno; then
no_pbm=yes
fi
])
if test "x$no_pbm" = x; then
PE_PATH_PBM_INCLUDES
PE_PATH_PBM_LIBRARIES
if test "$pe_cv_pbm_includes" != no && \
test "$pe_cv_pbm_libraries" != no; then
AC_MSG_RESULT(
[headers $pe_cv_pbm_includes, libraries $pe_cv_pbm_libraries])
if test "$pe_cv_pbm_includes" != NONE; then
PBM_CFLAGS="-I$pe_cv_pbm_includes"
fi
if test "$pe_cv_pbm_libraries" != NONE; then
PBM_LIBS="-L$pe_cv_pbm_libraries"
fi
AC_SUBST(PBM_CFLAGS)
AC_SUBST(PBM_LIBS)
else
AC_MSG_RESULT(no)
no_pbm=yes
fi
else
AC_MSG_RESULT(disabled)
fi
])
AC_DEFUN(PE_FUNC_PRINTF_RETURN,
[
AC_MSG_CHECKING(return value of printf)
AC_CACHE_VAL(pe_cv_func_printf_return,
AC_TRY_RUN([
#include <stdio.h>
void main()
{
FILE *f;
int return_val;
f=fopen("conftest.prf", "w");
if(f == NULL)
exit(2);
return_val = fprintf(f, "p");
fclose(f);
if(return_val==1)
exit(0);
exit(1);
}
],
pe_cv_func_printf_return=POSIX,
pe_cv_func_printf_return=try_bsd,
pe_cv_func_printf_return=unknown)
if test "x$pe_cv_func_printf_return" = xtry_bsd; then
AC_TRY_RUN([
#include <stdio.h>
void main()
{
FILE *f;
int return_val;
f=fopen("conftest.prf", "w");
if(f == NULL)
exit(2);
return_val = fprintf(f, "p");
fclose(f);
exit(!!return_val);
}
],
pe_cv_func_printf_return=BSD,
pe_cv_func_printf_return=none,
pe_cv_func_printf_return=unknown)
fi)
AC_MSG_RESULT($pe_cv_func_printf_return)
case "$pe_cv_func_printf_return" in
BSD)
AC_DEFINE(PRINTF_RETURN, 0);;
POSIX)
AC_DEFINE(PRINTF_RETURN, 1);;
*)
AC_DEFINE(PRINTF_RETURN, -1);;
esac
])
AC_DEFUN(PE_LINUX_SOUND,
[
AC_CHECK_HEADERS(linux/soundcard.h, [
linux_sound=yes
AC_DEFINE(HAVE_LINUX_SOUND)
sound=yes
AC_DEFINE(HAVE_SOUND)
])
])
AC_DEFUN(PE_SUN_SOUND,
[
AC_CHECK_HEADERS(sys/audioio.h, sun_sound=yes)
if test "x$sun_sound" != xyes; then
AC_CHECK_HEADERS(sun/audioio.h, sun_sound=yes)
fi
if test "x$sun_sound" = xyes; then
AC_MSG_CHECKING(for linear sound encoding)
AC_CACHE_VAL(pe_cv_sun_linear_sound_encoding,
AC_EGREP_CPP(Have_audio_encoding_linear, [
#if defined(HAVE_SYS_AUDIOIO_H)
#include <sys/audioio.h>
#elif defined(HAVE_SUN_AUDIOIO_H)
#include <sun/audioio.h>
#endif
#ifdef AUDIO_ENCODING_LINEAR
Have_audio_encoding_linear
#endif ],
pe_cv_sun_linear_sound_encoding=yes,
pe_cv_sun_linear_sound_encoding=no))
AC_MSG_RESULT($pe_cv_sun_linear_sound_encoding)
if test "x$pe_cv_sun_linear_sound_encoding" = xyes; then
AC_DEFINE(HAVE_16BIT_SOUND)
AC_DEFINE(HAVE_SUN_SOUND)
sound=yes
AC_DEFINE(HAVE_SOUND)
else
sun_sound=
fi
fi
if test "x$sun_sound" = xyes; then
AC_MSG_CHECKING(for speaker)
AC_CACHE_VAL(pe_cv_sun_speaker,
AC_EGREP_CPP(Have_audio_speaker, [
#if defined(HAVE_SYS_AUDIOIO_H)
#include <sys/audioio.h>
#elif defined(HAVE_SUN_AUDIOIO_H)
#include <sun/audioio.h>
#endif
#ifdef AUDIO_SPEAKER
Have_audio_speaker
#endif ],
pe_cv_sun_speaker=yes,
pe_cv_sun_speaker=no))
AC_MSG_RESULT($pe_cv_sun_speaker)
if test "x$pe_cv_sun_speaker" = xyes; then
AC_DEFINE(HAVE_SUN_SPEAKER)
fi
AC_MSG_CHECKING(for headphone)
AC_CACHE_VAL(pe_cv_sun_headphone,
AC_EGREP_CPP(Have_audio_headphone, [
#if defined(HAVE_SYS_AUDIOIO_H)
#include <sys/audioio.h>
#elif defined(HAVE_SUN_AUDIOIO_H)
#include <sun/audioio.h>
#endif
#ifdef AUDIO_HEADPHONE
Have_audio_headphone
#endif ],
pe_cv_sun_headphone=yes,
pe_cv_sun_headphone=no))
AC_MSG_RESULT($pe_cv_sun_headphone)
if test "x$pe_cv_sun_headphone" = xyes; then
AC_DEFINE(HAVE_SUN_HEADPHONE)
fi
AC_MSG_CHECKING(for line out)
AC_CACHE_VAL(pe_cv_sun_line_out,
AC_EGREP_CPP(Have_audio_line_out, [
#if defined(HAVE_SYS_AUDIOIO_H)
#include <sys/audioio.h>
#elif defined(HAVE_SUN_AUDIOIO_H)
#include <sun/audioio.h>
#endif
#ifdef AUDIO_LINE_OUT
Have_audio_line_out
#endif ],
pe_cv_sun_line_out=yes,
pe_cv_sun_line_out=no))
AC_MSG_RESULT($pe_cv_sun_line_out)
if test "x$pe_cv_sun_line_out" = xyes; then
AC_DEFINE(HAVE_SUN_LINE_OUT)
fi
fi
])
AC_DEFUN(PE_HP_SOUND,
[
AC_CHECK_HEADERS(sys/audio.h, hp_sound=yes)
if test "x$hp_sound" = xyes; then
AC_MSG_CHECKING(for linear sound encoding)
AC_CACHE_VAL(pe_cv_hp_linear_sound_encoding,
AC_EGREP_CPP(Have_audio_encoding_linear, [
#include <sys/audio.h>
#ifdef AUDIO_FORMAT_LINEAR16BIT
Have_audio_encoding_linear
#endif ],
pe_cv_hp_linear_sound_encoding=yes,
pe_cv_hp_linear_sound_encoding=no))
AC_MSG_RESULT($pe_cv_hp_linear_sound_encoding)
if test "x$pe_cv_hp_linear_sound_encoding" = xyes; then
AC_DEFINE(HAVE_16BIT_SOUND)
AC_DEFINE(HAVE_HP_SOUND)
sound=yes
AC_DEFINE(HAVE_SOUND)
else
hp_sound=
fi
fi
if test "x$hp_sound" = xyes; then
AC_MSG_CHECKING(for internal_speaker)
AC_CACHE_VAL(pe_cv_hp_internal_speaker,
AC_EGREP_CPP(Have_audio_internal_speaker, [
#include <sys/audio.h>
#ifdef AUDIO_OUT_INTERNAL
Have_audio_internal_speaker
#endif ],
pe_cv_hp_internal_speaker=yes,
pe_cv_hp_internal_speaker=no))
AC_MSG_RESULT($pe_cv_hp_internal_speaker)
if test "x$pe_cv_hp_internal_speaker" = xyes; then
AC_DEFINE(HAVE_HP_INTERNAL_SPEAKER)
fi
AC_MSG_CHECKING(for external speaker)
AC_CACHE_VAL(pe_cv_hp_external_speaker,
AC_EGREP_CPP(Have_audio_external_speaker, [
#include <sys/audio.h>
#ifdef AUDIO_OUT_EXTERNAL
Have_audio_external_speaker
#endif ],
pe_cv_hp_external_speaker=yes,
pe_cv_hp_external_speaker=no))
AC_MSG_RESULT($pe_cv_hp_external_speaker)
if test "x$pe_cv_hp_external_speaker" = xyes; then
AC_DEFINE(HAVE_HP_EXTERNAL_SPEAKER)
fi
AC_MSG_CHECKING(for line out)
AC_CACHE_VAL(pe_cv_hp_line_out,
AC_EGREP_CPP(Have_audio_line_out, [
#include <sys/audio.h>
#ifdef AUDIO_OUT_LINE
Have_audio_line_out
#endif ],
pe_cv_hp_line_out=yes,
pe_cv_hp_line_out=no))
AC_MSG_RESULT($pe_cv_hp_line_out)
if test "x$pe_cv_hp_line_out" = xyes; then
AC_DEFINE(HAVE_HP_LINE_OUT)
fi
fi
])
AC_INIT(thrust.pod.in)
version_nr=0.89
version=${version_nr}c
config_args=["$0 $@"]
AC_CONFIG_HEADER(src/config.h)
AC_CANONICAL_HOST
dnl Alternative programs
AC_PROG_CC
cflags=
optimize=
if test "x$GCC" = xyes; then
cflags="$cflags -Wall -Wstrict-prototypes -Wmissing-prototypes"
optimize="$optimize -fomit-frame-pointer -O9 -s"
else
case "$host" in
*hpux*)
cflags="$cflags -Ae"
optimize="$optimize +O4"
;;
esac
fi
case "$host" in
*-osf*)
AC_DEFINE(_POSIX_C_SOURCE)
AC_DEFINE(_XOPEN_SOURCE)
;;
esac
AC_PROG_INSTALL
AC_C_CONST
AC_C_INLINE
AC_PATH_PROG(pod2man, pod2man)
dnl Libraries
dnl Library Functions
AC_CHECK_FUNCS(atexit on_exit)
PE_FUNC_PRINTF_RETURN
dnl Header Files
dnl AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h getopt.h values.h)
pe_sound=yes
AC_ARG_ENABLE(sound,
[ --enable-sound try to include sound],
[
if test "x$enableval" = xno; then
pe_sound=no
fi
])
if test "x$pe_sound" = xyes; then
case "$host" in
*linux*)
PE_LINUX_SOUND
;;
*sun*)
PE_SUN_SOUND
;;
*hpux*)
PE_HP_SOUND
;;
esac
fi
AC_CHECK_FUNCS(getopt_long_only, , LIBOBJS="$LIBOBJS getopt.o getopt1.o")
AC_CHECK_FUNCS(random)
AC_REPLACE_FUNCS(usleep strdup)
dnl Structures
AC_TYPE_SIGNAL
dnl Typedefs
dnl System Services
AC_PATH_X
AC_PATH_XTRA
AC_CHECK_LIB(Xext, XShmPutImage, AC_DEFINE(HAVE_XSHMPUTIMAGE), ,
$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lX11)
PE_PATH_SVGA
if test "x$no_svga" = x; then
PE_HEADER_VGAKEYBOARD_DEFINE_P
if test "x$no_svga" != x; then
AC_MSG_WARN([SVGAlib disabled, could not find "vgakeyboard.h"])
else
PE_HEADER_VGA_HAS_VGA_GETMODENUMBER
fi
fi
PE_PATH_PBM
dnl UNIX Variants
dnl Output
if test "x$no_svga" = xyes && test "x$no_x" = xyes; then
AC_MSG_WARN([Either X or SVGAlib found. Impossible to build game.])
fi
AC_SUBST(version)
AC_SUBST(version_nr)
AC_SUBST(cflags)
AC_SUBST(optimize)
AC_SUBST(config_args)
AC_SUBST(no_pbm)
AC_SUBST(no_svga)
AC_SUBST(no_x)
AC_SUBST(sound)
AC_OUTPUT(Makefile thrust-${version}.lsm:thrust.lsm Makefile.bindist thrust.pod)
|