summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-09-11 23:26:37 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-09-11 23:26:37 +1000
commita0c2b394b4e6d881bb70ab25c77d25922e07fd40 (patch)
tree723af5f44a5b6f2997e750a48d6f2e68eb90e903 /configure.ac
parenta2a3ed0010fc10a1c39404a3c3cddd3de27019b2 (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.ac103
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
508AC_MSG_CHECKING(compiler and flags for sanity) 508AC_MSG_CHECKING(compiler and flags for sanity)
509AC_TRY_RUN([ 509AC_RUN_IFELSE([
510#include <stdio.h> 510#include <stdio.h>
511int main(){exit(0);} 511int 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
649AC_MSG_CHECKING(for zlib 1.1.4 or greater) 650AC_MSG_CHECKING(for zlib 1.1.4 or greater)
650AC_TRY_RUN([ 651AC_RUN_IFELSE([
651#include <zlib.h> 652#include <zlib.h>
652int main() 653int 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
678dnl UnixWare 2.x 680dnl UnixWare 2.x
@@ -726,7 +728,7 @@ AC_EGREP_CPP(FOUNDIT,
726) 728)
727 729
728AC_MSG_CHECKING([whether struct dirent allocates space for d_name]) 730AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
729AC_TRY_RUN( 731AC_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>])
895AC_CHECK_FUNCS(setresuid, [ 901AC_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>
901int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);} 907int 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
909AC_CHECK_FUNCS(setresgid, [ 916AC_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>
915int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);} 922int 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
943if test "x$ac_cv_func_snprintf" = "xyes" ; then 951if 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>
948int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');} 956int 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 )
957fi 966fi
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
1215AC_MSG_CHECKING([OpenSSL header version]) 1224AC_MSG_CHECKING([OpenSSL header version])
1216AC_TRY_RUN( 1225AC_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
1247AC_MSG_CHECKING([OpenSSL library version]) 1259AC_MSG_CHECKING([OpenSSL library version])
1248AC_TRY_RUN( 1260AC_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
1280AC_MSG_CHECKING([whether OpenSSL's headers match the library]) 1295AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1281AC_TRY_RUN( 1296AC_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.
1293Check config.log for details. 1308Check config.log for details.
1294Also see contrib/findssl.sh for help identifying header/library mismatches.]) 1309Also 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
1314AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded]) 1332AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1315AC_TRY_RUN( 1333AC_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;
1894else 1918else
1895dnl test snprintf (broken on SCO w/gcc) 1919dnl 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
1918main() { exit(0); } 1942main() { 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 )
1922fi 1947fi
1923 1948
@@ -2022,13 +2047,14 @@ fi
2022dnl make sure we're using the real structure members and not defines 2047dnl make sure we're using the real structure members and not defines
2023AC_CACHE_CHECK([for msg_accrights field in struct msghdr], 2048AC_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>
2030int main() { 2055int main() {
2031#ifdef msg_accrights 2056#ifdef msg_accrights
2057#error "msg_accrights is a macro"
2032exit(1); 2058exit(1);
2033#endif 2059#endif
2034struct msghdr m; 2060struct msghdr m;
@@ -2046,13 +2072,14 @@ fi
2046 2072
2047AC_CACHE_CHECK([for msg_control field in struct msghdr], 2073AC_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>
2054int main() { 2080int main() {
2055#ifdef msg_control 2081#ifdef msg_control
2082#error "msg_control is a macro"
2056exit(1); 2083exit(1);
2057#endif 2084#endif
2058struct msghdr m; 2085struct 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")
2387fi 2414fi
2388 2415
2416if test ! -z "$cross_compiling"; then
2417 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2418 disable_ptmx_check=yes
2419fi
2389if test -z "$no_dev_ptmx" ; then 2420if 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
2398fi 2429fi
2399AC_CHECK_FILE("/dev/ptc", 2430
2400 [ 2431if 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 )
2438else
2439 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2440fi
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
2407AC_ARG_WITH(mantype, 2443AC_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.
2499AC_ARG_ENABLE(etc-default-login, 2535AC_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",
2502AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ]) 2538 [ external_path_file=/etc/default/login ])
2503 2539
2504if 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])
2506fi 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
2509dnl BSD systems use /etc/login.conf so --with-default-path= has no effect 2548dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2510if test $ac_cv_func_login_getcapbool = "yes" -a \ 2549if test $ac_cv_func_login_getcapbool = "yes" -a \