- (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@
This commit is contained in:
Darren Tucker 2004-09-11 23:26:37 +10:00
parent a2a3ed0010
commit a0c2b394b4
2 changed files with 74 additions and 33 deletions

View File

@ -11,6 +11,8 @@
SSH2_MSG_USERAUTH_BANNER messages. Note that this will not happen with SSH2_MSG_USERAUTH_BANNER messages. Note that this will not happen with
SSH2 kbdint authentication, which need to be dealt with separately. ok djm@ SSH2 kbdint authentication, which need to be dealt with separately. ok djm@
- (dtucker) [session.c] Bug #927: make .hushlogin silent again. ok djm@ - (dtucker) [session.c] Bug #927: make .hushlogin silent again. ok djm@
- (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@
20040830 20040830
- (dtucker) [session.c openbsd-compat/bsd-cygwin_util.{c,h}] Bug #915: only - (dtucker) [session.c openbsd-compat/bsd-cygwin_util.{c,h}] Bug #915: only
@ -1730,4 +1732,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.3545 2004/09/11 13:09:53 dtucker Exp $ $Id: ChangeLog,v 1.3546 2004/09/11 13:26:37 dtucker Exp $

View File

@ -1,4 +1,4 @@
# $Id: configure.ac,v 1.228 2004/08/29 11:18:09 dtucker Exp $ # $Id: configure.ac,v 1.229 2004/09/11 13:26:37 dtucker Exp $
# #
# Copyright (c) 1999-2004 Damien Miller # Copyright (c) 1999-2004 Damien Miller
# #
@ -506,7 +506,7 @@ AC_ARG_WITH(libs,
) )
AC_MSG_CHECKING(compiler and flags for sanity) AC_MSG_CHECKING(compiler and flags for sanity)
AC_TRY_RUN([ AC_RUN_IFELSE([
#include <stdio.h> #include <stdio.h>
int main(){exit(0);} int main(){exit(0);}
], ],
@ -514,7 +514,8 @@ int main(){exit(0);}
[ [
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***]) AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
] ],
[ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
) )
# Checks for header files. # Checks for header files.
@ -647,7 +648,7 @@ AC_ARG_WITH(zlib-version-check,
) )
AC_MSG_CHECKING(for zlib 1.1.4 or greater) AC_MSG_CHECKING(for zlib 1.1.4 or greater)
AC_TRY_RUN([ AC_RUN_IFELSE([
#include <zlib.h> #include <zlib.h>
int main() int main()
{ {
@ -672,7 +673,8 @@ If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
else else
AC_MSG_WARN([zlib version may have security problems]) AC_MSG_WARN([zlib version may have security problems])
fi fi
] ],
[ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
) )
dnl UnixWare 2.x dnl UnixWare 2.x
@ -726,7 +728,7 @@ AC_EGREP_CPP(FOUNDIT,
) )
AC_MSG_CHECKING([whether struct dirent allocates space for d_name]) AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
AC_TRY_RUN( AC_RUN_IFELSE(
[ [
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
@ -736,6 +738,10 @@ int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
[ [
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME) AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
],
[
AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
] ]
) )
@ -895,28 +901,30 @@ AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
AC_CHECK_FUNCS(setresuid, [ AC_CHECK_FUNCS(setresuid, [
dnl Some platorms have setresuid that isn't implemented, test for this dnl Some platorms have setresuid that isn't implemented, test for this
AC_MSG_CHECKING(if setresuid seems to work) AC_MSG_CHECKING(if setresuid seems to work)
AC_TRY_RUN([ AC_RUN_IFELSE([
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);} int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
], ],
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(yes)],
[AC_DEFINE(BROKEN_SETRESUID) [AC_DEFINE(BROKEN_SETRESUID)
AC_MSG_RESULT(not implemented)] AC_MSG_RESULT(not implemented)],
[AC_MSG_WARN([cross compiling: not checking setresuid])]
) )
]) ])
AC_CHECK_FUNCS(setresgid, [ AC_CHECK_FUNCS(setresgid, [
dnl Some platorms have setresgid that isn't implemented, test for this dnl Some platorms have setresgid that isn't implemented, test for this
AC_MSG_CHECKING(if setresgid seems to work) AC_MSG_CHECKING(if setresgid seems to work)
AC_TRY_RUN([ AC_RUN_IFELSE([
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);} int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
], ],
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(yes)],
[AC_DEFINE(BROKEN_SETRESGID) [AC_DEFINE(BROKEN_SETRESGID)
AC_MSG_RESULT(not implemented)] AC_MSG_RESULT(not implemented)],
[AC_MSG_WARN([cross compiling: not checking setresuid])]
) )
]) ])
@ -942,7 +950,7 @@ AC_CHECK_FUNC(getpagesize,
# Check for broken snprintf # Check for broken snprintf
if test "x$ac_cv_func_snprintf" = "xyes" ; then if test "x$ac_cv_func_snprintf" = "xyes" ; then
AC_MSG_CHECKING([whether snprintf correctly terminates long strings]) AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
AC_TRY_RUN( AC_RUN_IFELSE(
[ [
#include <stdio.h> #include <stdio.h>
int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');} 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');}
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_DEFINE(BROKEN_SNPRINTF) AC_DEFINE(BROKEN_SNPRINTF)
AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor]) AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
] ],
[ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
) )
fi fi
@ -1213,7 +1222,7 @@ AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
# Determine OpenSSL header version # Determine OpenSSL header version
AC_MSG_CHECKING([OpenSSL header version]) AC_MSG_CHECKING([OpenSSL header version])
AC_TRY_RUN( AC_RUN_IFELSE(
[ [
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -1240,12 +1249,15 @@ int main(void) {
[ [
AC_MSG_RESULT(not found) AC_MSG_RESULT(not found)
AC_MSG_ERROR(OpenSSL version header not found.) AC_MSG_ERROR(OpenSSL version header not found.)
],
[
AC_MSG_WARN([cross compiling: not checking])
] ]
) )
# Determine OpenSSL library version # Determine OpenSSL library version
AC_MSG_CHECKING([OpenSSL library version]) AC_MSG_CHECKING([OpenSSL library version])
AC_TRY_RUN( AC_RUN_IFELSE(
[ [
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -1273,12 +1285,15 @@ int main(void) {
[ [
AC_MSG_RESULT(not found) AC_MSG_RESULT(not found)
AC_MSG_ERROR(OpenSSL library not found.) AC_MSG_ERROR(OpenSSL library not found.)
],
[
AC_MSG_WARN([cross compiling: not checking])
] ]
) )
# Sanity check OpenSSL headers # Sanity check OpenSSL headers
AC_MSG_CHECKING([whether OpenSSL's headers match the library]) AC_MSG_CHECKING([whether OpenSSL's headers match the library])
AC_TRY_RUN( AC_RUN_IFELSE(
[ [
#include <string.h> #include <string.h>
#include <openssl/opensslv.h> #include <openssl/opensslv.h>
@ -1292,6 +1307,9 @@ int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
AC_MSG_ERROR([Your OpenSSL headers do not match your library. AC_MSG_ERROR([Your OpenSSL headers do not match your library.
Check config.log for details. Check config.log for details.
Also see contrib/findssl.sh for help identifying header/library mismatches.]) Also see contrib/findssl.sh for help identifying header/library mismatches.])
],
[
AC_MSG_WARN([cross compiling: not checking])
] ]
) )
@ -1312,7 +1330,7 @@ fi
# Check wheter OpenSSL seeds itself # Check wheter OpenSSL seeds itself
AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded]) AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
AC_TRY_RUN( AC_RUN_IFELSE(
[ [
#include <string.h> #include <string.h>
#include <openssl/rand.h> #include <openssl/rand.h>
@ -1327,6 +1345,12 @@ int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
# Default to use of the rand helper if OpenSSL doesn't # Default to use of the rand helper if OpenSSL doesn't
# seed itself # seed itself
USE_RAND_HELPER=yes USE_RAND_HELPER=yes
],
[
AC_MSG_WARN([cross compiling: assuming yes])
# This is safe, since all recent OpenSSL versions will
# complain at runtime if not seeded correctly.
OPENSSL_SEEDS_ITSELF=yes
] ]
) )
@ -1893,7 +1917,7 @@ if test "x$ac_cv_have_int64_t" = "xno" -a \
exit 1; exit 1;
else else
dnl test snprintf (broken on SCO w/gcc) dnl test snprintf (broken on SCO w/gcc)
AC_TRY_RUN( AC_RUN_IFELSE(
[ [
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -1917,7 +1941,8 @@ main()
#else #else
main() { exit(0); } main() { exit(0); }
#endif #endif
], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ] ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
AC_MSG_WARN([cross compiling: Assuming working snprintf()])
) )
fi fi
@ -2022,13 +2047,14 @@ fi
dnl make sure we're using the real structure members and not defines dnl make sure we're using the real structure members and not defines
AC_CACHE_CHECK([for msg_accrights field in struct msghdr], AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
ac_cv_have_accrights_in_msghdr, [ ac_cv_have_accrights_in_msghdr, [
AC_TRY_RUN( AC_COMPILE_IFELSE(
[ [
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/uio.h> #include <sys/uio.h>
int main() { int main() {
#ifdef msg_accrights #ifdef msg_accrights
#error "msg_accrights is a macro"
exit(1); exit(1);
#endif #endif
struct msghdr m; struct msghdr m;
@ -2046,13 +2072,14 @@ fi
AC_CACHE_CHECK([for msg_control field in struct msghdr], AC_CACHE_CHECK([for msg_control field in struct msghdr],
ac_cv_have_control_in_msghdr, [ ac_cv_have_control_in_msghdr, [
AC_TRY_RUN( AC_COMPILE_IFELSE(
[ [
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/uio.h> #include <sys/uio.h>
int main() { int main() {
#ifdef msg_control #ifdef msg_control
#error "msg_control is a macro"
exit(1); exit(1);
#endif #endif
struct msghdr m; struct msghdr m;
@ -2386,6 +2413,10 @@ if test ! -z "$MAIL" ; then
AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir") AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
fi fi
if test ! -z "$cross_compiling"; then
AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
disable_ptmx_check=yes
fi
if test -z "$no_dev_ptmx" ; then if test -z "$no_dev_ptmx" ; then
if test "x$disable_ptmx_check" != "xyes" ; then if test "x$disable_ptmx_check" != "xyes" ; then
AC_CHECK_FILE("/dev/ptmx", AC_CHECK_FILE("/dev/ptmx",
@ -2396,12 +2427,17 @@ if test -z "$no_dev_ptmx" ; then
) )
fi fi
fi fi
AC_CHECK_FILE("/dev/ptc",
[ if test -z "$cross_compiling"; then
AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC) AC_CHECK_FILE("/dev/ptc",
have_dev_ptc=1 [
] AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
) have_dev_ptc=1
]
)
else
AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
fi
# Options from here on. Some of these are preset by platform above # Options from here on. Some of these are preset by platform above
AC_ARG_WITH(mantype, AC_ARG_WITH(mantype,
@ -2498,13 +2534,16 @@ fi
# check for /etc/default/login and use it if present. # check for /etc/default/login and use it if present.
AC_ARG_ENABLE(etc-default-login, AC_ARG_ENABLE(etc-default-login,
[ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],, [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
[ [ AC_CHECK_FILE("/etc/default/login",
AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ]) [ external_path_file=/etc/default/login ])
if test "x$external_path_file" = "x/etc/default/login"; then if test ! -z "$cross_compiling"; then
AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN) AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
fi elif test "x$external_path_file" = "x/etc/default/login"; then
]) AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
fi
]
)
dnl BSD systems use /etc/login.conf so --with-default-path= has no effect dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
if test $ac_cv_func_login_getcapbool = "yes" -a \ if test $ac_cv_func_login_getcapbool = "yes" -a \