diff options
author | Darren Tucker <dtucker@zip.com.au> | 2004-09-11 23:26:37 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2004-09-11 23:26:37 +1000 |
commit | a0c2b394b4e6d881bb70ab25c77d25922e07fd40 (patch) | |
tree | 723af5f44a5b6f2997e750a48d6f2e68eb90e903 /configure.ac | |
parent | a2a3ed0010fc10a1c39404a3c3cddd3de27019b2 (diff) |
- (dtucker) [configure.ac] Bug #321: Add cross-compile support to configure.
Parts by chua at ayrnetworks.com, astrand at lysator.liu.se and me. ok djm@
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 103 |
1 files changed, 71 insertions, 32 deletions
diff --git a/configure.ac b/configure.ac index 85d46f385..9b80c6a37 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: configure.ac,v 1.228 2004/08/29 11:18:09 dtucker Exp $ | 1 | # $Id: configure.ac,v 1.229 2004/09/11 13:26:37 dtucker Exp $ |
2 | # | 2 | # |
3 | # Copyright (c) 1999-2004 Damien Miller | 3 | # Copyright (c) 1999-2004 Damien Miller |
4 | # | 4 | # |
@@ -506,7 +506,7 @@ AC_ARG_WITH(libs, | |||
506 | ) | 506 | ) |
507 | 507 | ||
508 | AC_MSG_CHECKING(compiler and flags for sanity) | 508 | AC_MSG_CHECKING(compiler and flags for sanity) |
509 | AC_TRY_RUN([ | 509 | AC_RUN_IFELSE([ |
510 | #include <stdio.h> | 510 | #include <stdio.h> |
511 | int main(){exit(0);} | 511 | int main(){exit(0);} |
512 | ], | 512 | ], |
@@ -514,7 +514,8 @@ int main(){exit(0);} | |||
514 | [ | 514 | [ |
515 | AC_MSG_RESULT(no) | 515 | AC_MSG_RESULT(no) |
516 | AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***]) | 516 | AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***]) |
517 | ] | 517 | ], |
518 | [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ] | ||
518 | ) | 519 | ) |
519 | 520 | ||
520 | # Checks for header files. | 521 | # Checks for header files. |
@@ -647,7 +648,7 @@ AC_ARG_WITH(zlib-version-check, | |||
647 | ) | 648 | ) |
648 | 649 | ||
649 | AC_MSG_CHECKING(for zlib 1.1.4 or greater) | 650 | AC_MSG_CHECKING(for zlib 1.1.4 or greater) |
650 | AC_TRY_RUN([ | 651 | AC_RUN_IFELSE([ |
651 | #include <zlib.h> | 652 | #include <zlib.h> |
652 | int main() | 653 | int main() |
653 | { | 654 | { |
@@ -672,7 +673,8 @@ If you are in doubt, upgrade zlib to version 1.1.4 or greater.]) | |||
672 | else | 673 | else |
673 | AC_MSG_WARN([zlib version may have security problems]) | 674 | AC_MSG_WARN([zlib version may have security problems]) |
674 | fi | 675 | fi |
675 | ] | 676 | ], |
677 | [ AC_MSG_WARN([cross compiling: not checking zlib version]) ] | ||
676 | ) | 678 | ) |
677 | 679 | ||
678 | dnl UnixWare 2.x | 680 | dnl UnixWare 2.x |
@@ -726,7 +728,7 @@ AC_EGREP_CPP(FOUNDIT, | |||
726 | ) | 728 | ) |
727 | 729 | ||
728 | AC_MSG_CHECKING([whether struct dirent allocates space for d_name]) | 730 | AC_MSG_CHECKING([whether struct dirent allocates space for d_name]) |
729 | AC_TRY_RUN( | 731 | AC_RUN_IFELSE( |
730 | [ | 732 | [ |
731 | #include <sys/types.h> | 733 | #include <sys/types.h> |
732 | #include <dirent.h> | 734 | #include <dirent.h> |
@@ -736,6 +738,10 @@ int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));} | |||
736 | [ | 738 | [ |
737 | AC_MSG_RESULT(no) | 739 | AC_MSG_RESULT(no) |
738 | AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME) | 740 | AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME) |
741 | ], | ||
742 | [ | ||
743 | AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME]) | ||
744 | AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME) | ||
739 | ] | 745 | ] |
740 | ) | 746 | ) |
741 | 747 | ||
@@ -895,28 +901,30 @@ AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>]) | |||
895 | AC_CHECK_FUNCS(setresuid, [ | 901 | AC_CHECK_FUNCS(setresuid, [ |
896 | dnl Some platorms have setresuid that isn't implemented, test for this | 902 | dnl Some platorms have setresuid that isn't implemented, test for this |
897 | AC_MSG_CHECKING(if setresuid seems to work) | 903 | AC_MSG_CHECKING(if setresuid seems to work) |
898 | AC_TRY_RUN([ | 904 | AC_RUN_IFELSE([ |
899 | #include <stdlib.h> | 905 | #include <stdlib.h> |
900 | #include <errno.h> | 906 | #include <errno.h> |
901 | int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);} | 907 | int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);} |
902 | ], | 908 | ], |
903 | [AC_MSG_RESULT(yes)], | 909 | [AC_MSG_RESULT(yes)], |
904 | [AC_DEFINE(BROKEN_SETRESUID) | 910 | [AC_DEFINE(BROKEN_SETRESUID) |
905 | AC_MSG_RESULT(not implemented)] | 911 | AC_MSG_RESULT(not implemented)], |
912 | [AC_MSG_WARN([cross compiling: not checking setresuid])] | ||
906 | ) | 913 | ) |
907 | ]) | 914 | ]) |
908 | 915 | ||
909 | AC_CHECK_FUNCS(setresgid, [ | 916 | AC_CHECK_FUNCS(setresgid, [ |
910 | dnl Some platorms have setresgid that isn't implemented, test for this | 917 | dnl Some platorms have setresgid that isn't implemented, test for this |
911 | AC_MSG_CHECKING(if setresgid seems to work) | 918 | AC_MSG_CHECKING(if setresgid seems to work) |
912 | AC_TRY_RUN([ | 919 | AC_RUN_IFELSE([ |
913 | #include <stdlib.h> | 920 | #include <stdlib.h> |
914 | #include <errno.h> | 921 | #include <errno.h> |
915 | int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);} | 922 | int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);} |
916 | ], | 923 | ], |
917 | [AC_MSG_RESULT(yes)], | 924 | [AC_MSG_RESULT(yes)], |
918 | [AC_DEFINE(BROKEN_SETRESGID) | 925 | [AC_DEFINE(BROKEN_SETRESGID) |
919 | AC_MSG_RESULT(not implemented)] | 926 | AC_MSG_RESULT(not implemented)], |
927 | [AC_MSG_WARN([cross compiling: not checking setresuid])] | ||
920 | ) | 928 | ) |
921 | ]) | 929 | ]) |
922 | 930 | ||
@@ -942,7 +950,7 @@ AC_CHECK_FUNC(getpagesize, | |||
942 | # Check for broken snprintf | 950 | # Check for broken snprintf |
943 | if test "x$ac_cv_func_snprintf" = "xyes" ; then | 951 | if test "x$ac_cv_func_snprintf" = "xyes" ; then |
944 | AC_MSG_CHECKING([whether snprintf correctly terminates long strings]) | 952 | AC_MSG_CHECKING([whether snprintf correctly terminates long strings]) |
945 | AC_TRY_RUN( | 953 | AC_RUN_IFELSE( |
946 | [ | 954 | [ |
947 | #include <stdio.h> | 955 | #include <stdio.h> |
948 | int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');} | 956 | int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');} |
@@ -952,7 +960,8 @@ int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');} | |||
952 | AC_MSG_RESULT(no) | 960 | AC_MSG_RESULT(no) |
953 | AC_DEFINE(BROKEN_SNPRINTF) | 961 | AC_DEFINE(BROKEN_SNPRINTF) |
954 | AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor]) | 962 | AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor]) |
955 | ] | 963 | ], |
964 | [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ] | ||
956 | ) | 965 | ) |
957 | fi | 966 | fi |
958 | 967 | ||
@@ -1213,7 +1222,7 @@ AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL), | |||
1213 | 1222 | ||
1214 | # Determine OpenSSL header version | 1223 | # Determine OpenSSL header version |
1215 | AC_MSG_CHECKING([OpenSSL header version]) | 1224 | AC_MSG_CHECKING([OpenSSL header version]) |
1216 | AC_TRY_RUN( | 1225 | AC_RUN_IFELSE( |
1217 | [ | 1226 | [ |
1218 | #include <stdio.h> | 1227 | #include <stdio.h> |
1219 | #include <string.h> | 1228 | #include <string.h> |
@@ -1240,12 +1249,15 @@ int main(void) { | |||
1240 | [ | 1249 | [ |
1241 | AC_MSG_RESULT(not found) | 1250 | AC_MSG_RESULT(not found) |
1242 | AC_MSG_ERROR(OpenSSL version header not found.) | 1251 | AC_MSG_ERROR(OpenSSL version header not found.) |
1252 | ], | ||
1253 | [ | ||
1254 | AC_MSG_WARN([cross compiling: not checking]) | ||
1243 | ] | 1255 | ] |
1244 | ) | 1256 | ) |
1245 | 1257 | ||
1246 | # Determine OpenSSL library version | 1258 | # Determine OpenSSL library version |
1247 | AC_MSG_CHECKING([OpenSSL library version]) | 1259 | AC_MSG_CHECKING([OpenSSL library version]) |
1248 | AC_TRY_RUN( | 1260 | AC_RUN_IFELSE( |
1249 | [ | 1261 | [ |
1250 | #include <stdio.h> | 1262 | #include <stdio.h> |
1251 | #include <string.h> | 1263 | #include <string.h> |
@@ -1273,12 +1285,15 @@ int main(void) { | |||
1273 | [ | 1285 | [ |
1274 | AC_MSG_RESULT(not found) | 1286 | AC_MSG_RESULT(not found) |
1275 | AC_MSG_ERROR(OpenSSL library not found.) | 1287 | AC_MSG_ERROR(OpenSSL library not found.) |
1288 | ], | ||
1289 | [ | ||
1290 | AC_MSG_WARN([cross compiling: not checking]) | ||
1276 | ] | 1291 | ] |
1277 | ) | 1292 | ) |
1278 | 1293 | ||
1279 | # Sanity check OpenSSL headers | 1294 | # Sanity check OpenSSL headers |
1280 | AC_MSG_CHECKING([whether OpenSSL's headers match the library]) | 1295 | AC_MSG_CHECKING([whether OpenSSL's headers match the library]) |
1281 | AC_TRY_RUN( | 1296 | AC_RUN_IFELSE( |
1282 | [ | 1297 | [ |
1283 | #include <string.h> | 1298 | #include <string.h> |
1284 | #include <openssl/opensslv.h> | 1299 | #include <openssl/opensslv.h> |
@@ -1292,6 +1307,9 @@ int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); } | |||
1292 | AC_MSG_ERROR([Your OpenSSL headers do not match your library. | 1307 | AC_MSG_ERROR([Your OpenSSL headers do not match your library. |
1293 | Check config.log for details. | 1308 | Check config.log for details. |
1294 | Also see contrib/findssl.sh for help identifying header/library mismatches.]) | 1309 | Also see contrib/findssl.sh for help identifying header/library mismatches.]) |
1310 | ], | ||
1311 | [ | ||
1312 | AC_MSG_WARN([cross compiling: not checking]) | ||
1295 | ] | 1313 | ] |
1296 | ) | 1314 | ) |
1297 | 1315 | ||
@@ -1312,7 +1330,7 @@ fi | |||
1312 | 1330 | ||
1313 | # Check wheter OpenSSL seeds itself | 1331 | # Check wheter OpenSSL seeds itself |
1314 | AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded]) | 1332 | AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded]) |
1315 | AC_TRY_RUN( | 1333 | AC_RUN_IFELSE( |
1316 | [ | 1334 | [ |
1317 | #include <string.h> | 1335 | #include <string.h> |
1318 | #include <openssl/rand.h> | 1336 | #include <openssl/rand.h> |
@@ -1327,6 +1345,12 @@ int main(void) { exit(RAND_status() == 1 ? 0 : 1); } | |||
1327 | # Default to use of the rand helper if OpenSSL doesn't | 1345 | # Default to use of the rand helper if OpenSSL doesn't |
1328 | # seed itself | 1346 | # seed itself |
1329 | USE_RAND_HELPER=yes | 1347 | USE_RAND_HELPER=yes |
1348 | ], | ||
1349 | [ | ||
1350 | AC_MSG_WARN([cross compiling: assuming yes]) | ||
1351 | # This is safe, since all recent OpenSSL versions will | ||
1352 | # complain at runtime if not seeded correctly. | ||
1353 | OPENSSL_SEEDS_ITSELF=yes | ||
1330 | ] | 1354 | ] |
1331 | ) | 1355 | ) |
1332 | 1356 | ||
@@ -1893,7 +1917,7 @@ if test "x$ac_cv_have_int64_t" = "xno" -a \ | |||
1893 | exit 1; | 1917 | exit 1; |
1894 | else | 1918 | else |
1895 | dnl test snprintf (broken on SCO w/gcc) | 1919 | dnl test snprintf (broken on SCO w/gcc) |
1896 | AC_TRY_RUN( | 1920 | AC_RUN_IFELSE( |
1897 | [ | 1921 | [ |
1898 | #include <stdio.h> | 1922 | #include <stdio.h> |
1899 | #include <string.h> | 1923 | #include <string.h> |
@@ -1917,7 +1941,8 @@ main() | |||
1917 | #else | 1941 | #else |
1918 | main() { exit(0); } | 1942 | main() { exit(0); } |
1919 | #endif | 1943 | #endif |
1920 | ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ] | 1944 | ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ], |
1945 | AC_MSG_WARN([cross compiling: Assuming working snprintf()]) | ||
1921 | ) | 1946 | ) |
1922 | fi | 1947 | fi |
1923 | 1948 | ||
@@ -2022,13 +2047,14 @@ fi | |||
2022 | dnl make sure we're using the real structure members and not defines | 2047 | dnl make sure we're using the real structure members and not defines |
2023 | AC_CACHE_CHECK([for msg_accrights field in struct msghdr], | 2048 | AC_CACHE_CHECK([for msg_accrights field in struct msghdr], |
2024 | ac_cv_have_accrights_in_msghdr, [ | 2049 | ac_cv_have_accrights_in_msghdr, [ |
2025 | AC_TRY_RUN( | 2050 | AC_COMPILE_IFELSE( |
2026 | [ | 2051 | [ |
2027 | #include <sys/types.h> | 2052 | #include <sys/types.h> |
2028 | #include <sys/socket.h> | 2053 | #include <sys/socket.h> |
2029 | #include <sys/uio.h> | 2054 | #include <sys/uio.h> |
2030 | int main() { | 2055 | int main() { |
2031 | #ifdef msg_accrights | 2056 | #ifdef msg_accrights |
2057 | #error "msg_accrights is a macro" | ||
2032 | exit(1); | 2058 | exit(1); |
2033 | #endif | 2059 | #endif |
2034 | struct msghdr m; | 2060 | struct msghdr m; |
@@ -2046,13 +2072,14 @@ fi | |||
2046 | 2072 | ||
2047 | AC_CACHE_CHECK([for msg_control field in struct msghdr], | 2073 | AC_CACHE_CHECK([for msg_control field in struct msghdr], |
2048 | ac_cv_have_control_in_msghdr, [ | 2074 | ac_cv_have_control_in_msghdr, [ |
2049 | AC_TRY_RUN( | 2075 | AC_COMPILE_IFELSE( |
2050 | [ | 2076 | [ |
2051 | #include <sys/types.h> | 2077 | #include <sys/types.h> |
2052 | #include <sys/socket.h> | 2078 | #include <sys/socket.h> |
2053 | #include <sys/uio.h> | 2079 | #include <sys/uio.h> |
2054 | int main() { | 2080 | int main() { |
2055 | #ifdef msg_control | 2081 | #ifdef msg_control |
2082 | #error "msg_control is a macro" | ||
2056 | exit(1); | 2083 | exit(1); |
2057 | #endif | 2084 | #endif |
2058 | struct msghdr m; | 2085 | struct msghdr m; |
@@ -2386,6 +2413,10 @@ if test ! -z "$MAIL" ; then | |||
2386 | AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir") | 2413 | AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir") |
2387 | fi | 2414 | fi |
2388 | 2415 | ||
2416 | if test ! -z "$cross_compiling"; then | ||
2417 | AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test]) | ||
2418 | disable_ptmx_check=yes | ||
2419 | fi | ||
2389 | if test -z "$no_dev_ptmx" ; then | 2420 | if test -z "$no_dev_ptmx" ; then |
2390 | if test "x$disable_ptmx_check" != "xyes" ; then | 2421 | if test "x$disable_ptmx_check" != "xyes" ; then |
2391 | AC_CHECK_FILE("/dev/ptmx", | 2422 | AC_CHECK_FILE("/dev/ptmx", |
@@ -2396,12 +2427,17 @@ if test -z "$no_dev_ptmx" ; then | |||
2396 | ) | 2427 | ) |
2397 | fi | 2428 | fi |
2398 | fi | 2429 | fi |
2399 | AC_CHECK_FILE("/dev/ptc", | 2430 | |
2400 | [ | 2431 | if test -z "$cross_compiling"; then |
2401 | AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC) | 2432 | AC_CHECK_FILE("/dev/ptc", |
2402 | have_dev_ptc=1 | 2433 | [ |
2403 | ] | 2434 | AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC) |
2404 | ) | 2435 | have_dev_ptc=1 |
2436 | ] | ||
2437 | ) | ||
2438 | else | ||
2439 | AC_MSG_WARN([cross compiling: Disabling /dev/ptc test]) | ||
2440 | fi | ||
2405 | 2441 | ||
2406 | # Options from here on. Some of these are preset by platform above | 2442 | # Options from here on. Some of these are preset by platform above |
2407 | AC_ARG_WITH(mantype, | 2443 | AC_ARG_WITH(mantype, |
@@ -2498,13 +2534,16 @@ fi | |||
2498 | # check for /etc/default/login and use it if present. | 2534 | # check for /etc/default/login and use it if present. |
2499 | AC_ARG_ENABLE(etc-default-login, | 2535 | AC_ARG_ENABLE(etc-default-login, |
2500 | [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],, | 2536 | [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],, |
2501 | [ | 2537 | [ AC_CHECK_FILE("/etc/default/login", |
2502 | AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ]) | 2538 | [ external_path_file=/etc/default/login ]) |
2503 | 2539 | ||
2504 | if test "x$external_path_file" = "x/etc/default/login"; then | 2540 | if test ! -z "$cross_compiling"; then |
2505 | AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN) | 2541 | AC_MSG_WARN([cross compiling: Disabling /etc/default/login test]) |
2506 | fi | 2542 | elif test "x$external_path_file" = "x/etc/default/login"; then |
2507 | ]) | 2543 | AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN) |
2544 | fi | ||
2545 | ] | ||
2546 | ) | ||
2508 | 2547 | ||
2509 | dnl BSD systems use /etc/login.conf so --with-default-path= has no effect | 2548 | dnl BSD systems use /etc/login.conf so --with-default-path= has no effect |
2510 | if test $ac_cv_func_login_getcapbool = "yes" -a \ | 2549 | if test $ac_cv_func_login_getcapbool = "yes" -a \ |