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 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367
|
AC_DEFUN([KSW_IS_PROFILE],
[
AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(for profile)
AC_ARG_ENABLE([profile],
[ --enable-profile=yes/no/core Specify "yes" or "core" to enable profiling.])
is_profile=no
PROFILE=
CORE_PROFILE=
if test x"$enable_profile" = xyes; then
PROFILE=-pg
CORE_PROFILE=-pg
is_profile=yes
elif test x"$enable_profile" = xcore; then
CORE_PROFILE=-pg
is_profile="yes (core)"
fi
AC_DEFINE( [PROFILE], [], [Define to include profilling information] )
AC_DEFINE( [CORE_PROFILE], [], [Define to include core profilling information] )
AC_MSG_RESULT($is_profile)
])
AC_DEFUN([KSW_IS_DEBUG],
[
AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(for debug)
AC_ARG_ENABLE([debug],
[ --enable-debug=yes/no/cov Specify "yes" to enable a debug build.])
is_debug=no
enable_debug_save_COVFLAGS="${COVFLAGS}"
enable_debug_save_COVLFLAGS="${COVLFLAGS}"
enable_debug_save_CFLAGS="${CFLAGS}"
enable_debug_save_CXXFLAGS="${CXXFLAGS}"
enable_debug_save_LDFLAGS="${LDFLAGS}"
if test x"$enable_debug" = xyes; then
COVFLAGS=""
COVLFLAGS=""
CFLAGS="-g"
CXXFLAGS="${CFLAGS}"
LDFLAGS=""
elif test x"$enable_debug" = xcov; then
COVFLAGS="-coverage"
COVLFLAGS="-lgcov"
CFLAGS="-g"
CXXFLAGS="${CFLAGS}"
LDFLAGS=""
is_debug=coverage
else
omit_frame=
if test x"${CORE_PROFILE}" = "x"; then
omit_frame="-fomit-frame-pointer"
fi
COVFLAGS=""
COVLFLAGS=""
CFLAGS="-O2 ${omit_frame} -fno-math-errno"
CXXFLAGS="${CFLAGS}"
LDFLAGS="${omit_frame} -fno-math-errno"
fi
AC_TRY_LINK([#include <stdio.h>], , [
dnl Yay!
if test x"$enable_debug" = xyes; then
AC_DEFINE( [CODE_DEBUG], [], [Define to include debugging information] )
is_debug=yes
fi
], [
dnl Boo!
if test x"$enable_debug" != xyes; then
COVFLAGS="${enable_debug_save_COVFLAGS}"
COVLFLAGS="${enable_debug_save_COVLFLAGS}"
CFLAGS="${enable_debug_save_CFLAGS}"
CXXFLAGS="${enable_debug_save_CXXFLAGS}"
LDFLAGS="${enable_debug_save_LDFLAGS}"
AC_DEFINE( [CODE_DEBUG], [], [Define to include debugging information] )
is_debug=yes
else
COVFLAGS="${enable_debug_save_COVFLAGS}"
COVLFLAGS="${enable_debug_save_COVLFLAGS}"
CFLAGS="${enable_debug_save_CFLAGS}"
CXXFLAGS="${enable_debug_save_CXXFLAGS}"
LDFLAGS="${enable_debug_save_LDFLAGS}"
fi
])
AC_MSG_RESULT($is_debug)
])
dnl for lua (KSW was here)
AC_DEFUN([KSW_HAVE_LUA],
[
AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(for lua)
AC_ARG_WITH([lua-dir],
[ --with-lua-dir=DIR DIR is equal to the install prefix of Lua.
Header files are in DIR/include, and Library
files are in DIR/lib])
AC_ARG_WITH([lua-include-dir],
[ --with-lua-include-dir=DIR
Lua header files are in DIR])
AC_ARG_WITH([lua-lib-dir],
[ --with-lua-lib-dir=DIR Lua libraries are in DIR])
AC_ARG_WITH([lua-lib],
[ --with-lua-lib=LIB Use -lLIB to link with the lua library])
if test x"$with_lua_dir" = x &&
test x"$with_lua_include_dir" = x &&
test x"$with_lua_lib_dir" = x &&
test x"$with_lua_lib" = x; then
# user did not request Lua support, disable it
have_lua="disabled"
else
# "yes" is a bogus option
if test x"$with_lua_dir" = xyes; then
with_lua_dir=
fi
if test x"$with_lua_include_dir" = xyes; then
with_lua_include_dir=
fi
if test x"$with_lua_lib_dir" = xyes; then
with_lua_lib_dir=
fi
if test x"$with_lua_lib" = xyes; then
with_lua_lib=
fi
# No lua unless we discover otherwise
have_lua=no
# Check whether we are requested to link with a specific version
if test x"$with_lua_lib" != x; then
ksw_lua_lib="$with_lua_lib"
fi
# Check whether we were supplied with an answer already
if test x"$with_lua_dir" != x; then
have_lua=yes
ksw_lua_dir="$with_lua_dir"
ksw_lua_include_dir="$with_lua_dir/include"
if test -d "$with_lua_dir/lib64" ; then
ksw_lua_lib_dir="$with_lua_dir/lib64"
else
ksw_lua_lib_dir="$with_lua_dir/lib"
fi
# Only search for the lib if the user did not define one already
if test x"$ksw_lua_lib" = x; then
ksw_lua_lib="`ls $ksw_lua_lib_dir/liblua5* 2> /dev/null | sed -n 1p |
sed s@$ksw_lua_lib_dir/lib@@ | [sed s@[.].*@@]`"
fi
if test x"$ksw_lua_lib" = x; then
ksw_lua_lib="`ls $ksw_lua_lib_dir/liblua.* 2> /dev/null | sed -n 1p |
sed s@$ksw_lua_lib_dir/lib@@ | [sed s@[.].*@@]`"
fi
ksw_lua_LIBS="-L$ksw_lua_lib_dir -l$ksw_lua_lib -lm -ldl"
else
# Use cached value or do search, starting with suggestions from
# the command line
AC_CACHE_VAL(ksw_cv_have_lua,
[
# We are not given a solution and there is no cached value.
ksw_lua_dir=
if test x"$ksw_lua_include_dir" = x; then
ksw_lua_include_dir="`ls -dr /usr/include/lua.h /usr/local/include/lua.h /usr/include/lua*/lua.h /usr/local/include/lua*/lua.h 2> /dev/null | sed -n 1p |
sed s@/lua.h@@`"
fi
if test x"$ksw_lua_lib" = x; then
ksw_lua_lib_dir="`ls -dr /usr/lib64/liblua5* /usr/lib64/liblua.* /usr/local/lib64/liblua5* /usr/local/lib64/liblua.* /usr/lib/liblua5* /usr/lib/liblua.* /usr/local/lib/liblua5* /usr/local/lib/liblua.* 2> /dev/null | sed -n 1p`"
ksw_lua_lib="`echo $ksw_lua_lib_dir | sed 's@/.*/@@' `"
ksw_lua_lib_dir="`echo $ksw_lua_lib_dir | sed s@/$ksw_lua_lib@@ `"
ksw_lua_lib="`echo $ksw_lua_lib | [sed s@[.].*@@] | sed s@^lib@@ `"
fi
if test x"$ksw_lua_lib" != x; then
if test x"$ksw_lua_lib_dir" = x; then
ksw_lua_LIBS="-l$ksw_lua_lib -lm -ldl"
else
ksw_lua_LIBS="-L$ksw_lua_lib_dir -l$ksw_lua_lib -lm -ldl"
fi
# Record where we found lua for the cache.
ksw_cv_have_lua="have_lua=yes \
ksw_lua_dir=$ksw_lua_dir \
ksw_lua_include_dir=$ksw_lua_include_dir \
ksw_lua_LIBS=\"$ksw_lua_LIBS\""
fi
])dnl
eval "$ksw_cv_have_lua"
fi # all $ksw_lua_* are set
fi # $have_lua reflects the system status
if test x"$have_lua" = xyes; then
LUA_CCFLAGS="-I$ksw_lua_include_dir"
LUA_DIR="$ksw_lua_dir"
LUA_LIBS="$ksw_lua_LIBS"
# All variables are defined, report the result
AC_DEFINE( [HAVE_LUA], [], [Define when you have Lua installed] )
AC_MSG_RESULT([$have_lua:
LUA_CCFLAGS=$LUA_CCFLAGS
LUA_DIR=$LUA_DIR
LUA_LIBS=$LUA_LIBS ])
else
# lua was not found
LUA_CCFLAGS=
LUA_DIR=
LUA_LIBS=
AC_MSG_RESULT($have_lua)
fi
AC_SUBST(LUA_CCFLAGS)
AC_SUBST(LUA_DIR)
AC_SUBST(LUA_LIBS)
#### Being paranoid:
if test x"$have_lua" = xyes; then
AC_MSG_CHECKING(correct functioning of lua installation)
AC_CACHE_VAL(ksw_cv_lua_test_result,
[
cat > ksw_lua_test.h << EOF
EOF
cat > ksw_lua_test.c << EOF
#include "ksw_lua_test.h"
#include <lua.h>
#include <lauxlib.h>
//#include <lualib.h>
int main( int argc, char **argv )
{
lua_State * L = lua_open();
//luaopen_math( L );
lua_close( L );
return( 0 );
}
EOF
ksw_cv_lua_test_result="failure"
ksw_try_1="$CC $LUA_CCFLAGS $LUA_LIBS -o ksw_lua_test ksw_lua_test.c >/dev/null 2>ksw_lua_test_1.out"
AC_TRY_EVAL(ksw_try_1)
ksw_err_1=`grep -v '^ *+' ksw_lua_test_1.out | grep -v "^ksw_lua_test.{$ac_ext}\$"`
if test x"$ksw_err_1" != x; then
echo "$ksw_err_1" >&AC_FD_CC
echo "configure: could not compile:" >&AC_FD_CC
cat ksw_lua_test.c >&AC_FD_CC
else
ksw_cv_lua_test_result="success"
fi
fi
])dnl AC_CACHE_VAL ksw_cv_lua_test_result
AC_MSG_RESULT([$ksw_cv_lua_test_result]);
if test x"$ksw_cv_lua_test_result" = "xfailure"; then
AC_MSG_ERROR([Failed to find matching components of a complete
lua installation. Try using more options,
see ./configure --help.])
fi
rm -f ksw_lua_test.h \
ksw_lua_test.c ksw_lua_test.o ksw_lua_test \
ksw_lua_test_1.out
])
dnl for lualib (KSW was here)
AC_DEFUN([KSW_HAVE_LUALIB],
[
if test x"${LUA_LIBS}" != x; then
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([KSW_HAVE_LUA])
AC_MSG_CHECKING(for lualib)
AC_ARG_WITH([lualib-dir],
[ --with-lualib-dir=DIR DIR is equal to the install prefix of Lualib.
Header files are in DIR/include, and Library
files are in DIR/lib])
AC_ARG_WITH([lualib-include-dir],
[ --with-lualib-include-dir=DIR
Lua header files are in DIR])
AC_ARG_WITH([lualib-lib-dir],
[ --with-lualib-lib-dir=DIR Lua libraries are in DIR])
AC_ARG_WITH([lualib-lib],
[ --with-lualib-lib=LIB Use -lLIB to link with the lualib library])
if test x"$with_lualib_dir" = x"no" ||
test x"$with_lualib_include_dir" = x"no" ||
test x"$with_lualib_lib_dir" = x"no" ||
test x"$with_lualib_lib" = x"no"; then
# user disabled lualib. Leave cache alone.
have_lualib="User disabled lualib."
else
# "yes" is a bogus option
if test x"$with_lualib_dir" = xyes; then
with_lualib_dir=
fi
if test x"$with_lualib_include_dir" = xyes; then
with_lualib_include_dir=
fi
if test x"$with_lualib_lib_dir" = xyes; then
with_lualib_lib_dir=
fi
if test x"$with_lualib_lib" = xyes; then
with_lualib_lib=
fi
# No lualib unless we discover otherwise
have_lualib=no
# Check whether we are requested to link with a specific version
if test x"$with_lualib_lib" != x; then
ksw_lualib_lib="$with_lualib_lib"
fi
# Check whether we were supplied with an answer already
if test x"$with_lualib_dir" != x; then
have_lualib=yes
ksw_lualib_dir="$with_lualib_dir"
ksw_lualib_include_dir="$with_lualib_dir/include"
if test -d "$with_lualib_dir/lib64" ; then
ksw_lualib_lib_dir="$with_lualib_dir/lib64"
else
ksw_lualib_lib_dir="$with_lualib_dir/lib"
fi
# Only search for the lib if the user did not define one already
if test x"$ksw_lualib_lib" = x; then
ksw_lualib_lib="`ls $ksw_lualib_lib_dir/liblualib5* 2> /dev/null | sed -n 1p |
sed s@$ksw_lualib_lib_dir/lib@@ | [sed s@[.].*@@]`"
fi
if test x"$ksw_lualib_lib" = x; then
ksw_lualib_lib="`ls $ksw_lualib_lib_dir/liblualib.* 2> /dev/null | sed -n 1p |
sed s@$ksw_lualib_lib_dir/lib@@ | [sed s@[.].*@@]`"
fi
ksw_lualib_LIBS="-L$ksw_lualib_lib_dir -l$ksw_lualib_lib"
else
# Use cached value or do search, starting with suggestions from
# the command line
AC_CACHE_VAL(ksw_cv_have_lualib,
[
# We are not given a solution and there is no cached value.
ksw_lualib_dir=
if test x"$ksw_lualib_include_dir" = x; then
ksw_lualib_include_dir="`ls -dr /usr/include/lualib.h /usr/local/include/lualib.h /usr/include/lua*/lualib.h /usr/local/include/lua*/lualib.h 2> /dev/null | sed -n 1p |
sed s@/lualib.h@@`"
fi
if test x"$ksw_lualib_lib" = x; then
ksw_lualib_lib_dir="`ls -dr /usr/lib64/liblualib5* /usr/lib64/liblualib.* /usr/local/lib64/liblualib5* /usr/local/lib64/liblualib.* /usr/lib/liblualib5* /usr/lib/liblualib.* /usr/local/lib/liblualib5* /usr/local/lib/liblualib.* 2> /dev/null | sed -n 1p`"
ksw_lualib_lib="`echo $ksw_lualib_lib_dir | sed 's@/.*/@@' `"
ksw_lualib_lib_dir="`echo $ksw_lualib_lib_dir | sed s@/$ksw_lualib_lib@@ `"
ksw_lualib_lib="`echo $ksw_lualib_lib | [sed s@[.].*@@] | sed s@^lib@@ `"
fi
if test x"$ksw_lualib_lib" != x; then
if test x"$ksw_lualib_lib_dir" = x; then
ksw_lualib_LIBS="-l$ksw_lualib_lib"
else
ksw_lualib_LIBS="-L$ksw_lualib_lib_dir -l$ksw_lualib_lib"
fi
# Record where we found lualib for the cache.
ksw_cv_have_lualib="have_lualib=yes \
ksw_lualib_dir=$ksw_lualib_dir \
ksw_lualib_include_dir=$ksw_lualib_include_dir \
ksw_lualib_LIBS=\"$ksw_lualib_LIBS\""
fi
])dnl
eval "$ksw_cv_have_lualib"
fi # all $ksw_lualib_* are set
fi # $have_lualib reflects the system status
if test x"$have_lualib" = xyes; then
LUALIB_CCFLAGS="-I$ksw_lualib_include_dir"
LUALIB_DIR="$ksw_lualib_dir"
LUALIB_LIBS="-lm -ldl $LUA_LIBS $ksw_lualib_LIBS"
# All variables are defined, report the result
AC_DEFINE( [HAVE_LUALIB], [], [Define when you have Lua libs installed] )
AC_MSG_RESULT([$have_lualib:
LUALIB_CCFLAGS=$LUALIB_CCFLAGS
LUALIB_DIR=$LUALIB_DIR
LUALIB_LIBS=$LUALIB_LIBS ])
else
# lualib was not found
LUALIB_CCFLAGS=
LUALIB_DIR=
LUALIB_LIBS=
AC_MSG_RESULT($have_lualib)
fi
AC_SUBST(LUALIB_CCFLAGS)
AC_SUBST(LUALIB_DIR)
AC_SUBST(LUALIB_LIBS)
#### Being paranoid:
if test x"$have_lualib" = xyes; then
AC_MSG_CHECKING(correct functioning of lualib installation)
AC_CACHE_VAL(ksw_cv_lualib_test_result,
[
cat > ksw_lualib_test.h << EOF
EOF
cat > ksw_lualib_test.c << EOF
#include "ksw_lualib_test.h"
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
int main( int argc, char **argv )
{
lua_State * L = lua_open();
luaopen_math( L );
lua_close( L );
return( 0 );
}
EOF
ksw_cv_lualib_test_result="failure"
ksw_try_1="$CC $LUALIB_CCFLAGS $LUALIB_LIBS -o ksw_lualib_test ksw_lualib_test.c >/dev/null 2>ksw_lualib_test_1.out"
AC_TRY_EVAL(ksw_try_1)
ksw_err_1=`grep -v '^ *+' ksw_lualib_test_1.out | grep -v "^ksw_lualib_test.{$ac_ext}\$"`
if test x"$ksw_err_1" != x; then
echo "$ksw_err_1" >&AC_FD_CC
echo "configure: could not compile:" >&AC_FD_CC
cat ksw_lualib_test.c >&AC_FD_CC
else
ksw_cv_lualib_test_result="success"
fi
fi
])dnl AC_CACHE_VAL ksw_cv_lualib_test_result
AC_MSG_RESULT([$ksw_cv_lualib_test_result]);
if test x"$ksw_cv_lualib_test_result" = "xfailure"; then
AC_MSG_ERROR([Failed to find matching components of a complete
lualib installation. Try using more options,
see ./configure --help.])
fi
rm -f ksw_lualib_test.h \
ksw_lualib_test.c ksw_lualib_test.o ksw_lualib_test \
ksw_lualib_test_1.out
fi
])
dnl for Qt (KSW was here)
AC_DEFUN([BNV_HAVE_QT],
[
dnl THANKS! This code includes bug fixes by:
dnl Tim McClarren.
AC_REQUIRE([AC_PROG_CXX])
AC_REQUIRE([AC_PATH_X])
AC_REQUIRE([AC_PATH_XTRA])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_MSG_CHECKING(for Qt)
dnl Recent QT4 doesn't need these anymore. -- garden@acheronte.it
dnl QT_XLIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
QT_XLIBS=""
if test x"$no_x" = xyes; then
QT_XLIBS=""
fi
dnl KSW hackish... requires another macro to set is_osx
if test x"$is_osx" = xyes; then
QT_XLIBS=""
fi
AC_ARG_WITH([Qt-dir],
[ --with-Qt-dir=DIR DIR is equal to \$QTDIR if you have followed the
installation instructions of Trolltech. Header
files are in DIR/include, binary utilities are
in DIR/bin and the library is in DIR/lib])
AC_ARG_WITH([Qt-include-dir],
[ --with-Qt-include-dir=DIR
Qt header files are in DIR])
AC_ARG_WITH([Qt-bin-dir],
[ --with-Qt-bin-dir=DIR Qt utilities such as moc and uic are in DIR])
AC_ARG_WITH([Qt-lib-dir],
[ --with-Qt-lib-dir=DIR The Qt library is in DIR])
dnl FIXME moc-qt4 and uic-qt4
bnv_is_qt4=no
bnv_qt4_libs="-lQtCore -lQtGui -lQtOpenGL -lQtNetwork"
if test x"$with_Qt_dir" = x"no" ||
test x"$with_Qt_include_dir" = x"no" ||
test x"$with_Qt_bin_dir" = x"no" ||
test x"$with_Qt_lib_dir" = x"no"; then
# user disabled Qt. Leave cache alone.
have_qt="User disabled Qt."
else
# "yes" is a bogus option
if test x"$with_Qt_dir" = xyes; then
with_Qt_dir=
fi
if test x"$with_Qt_include_dir" = xyes; then
with_Qt_include_dir=
fi
if test x"$with_Qt_bin_dir" = xyes; then
with_Qt_bin_dir=
fi
if test x"$with_Qt_lib_dir" = xyes; then
with_Qt_lib_dir=
fi
# No Qt unless we discover otherwise
have_qt=no
# Check whether we were supplied with an answer already
if test x"$with_Qt_dir" != x; then
have_qt=yes
bnv_qt_dir="$with_Qt_dir"
bnv_qt_include_dir="$with_Qt_dir/include"
bnv_qt_bin_dir="$with_Qt_dir/bin"
if test -d "$with_Qt_dir/lib64" ; then
bnv_qt_lib_dir="$with_Qt_dir/lib64"
else
bnv_qt_lib_dir="$with_Qt_dir/lib"
fi
bnv_qt_LIBS="-L$bnv_qt_lib_dir $bnv_qt4_libs $QT_XLIBS "
else
# Use cached value or do search, starting with suggestions from
# the command line
AC_CACHE_VAL(bnv_cv_have_qt,
[
# We are not given a solution and there is no cached value.
bnv_qt_dir=NO
bnv_qt_include_dir=NO
bnv_qt_lib_dir=NO
BNV_PATH_QT_DIRECT
if test "$bnv_qt_dir" = NO ||
test "$bnv_qt_include_dir" = NO ||
test "$bnv_qt_lib_dir" = NO; then
# Problem with finding complete Qt. Cache the known absence of Qt.
bnv_cv_have_qt="have_qt=no"
else
# Record where we found Qt for the cache.
bnv_cv_have_qt="have_qt=yes \
bnv_qt_dir=$bnv_qt_dir \
bnv_qt_include_dir=$bnv_qt_include_dir \
bnv_qt_bin_dir=$bnv_qt_bin_dir \
bnv_is_qt4=$bnv_is_qt4 \
bnv_qt_LIBS=\"$bnv_qt_LIBS\""
fi
])dnl
eval "$bnv_cv_have_qt"
fi # all $bnv_qt_* are set
fi # $have_qt reflects the system status
if test x"$have_qt" = xyes; then
QT_CXXFLAGS="-I$bnv_qt_include_dir"
QT_DIR="$bnv_qt_dir"
QT_LIBS="$bnv_qt_LIBS"
if test x"$bnv_qt_bin_dir" != x; then
# We were told where to look for the utilities?
# UIC detection
if test -x "$bnv_qt_bin_dir/uic-qt4"; then
QT_UIC="$bnv_qt_bin_dir/uic-qt4"
elif test -x "$bnv_qt_bin_dir/qt4-uic"; then
QT_UIC="$bnv_qt_bin_dir/qt4-uic"
elif test -x "$bnv_qt_bin_dir/uic"; then
QT_UIC="$bnv_qt_bin_dir/uic"
fi
# MOC detection
if test -x "$bnv_qt_bin_dir/moc-qt4"; then
QT_MOC="$bnv_qt_bin_dir/moc-qt4"
elif test -x "$bnv_qt_bin_dir/qt4-moc"; then
QT_MOC="$bnv_qt_bin_dir/qt4-moc"
elif test -x "$bnv_qt_bin_dir/moc"; then
QT_MOC="$bnv_qt_bin_dir/moc"
fi
# LRELEASE detection
if test -x "$bnv_qt_bin_dir/lrelease-qt4"; then
QT_LRELEASE="$bnv_qt_bin_dir/lrelease-qt4"
elif test -x "$bnv_qt_bin_dir/qt4-lrelease"; then
QT_LRELEASE="$bnv_qt_bin_dir/qt4-lrelease"
elif test -x "$bnv_qt_bin_dir/lrelease"; then
QT_LRELEASE="$bnv_qt_bin_dir/lrelease"
fi
elif test x"$bnv_qt_dir" != x; then
# If bnv_qt_dir is defined, utilities are expected to be in the
# bin subdirectory
# UIC detection
if test -x "$bnv_qt_dir/bin/uic-qt4"; then
QT_UIC="$bnv_qt_dir/bin/uic-qt4"
elif test -x "$bnv_qt_dir/bin/qt4-uic"; then
QT_UIC="$bnv_qt_dir/bin/qt4-uic"
elif test -x "$bnv_qt_dir/bin/uic"; then
QT_UIC="$bnv_qt_dir/bin/uic"
fi
# MOC detection
if test -x "$bnv_qt_dir/bin/moc-qt4"; then
QT_MOC="$bnv_qt_dir/bin/moc-qt4"
elif test -x "$bnv_qt_dir/bin/qt4-moc"; then
QT_MOC="$bnv_qt_dir/bin/qt4-moc"
elif test -x "$bnv_qt_dir/bin/moc"; then
QT_MOC="$bnv_qt_dir/bin/moc"
fi
# LRELEASE detection
if test -x "$bnv_qt_dir/bin/lrelease-qt4"; then
QT_LRELEASE="$bnv_qt_dir/bin/lrelease-qt4"
elif test -x "$bnv_qt_dir/bin/qt4-lrelease"; then
QT_LRELEASE="$bnv_qt_dir/bin/qt4-lrelease"
elif test -x "$bnv_qt_dir/bin/lrelease"; then
QT_LRELEASE="$bnv_qt_dir/bin/lrelease"
fi
fi
# If binaries are still not set, try $PATH
if test x"$QT_UIC" = x; then
# UIC detection
if test `which uic-qt4 2> /dev/null`; then
QT_UIC=`which uic-qt4`
elif test `which qt4-uic 2> /dev/null`; then
QT_UIC=`which qt4-uic`
elif test `which uic 2> /dev/null`; then
QT_UIC=`which uic`
fi
fi
if test x"$QT_MOC" = x; then
# MOC detection
if test `which moc-qt4 2> /dev/null`; then
QT_MOC=`which moc-qt4`
elif test `which qt4-moc 2> /dev/null`; then
QT_MOC=`which qt4-moc`
elif test `which moc 2> /dev/null`; then
QT_MOC=`which moc`
fi
fi
if test x"$QT_LRELEASE" = x; then
# LRELEASE detection
if test `which lrelease-qt4 2> /dev/null`; then
QT_LRELEASE=`which lrelease-qt4`
elif test `which qt4-lrelease 2> /dev/null`; then
QT_LRELEASE=`which qt4-lrelease`
elif test `which lrelease 2> /dev/null`; then
QT_LRELEASE=`which lrelease`
fi
fi
# All variables are defined, report the result
AC_MSG_RESULT([$have_qt:
QT_CXXFLAGS=$QT_CXXFLAGS
QT_DIR=$QT_DIR
QT_LIBS=$QT_LIBS
QT_UIC=$QT_UIC
QT_MOC=$QT_MOC
QT_LRELEASE=$QT_LRELEASE])
else
# Qt was not found
QT_CXXFLAGS=
QT_DIR=
QT_LIBS=
QT_UIC=
QT_MOC=
QT_LRELEASE=
AC_MSG_RESULT($have_qt)
fi
if test x"$bnv_is_qt4" = xyes; then
HAVE_QT4=1
AC_SUBST(HAVE_QT4)
AC_DEFINE( [HAVE_QT4], [], [Define when you have QT4 installed] )
fi
AC_SUBST(QT_CXXFLAGS)
AC_SUBST(QT_DIR)
AC_SUBST(QT_LIBS)
AC_SUBST(QT_UIC)
AC_SUBST(QT_MOC)
AC_SUBST(QT_LRELEASE)
#### Being paranoid:
if test x"$have_qt" = xyes; then
AC_MSG_CHECKING(correct functioning of Qt installation)
AC_CACHE_VAL(bnv_cv_qt_test_result,
[
cat > bnv_qt_test.h << EOF
#include <QtCore/QObject>
class Test : public QObject
{
Q_OBJECT
public:
Test() {}
~Test() {}
public slots:
void receive() {}
signals:
void send();
};
EOF
cat > bnv_qt_main.$ac_ext << EOF
#include "bnv_qt_test.h"
#include <QtGui/QApplication>
int main( int argc, char **argv )
{
QApplication app( argc, argv );
Test t;
QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) );
}
EOF
bnv_cv_qt_test_result="failure"
bnv_try_1="$QT_MOC bnv_qt_test.h -o moc_bnv_qt_test.$ac_ext >/dev/null 2>bnv_qt_test_1.out"
AC_TRY_EVAL(bnv_try_1)
bnv_err_1=`grep -v '^ *+' bnv_qt_test_1.out | grep -v "^bnv_qt_test.h\$"`
if test x"$bnv_err_1" != x; then
echo "$bnv_err_1" >&AC_FD_CC
echo "configure: could not run $QT_MOC on:" >&AC_FD_CC
cat bnv_qt_test.h >&AC_FD_CC
else
bnv_try_2="$CXX $QT_CXXFLAGS -c $CXXFLAGS -Wno-non-virtual-dtor -o moc_bnv_qt_test.o moc_bnv_qt_test.$ac_ext >/dev/null 2>bnv_qt_test_2.out"
AC_TRY_EVAL(bnv_try_2)
bnv_err_2=`grep -v '^ *+' bnv_qt_test_2.out | grep -v "^bnv_qt_test.{$ac_ext}\$"`
if test x"$bnv_err_2" != x; then
echo "$bnv_err_2" >&AC_FD_CC
echo "configure: could not compile:" >&AC_FD_CC
cat bnv_qt_test.$ac_ext >&AC_FD_CC
else
bnv_try_3="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o bnv_qt_main.o bnv_qt_main.$ac_ext >/dev/null 2>bnv_qt_test_3.out"
AC_TRY_EVAL(bnv_try_3)
bnv_err_3=`grep -v '^ *+' bnv_qt_test_3.out | grep -v "^bnv_qt_main.{$ac_ext}\$"`
if test x"$bnv_err_3" != x; then
echo "$bnv_err_3" >&AC_FD_CC
echo "configure: could not compile:" >&AC_FD_CC
cat bnv_qt_main.$ac_ext >&AC_FD_CC
else
bnv_try_4="$CXX $QT_LIBS $LIBS -o bnv_qt_main bnv_qt_main.o moc_bnv_qt_test.o >/dev/null 2>bnv_qt_test_4.out"
AC_TRY_EVAL(bnv_try_4)
bnv_err_4=`grep -v '^ *+' bnv_qt_test_4.out`
if test x"$bnv_err_4" != x; then
echo "$bnv_err_4" >&AC_FD_CC
else
bnv_cv_qt_test_result="success"
fi
fi
fi
fi
])dnl AC_CACHE_VAL bnv_cv_qt_test_result
AC_MSG_RESULT([$bnv_cv_qt_test_result]);
if test x"$bnv_cv_qt_test_result" = "xfailure"; then
AC_MSG_ERROR([Failed to find matching components of a complete
Qt installation. Try using more options,
see ./configure --help.])
fi
rm -f bnv_qt_test.h moc_bnv_qt_test.$ac_ext moc_bnv_qt_test.o \
bnv_qt_main.$ac_ext bnv_qt_main.o bnv_qt_main \
bnv_qt_test_1.out bnv_qt_test_2.out bnv_qt_test_3.out bnv_qt_test_4.out
fi
AC_LANG_RESTORE
])
dnl Internal subroutine of BNV_HAVE_QT
dnl Set bnv_qt_dir bnv_qt_include_dir bnv_qt_bin_dir bnv_qt_lib_dir
dnl Copyright 2001 Bastiaan N. Veelo <Bastiaan.N.Veelo@immtek.ntnu.no>
AC_DEFUN([BNV_PATH_QT_DIRECT],
[
## Binary utilities ##
if test x"$with_Qt_bin_dir" != x; then
bnv_qt_bin_dir=$with_Qt_bin_dir
fi
## Look for header files ##
if test x"$with_Qt_include_dir" != x; then
bnv_qt_include_dir="$with_Qt_include_dir"
else
# The following header file is expected to define QT_VERSION.
# Look for the header file in a standard set of common directories.
qt_direct_test_header=qglobal.h
bnv_include_path_list="
/usr/include
`ls -dr /usr/include/qt* 2>/dev/null`
`ls -dr /usr/lib/qt*/include 2>/dev/null`
`ls -dr /usr/local/qt*/include 2>/dev/null`
`ls -dr /opt/sfw/include 2>/dev/null`
`ls -dr /opt/qt*/include 2>/dev/null`
`ls -dr /usr/qt*/include 2>/dev/null`
`ls -dr /usr/qt/*/include 2>/dev/null`
`ls -dr /usr/include/qt/* 2>/dev/null`
"
for bnv_dir in $bnv_include_path_list; do
if test -r "$bnv_dir/Qt/$qt_direct_test_header"; then
bnv_dirs="$bnv_dirs $bnv_dir"
fi
done
# Now look for the newest in this list
bnv_prev_ver=0
for bnv_dir in $bnv_dirs; do
if test -r "$bnv_dir/Qt/$qt_direct_test_header"; then
bnv_this_ver=`egrep -w '#define QT_VERSION' $bnv_dir/Qt/$qt_direct_test_header | sed s/'#define QT_VERSION'//`
if expr $bnv_this_ver '>' $bnv_prev_ver > /dev/null; then
bnv_is_qt4=yes
bnv_qt_include_dir=$bnv_dir
bnv_prev_ver=$bnv_this_ver
fi
fi
done
fi dnl Found header files.
# Are these headers located in a traditional Trolltech installation?
# That would be $bnv_qt_include_dir stripped from its last element:
bnv_found_traditional=no
bnv_possible_qt_dir=`dirname $bnv_qt_include_dir`
if test -x $bnv_possible_qt_dir/bin/moc-qt4 &&
ls $bnv_possible_qt_dir/lib/libQtCore* 1> /dev/null 2> /dev/null; then
bnv_found_traditional=yes
elif test -x $bnv_possible_qt_dir/bin/moc &&
ls $bnv_possible_qt_dir/lib/libQtCore.* 1> /dev/null 2> /dev/null; then
bnv_found_traditional=yes
fi
if test x"$bnv_found_traditional" = xyes; then
# Then the rest is a piece of cake
bnv_qt_dir=$bnv_possible_qt_dir
bnv_qt_bin_dir="$bnv_qt_dir/bin"
if test -d "$bnv_qt_dir/lib64" ; then
bnv_qt_lib_dir="$bnv_qt_dir/lib64"
else
bnv_qt_lib_dir="$bnv_qt_dir/lib"
fi
bnv_qt_LIBS="-L$bnv_qt_lib_dir $bnv_qt4_libs $QT_XLIBS"
fi
if test $bnv_found_traditional = no; then
# There is no valid definition for $QTDIR as Trolltech likes to see it
bnv_qt_dir=
## Look for Qt library ##
if test x"$with_Qt_lib_dir" != x; then
bnv_qt_lib_dir="$with_Qt_lib_dir"
bnv_qt_LIBS="-L$bnv_qt_lib_dir $bnv_qt4_libs $QT_XLIBS"
else
# Normally, when there is no traditional Trolltech installation,
# the library is installed in a place where the linker finds it
# automatically.
qt_direct_test_header=qapplication.h
qt_direct_test_main="
int argc;
char ** argv;
QApplication app(argc,argv);
"
# See if we find the library without any special options.
# Don't add top $LIBS permanently yet
bnv_save_LIBS="$LIBS"
bnv_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="-I$bnv_qt_include_dir"
LIBS="$bnv_qt4_libs $QT_XLIBS"
bnv_qt_LIBS="$LIBS"
AC_TRY_LINK([#include <$qt_direct_test_header>],
$qt_direct_test_main,
[
# Succes.
# We can link with no special library directory.
bnv_qt_lib_dir=
], [
# That did not work. Maybe a library version I don't know about?
# Look for some Qt lib in a standard set of common directories.
bnv_dir_list="
`echo $bnv_qt_includes | sed ss/includess`
/lib
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/opt/lib64
/opt/lib
`ls -dr /usr/lib/qt* 2>/dev/null`
`ls -dr /usr/local/qt* 2>/dev/null`
`ls -dr /opt/qt* 2>/dev/null`
"
for bnv_dir in $bnv_dir_list; do
if ls $bnv_dir/libQtCore* > /dev/null 2> /dev/null ; then
bnv_qt_lib_dir="$bnv_dir"
break
fi
done
# Try with that one
LIBS="$bnv_qt4_libs $QT_XLIBS"
])
if test x"$bnv_qt_lib_dir" != x; then
bnv_qt_LIBS="-L$bnv_qt_lib_dir $LIBS"
else
bnv_qt_LIBS="$LIBS"
fi
LIBS="$bnv_save_LIBS"
CXXFLAGS="$bnv_save_CXXFLAGS"
fi dnl $with_Qt_lib_dir was not given
fi dnl Done setting up for non-traditional Trolltech installation
])
dnl for -lqglviewer (KSW was here)
AC_DEFUN([KSW_HAVE_QGL],
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([BNV_HAVE_QT])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_MSG_CHECKING(Qt OpenGL)
AC_CACHE_VAL(ksw_cv_qgl_test_result,
[
cat > ksw_qgl_test.${ac_ext} << EOF
#include <QtGui/QApplication>
#include <QtGui/QWidget>
#include <QtOpenGL/QGLWidget>
int main( int argc, char ** argv )
{
QApplication app( argc, argv );
QGLWidget w;
w.show();
return app.exec();
}
EOF
ksw_cv_qgl_test_result="failure"
ksw_try_1="$CXX $GL_CFLAGS $GL_LIBS $QT_CXXFLAGS $QT_LIBS -o ksw_qgl_test ksw_qgl_test.${ac_ext} >/dev/null 2>ksw_qgl_test_1.out"
AC_TRY_EVAL(ksw_try_1)
ksw_err_1=`grep -v '^ *+' ksw_qgl_test_1.out | grep -v "^ksw_qgl_test.{$ac_ext}\$"`
if test x"$ksw_err_1" != x; then
ksw_try_2="$CXX $GL_CFLAGS $GL_LIBS $QT_CXXFLAGS $QT_LIBS -lqglviewer -o ksw_qgl_test ksw_qgl_test.${ac_ext} >/dev/null 2>ksw_qgl_test_2.out"
AC_TRY_EVAL(ksw_try_2)
ksw_err_2=`grep -v '^ *+' ksw_qgl_test_2.out | grep -v "^ksw_qgl_test.{$ac_ext}\$"`
if test x"$ksw_err_2" != x; then
echo "$ksw_err_2" >&AC_FD_CC
echo "configure: could not compile:" >&AC_FD_CC
cat ksw_qgl_test.${ac_ext} >&AC_FD_CC
else
ksw_cv_qgl_test_result="success"
QGL_LIBS=-lqglviewer
fi
else
ksw_cv_qgl_test_result="success"
QGL_LIBS=
fi
])dnl AC_CACHE_VAL ksw_cv_qgl_test_result
AC_MSG_RESULT([$ksw_cv_qgl_test_result]);
if test x"$ksw_cv_qgl_test_result" = "xfailure"; then
AC_MSG_ERROR([Failed to link Qt with OpenGL support.])
fi
rm -f ksw_qgl_test.h \
ksw_qgl_test.${ac_ext} ksw_qgl_test.o ksw_qgl_test \
ksw_qgl_test_1.out ksw_qgl_test_2.out
AC_SUBST(QGL_LIBS)
AC_LANG_RESTORE
])
AC_DEFUN([MDL_HAVE_OPENGL],
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PATH_X])
AC_REQUIRE([AC_PATH_XTRA])
AC_CACHE_CHECK([for OpenGL], mdl_cv_have_OpenGL,
[
dnl Check for Mesa first, unless we were asked not to.
AC_ARG_WITH([--with-Mesa],
[Prefer the Mesa library over a vendors native OpenGL library (default=yes)],
with_Mesa_help_string)
AC_ARG_ENABLE(Mesa, $with_Mesa_help_string, use_Mesa=$enableval, use_Mesa=yes)
if test x"$use_Mesa" = xyes; then
GL_search_list="MesaGL GL"
GLU_search_list="MesaGLU GLU"
GLX_search_list="MesaGLX GLX"
else
GL_search_list="GL MesaGL"
GLU_search_list="GLU MesaGLU"
GLX_search_list="GLX MesaGLX"
fi
AC_LANG_SAVE
AC_LANG_C
if test x"$is_osx" = xyes; then
GL_CFLAGS="-framework OpenGL -framework AGL"
GL_LIBS="-framework OpenGL -framework AGL"
else
dnl If we are running under X11 then add in the appropriate libraries.
if test x"$no_x" != xyes; then
dnl Add everything we need to compile and link X programs to GL_X_CFLAGS
dnl and GL_X_LIBS.
GL_CFLAGS="$X_CFLAGS"
dnl Recent QT4 doesn't need these anymore. -- garden@acheronte.it
dnl GL_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
GL_X_LIBS=""
fi
fi
GL_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$GL_CFLAGS"
GL_save_LIBS="$LIBS"
LIBS="$GL_X_LIBS"
# Save the "AC_MSG_RESULT file descriptor" to FD 8.
exec 8>&AC_FD_MSG
# Temporarily turn off AC_MSG_RESULT so that the user gets pretty
# messages.
exec AC_FD_MSG>/dev/null
AC_SEARCH_LIBS(glAccum, $GL_search_list, have_GL=yes, have_GL=no)
AC_SEARCH_LIBS(gluBeginCurve, $GLU_search_list, have_GLU=yes, have_GLU=no)
AC_SEARCH_LIBS(glXChooseVisual, $GLX_search_list, have_GLX=yes, have_GLX=no)
AC_SEARCH_LIBS(glutInit, glut, have_glut=yes, have_glut=no)
# Restore pretty messages.
exec AC_FD_MSG>&8
if test -n "$LIBS"; then
mdl_cv_have_OpenGL=yes
GL_LIBS="$LIBS"
AC_SUBST(GL_CFLAGS)
AC_SUBST(GL_LIBS)
else
mdl_cv_have_OpenGL=no
GL_CFLAGS=
fi
dnl Reset GL_X_LIBS regardless, since it was just a temporary variable
dnl and we don't want to be global namespace polluters.
GL_X_LIBS=
LIBS="$GL_save_LIBS"
CPPFLAGS="$GL_save_CPPFLAGS"
AC_LANG_RESTORE
dnl bugfix: dont forget to cache this variables, too
mdl_cv_GL_CFLAGS="$GL_CFLAGS"
mdl_cv_GL_LIBS="$GL_LIBS"
mdl_cv_have_GL="$have_GL"
mdl_cv_have_GLU="$have_GLU"
mdl_cv_have_GLX="$have_GLX"
mdl_cv_have_glut="$have_glut"
])
GL_CFLAGS="$mdl_cv_GL_CFLAGS"
GL_LIBS="$mdl_cv_GL_LIBS"
have_GL="$mdl_cv_have_GL"
have_GLU="$mdl_cv_have_GLU"
have_GLX="$mdl_cv_have_GLX"
have_glut="$mdl_cv_have_glut"
])
dnl endof bugfix -ainan
AC_DEFUN([KSW_HAVE_DLOPEN],
[
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for dlopen], ksw_cv_have_dlopen,
[
DLOPEN_save_LIBS="$LIBS"
if test x"$is_osx" = xyes; then
DLOPEN_LIBS="-ldl"
else
DLOPEN_LIBS="-ldl -rdynamic"
fi
LIBS="$DLOPEN_save_LIBS $DLOPEN_LIBS"
cat > ksw_dlopen_test.c << EOF
#include <stdio.h>
#include <dlfcn.h>
int main( int argc, char * argv[] )
{
dlopen( "filename", 0 );
return 0;
}
EOF
if ${CC} -o ksw_dlopen_test ksw_dlopen_test.c $LIBS 2> /dev/null > /dev/null; then
have_dlopen=yes
else
DLOPEN_LIBS="-ldl -Wl,export-dynamic"
LIBS="$DLOPEN_save_LIBS $DLOPEN_LIBS"
if ${CC} -o ksw_dlopen_test ksw_dlopen_test.c $LIBS 2> /dev/null > /dev/null; then
have_dlopen=yes
else
have_dlopen=no
DLOPEN_LIBS=
fi
fi
rm -f ksw_dlopen_test ksw_dlopen_test.c
LIBS="$DLOPEN_save_LIBS"
ksw_cv_DLOPEN_LIBS="$DLOPEN_LIBS"
ksw_cv_have_dlopen="$have_dlopen"
])
DLOPEN_LIBS="$ksw_cv_DLOPEN_LIBS"
have_dlopen="$ksw_cv_have_dlopen"
AC_SUBST( DLOPEN_LIBS )
if test x"$have_dlopen" = "xyes"; then
AC_DEFINE( [HAVE_DLOPEN], [], [Define when you have dlopen function] )
fi
])
AC_DEFUN([VL_PROG_CC_WARNINGS], [
ansi=$1
if test -z "$ansi"; then
msg="for C compiler warning flags"
else
msg="for C compiler warning and ANSI conformance flags"
fi
AC_CACHE_CHECK($msg, vl_cv_prog_cc_warnings, [
if test -n "$CC"; then
cat > conftest.c <<EOF
int main(int argc, char **argv) { return 0; }
EOF
dnl GCC
if test "$GCC" = "yes"; then
if test -z "$ansi"; then
vl_cv_prog_cc_warnings="-Wall"
else
vl_cv_prog_cc_warnings="-Wall -ansi -pedantic"
fi
dnl Most compilers print some kind of a version string with some command
dnl line options (often "-V"). The version string should be checked
dnl before doing a test compilation run with compiler-specific flags.
dnl This is because some compilers (like the Cray compiler) only
dnl produce a warning message for unknown flags instead of returning
dnl an error, resulting in a false positive. Also, compilers may do
dnl erratic things when invoked with flags meant for a different
dnl compiler.
dnl Solaris C compiler
elif $CC -V 2>&1 | grep -i "WorkShop" > /dev/null 2>&1 &&
$CC -c -v -Xc conftest.c > /dev/null 2>&1 &&
test -f conftest.o; then
if test -z "$ansi"; then
vl_cv_prog_cc_warnings="-v"
else
vl_cv_prog_cc_warnings="-v -Xc"
fi
dnl Digital Unix C compiler
elif $CC -V 2>&1 | grep -i "Digital UNIX Compiler" > /dev/null 2>&1 &&
$CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 &&
test -f conftest.o; then
if test -z "$ansi"; then
vl_cv_prog_cc_warnings="-verbose -w0 -warnprotos"
else
vl_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1"
fi
dnl C for AIX Compiler
elif $CC 2>&1 | grep -i "C for AIX Compiler" > /dev/null 2>&1 &&
$CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 &&
test -f conftest.o; then
if test -z "$ansi"; then
vl_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd"
else
vl_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi"
fi
dnl IRIX C compiler
elif $CC -version 2>&1 | grep -i "MIPSpro Compilers" > /dev/null 2>&1 &&
$CC -c -fullwarn -ansi -ansiE conftest.c > /dev/null 2>&1 &&
test -f conftest.o; then
if test -z "$ansi"; then
vl_cv_prog_cc_warnings="-fullwarn"
else
vl_cv_prog_cc_warnings="-fullwarn -ansi -ansiE"
fi
dnl HP-UX C compiler
elif what $CC 2>&1 | grep -i "HP C Compiler" > /dev/null 2>&1 &&
$CC -c -Aa +w1 conftest.c > /dev/null 2>&1 &&
test -f conftest.o; then
if test -z "$ansi"; then
vl_cv_prog_cc_warnings="+w1"
else
vl_cv_prog_cc_warnings="+w1 -Aa"
fi
dnl The NEC SX-5 (Super-UX 10) C compiler
elif $CC -V 2>&1 | grep "/SX" > /dev/null 2>&1 &&
$CC -c -pvctl[,]fullmsg -Xc conftest.c > /dev/null 2>&1 &&
test -f conftest.o; then
if test -z "$ansi"; then
vl_cv_prog_cc_warnings="-pvctl[,]fullmsg"
else
vl_cv_prog_cc_warnings="-pvctl[,]fullmsg -Xc"
fi
dnl The Cray C compiler (Unicos)
elif $CC -V 2>&1 | grep -i "Cray" > /dev/null 2>&1 &&
$CC -c -h msglevel 2 conftest.c > /dev/null 2>&1 &&
test -f conftest.o; then
if test -z "$ansi"; then
vl_cv_prog_cc_warnings="-h msglevel 2"
else
vl_cv_prog_cc_warnings="-h msglevel 2 -h conform"
fi
fi
rm -f conftest.*
fi
if test -n "$vl_cv_prog_cc_warnings"; then
CFLAGS="$CFLAGS $vl_cv_prog_cc_warnings"
CXXFLAGS="$CXXFLAGS $vl_cv_prog_cc_warnings"
else
vl_cv_prog_cc_warnings="unknown"
fi
])
])dnl
AC_DEFUN([AC_C_BIGENDIAN_CROSS],
[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
[ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/param.h>], [
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
bogus endian macros
#endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/param.h>], [
#if BYTE_ORDER != BIG_ENDIAN
not big endian
#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
if test $ac_cv_c_bigendian = unknown; then
AC_TRY_RUN([main () {
/* Are we little or big endian? From Harbison&Steele. */
union
{
long l;
char c[sizeof (long)];
} u;
u.l = 1;
exit (u.c[sizeof (long) - 1] == 1);
}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes,
[ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ])
fi])
if test $ac_cv_c_bigendian = unknown; then
AC_MSG_CHECKING(to probe for byte ordering)
[
cat >conftest.c <<EOF
short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; }
short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; }
int main() { _ascii (); _ebcdic (); return 0; }
EOF
] if test -f conftest.c ; then
if ${CC-cc} -c conftest.c -o conftest.o && test -f conftest.o ; then
if test `grep -l BIGenDianSyS conftest.o` ; then
echo $ac_n ' big endian probe OK, ' 1>&AC_FD_MSG
ac_cv_c_bigendian=yes
fi
if test `grep -l LiTTleEnDian conftest.o` ; then
echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG
if test $ac_cv_c_bigendian = yes ; then
ac_cv_c_bigendian=unknown;
else
ac_cv_c_bigendian=no
fi
fi
echo $ac_n 'guessing bigendian ... ' >&AC_FD_MSG
fi
fi
AC_MSG_RESULT($ac_cv_c_bigendian)
fi
if test $ac_cv_c_bigendian = yes; then
AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian])
BYTEORDER=4321
else
BYTEORDER=1234
fi
AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN])
if test $ac_cv_c_bigendian = unknown; then
AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian)
fi
])
AC_DEFUN([KSW_HAVE_X11FONT],
[
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for x11 fonts], ksw_cv_have_x11font,
[
cat > ksw_have_x11font_test.c << EOF
#include <stdio.h>
#include <GL/glx.h>
int main( int argc, char * argv[] )
{
glXUseXFont( 0, 0, 0, 0 );
return 0;
}
EOF
if ${CC} -c ksw_have_x11font_test.c 2> /dev/null > /dev/null; then
have_x11font=yes
else
have_x11font=no
fi
rm -f ksw_have_x11font*
ksw_cv_have_x11font="$have_x11font"
])
have_x11font="$ksw_cv_have_x11font"
if test x"$have_x11font" = "xyes"; then
AC_DEFINE( [HAVE_XFONT], [], [Define when you have xfont] )
fi
])
AC_DEFUN([KSW_HAVE_GETTIMEOFDAY],
[
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for gettimeofday], ksw_cv_have_gettimeofday,
[
cat > ksw_have_gettimeofday_test.c << EOF
#include <stdio.h>
#include <sys/time.h>
int main( int argc, char * argv[] )
{
struct timeval tv;
gettimeofday( &tv, NULL );
return 0;
}
EOF
if ${CC} -c ksw_have_gettimeofday_test.c 2> /dev/null > /dev/null; then
have_gettimeofday=yes
else
have_gettimeofday=no
fi
rm -f ksw_have_gettimeofday*
ksw_cv_have_gettimeofday="$have_gettimeofday"
])
have_gettimeofday="$ksw_cv_have_gettimeofday"
if test x"$have_gettimeofday" = "xyes"; then
AC_DEFINE( [HAVE_GETTIMEOFDAY], [], [Define when you have gettimeofday function] )
fi
])
AC_DEFUN([KSW_IS_OSX],
[
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for OS X], ksw_cv_is_osx,
[
if test -e /System/Library/Frameworks/Carbon.framework; then
is_osx=yes
else
is_osx=no
fi
rm -f ksw_is_osx*
ksw_cv_is_osx="$is_osx"
])
is_osx="$ksw_cv_is_osx"
if test x"$is_osx" = "xyes"; then
AC_DEFINE( [IS_OSX], [], [Define when you run on OSX] )
fi
])
|