Index: openssh-4.0p1/configure.ac =================================================================== --- openssh-4.0p1.orig/configure.ac 2005-03-07 04:21:37.000000000 -0500 +++ openssh-4.0p1/configure.ac 2005-03-12 23:43:25.057482040 -0500 @@ -718,23 +718,21 @@ ] ) -AC_MSG_CHECKING([whether struct dirent allocates space for d_name]) -AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include -#include -int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));} - ]])], - [AC_MSG_RESULT(yes)], - [ - AC_MSG_RESULT(no) - 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) - ] -) +AC_CACHE_CHECK([whether struct dirent allocates space for d_name], ac_cv_have_space_d_name_in_struct_dirent, [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #include + #include + int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));} + ]])], + [ ac_cv_have_space_d_name_in_struct_dirent="yes" ], + [ ac_cv_have_space_d_name_in_struct_dirent="no" ], + ) +]) + +if test "x$ac_cv_dirent_have_space_d_name" = "xyes" ; then + AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME) +fi AC_MSG_CHECKING([for /proc/pid/fd directory]) if test -d "/proc/$$/fd" ; then @@ -987,20 +985,25 @@ # Check for broken snprintf if test "x$ac_cv_func_snprintf" = "xyes" ; then - AC_MSG_CHECKING([whether snprintf correctly terminates long strings]) - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include -int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');} - ]])], - [AC_MSG_RESULT(yes)], - [ - AC_MSG_RESULT(no) - AC_DEFINE(BROKEN_SNPRINTF) - AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor]) - ], - [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ] - ) + AC_CACHE_CHECK([whether snprintf correctly terminates long strings], + ac_cv_have_broken_snprintf, [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #include + int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');} + ]])], + [ac_cv_have_broken_snprintf="no"], + [ac_cv_have_broken_snprintf="yes"], + [ + AC_MSG_WARN([cross compiling: Assuming working snprintf()]) + ac_cv_have_broken_snprintf="yes" + ] + ) + ]) + if test "x$ac_cv_have_broken_snprintf" = "xyes" ; then + AC_DEFINE(BROKEN_SNPRINTF) + AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor]) + fi fi # Check for missing getpeereid (or equiv) support @@ -1045,49 +1048,49 @@ dnl make sure that openpty does not reacquire controlling terminal if test ! -z "$check_for_openpty_ctty_bug"; then - AC_MSG_CHECKING(if openpty correctly handles controlling tty) - AC_TRY_RUN( - [ -#include -#include -#include -#include - -int -main() -{ - pid_t pid; - int fd, ptyfd, ttyfd, status; - - pid = fork(); - if (pid < 0) { /* failed */ - exit(1); - } else if (pid > 0) { /* parent */ - waitpid(pid, &status, 0); - if (WIFEXITED(status)) - exit(WEXITSTATUS(status)); - else - exit(2); - } else { /* child */ - close(0); close(1); close(2); - setsid(); - openpty(&ptyfd, &ttyfd, NULL, NULL, NULL); - fd = open("/dev/tty", O_RDWR | O_NOCTTY); - if (fd >= 0) - exit(3); /* Acquired ctty: broken */ - else - exit(0); /* Did not acquire ctty: OK */ + AC_CACHE_CHECK([if openpty acquires controlling terminal], + ac_cv_have_openpty_ctty_bug, [ + AC_TRY_RUN( + [ + #include + #include + #include + #include + + int + main() + { + pid_t pid; + int fd, ptyfd, ttyfd, status; + + pid = fork(); + if (pid < 0) { /* failed */ + exit(1); + } else if (pid > 0) { /* parent */ + waitpid(pid, &status, 0); + if (WIFEXITED(status)) + exit(WEXITSTATUS(status)); + else + exit(2); + } else { /* child */ + close(0); close(1); close(2); + setsid(); + openpty(&ptyfd, &ttyfd, NULL, NULL, NULL); + fd = open("/dev/tty", O_RDWR | O_NOCTTY); + if (fd >= 0) + exit(3); /* Acquired ctty: broken */ + else + exit(0); /* Did not acquire ctty: OK */ + } } -} - ], - [ - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_RESULT(no) - AC_DEFINE(SSHD_ACQUIRES_CTTY) - ] - ) + ], + [ ac_cv_have_openpty_ctty_bug="no" ], + [ ac_cv_have_openpty_ctty_bug="yes"] + ) + ]) + if test "x$ac_cv_have_openpty_ctty_bug" = "xyes" ; then + AC_DEFINE(SSHD_ACQUIRES_CTTY) + fi fi if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then @@ -2039,8 +2042,12 @@ exit 1; else dnl test snprintf (broken on SCO w/gcc) - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ + # No need to check for a broken snprintf if we already know it's broken. + if test "x$ac_cv_func_snprintf" = "xyes" && test "x$ac_cv_have_broken_snprintf" != "xyes"; then + AC_CACHE_CHECK([whether snprintf correctly terminates long strings], + ac_cv_have_broken_snprintf, [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include #include #ifdef HAVE_SNPRINTF @@ -2063,9 +2070,20 @@ #else main() { exit(0); } #endif - ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ], - AC_MSG_WARN([cross compiling: Assuming working snprintf()]) - ) + ]])], + [ac_cv_have_broken_snprintf="no"], + [ac_cv_have_broken_snprintf="yes"], + [ + AC_MSG_WARN([cross compiling: Assuming working snprintf()]) + ac_cv_have_broken_snprintf="yes" + ] + ) + ]) + if test "x$ac_cv_have_broken_snprintf" = "xyes" ; then + AC_DEFINE(BROKEN_SNPRINTF) + AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor]) + fi + fi fi dnl Checks for structure members @@ -2666,12 +2684,15 @@ ) if test "x$etc_default_login" != "xno"; then - AC_CHECK_FILE("/etc/default/login", - [ external_path_file=/etc/default/login ]) if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then AC_MSG_WARN([cross compiling: Disabling /etc/default/login test]) - elif test "x$external_path_file" = "x/etc/default/login"; then + external_path_file=/etc/default/login + else + AC_CHECK_FILE("/etc/default/login", + [ external_path_file=/etc/default/login ]) + fi + if test "x$external_path_file" = "x/etc/default/login"; then AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN) fi fi