diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 183 |
1 files changed, 33 insertions, 150 deletions
diff --git a/configure.ac b/configure.ac index 6f2f9baf8..637b14e40 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: configure.ac,v 1.55 2002/05/08 23:04:14 tim Exp $ | 1 | # $Id: configure.ac,v 1.56 2002/05/11 20:17:44 tim Exp $ |
2 | 2 | ||
3 | AC_INIT | 3 | AC_INIT |
4 | AC_CONFIG_SRCDIR([ssh.c]) | 4 | AC_CONFIG_SRCDIR([ssh.c]) |
@@ -703,169 +703,52 @@ if test "x$PAM_MSG" = "xyes" ; then | |||
703 | ) | 703 | ) |
704 | fi | 704 | fi |
705 | 705 | ||
706 | # The big search for OpenSSL | 706 | # Search for OpenSSL |
707 | saved_CPPFLAGS="$CPPFLAGS" | ||
708 | saved_LDFLAGS="$LDFLAGS" | ||
707 | AC_ARG_WITH(ssl-dir, | 709 | AC_ARG_WITH(ssl-dir, |
708 | [ --with-ssl-dir=PATH Specify path to OpenSSL installation ], | 710 | [ --with-ssl-dir=PATH Specify path to OpenSSL installation ], |
709 | [ | 711 | [ |
710 | if test "x$withval" != "xno" ; then | 712 | if test "x$withval" != "xno" ; then |
711 | tryssldir=$withval | 713 | if test -d "$withval/lib"; then |
712 | fi | 714 | if test -n "${need_dash_r}"; then |
713 | ] | 715 | LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}" |
714 | ) | 716 | else |
715 | 717 | LDFLAGS="-L${withval}/lib ${LDFLAGS}" | |
716 | saved_LIBS="$LIBS" | ||
717 | saved_LDFLAGS="$LDFLAGS" | ||
718 | saved_CPPFLAGS="$CPPFLAGS" | ||
719 | if test "x$prefix" != "xNONE" ; then | ||
720 | tryssldir="$tryssldir $prefix" | ||
721 | fi | ||
722 | AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [ | ||
723 | for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do | ||
724 | CPPFLAGS="$saved_CPPFLAGS" | ||
725 | LDFLAGS="$saved_LDFLAGS" | ||
726 | LIBS="$saved_LIBS -lcrypto" | ||
727 | |||
728 | # Skip directories if they don't exist | ||
729 | if test ! -z "$ssldir" -a ! -d "$ssldir" ; then | ||
730 | continue; | ||
731 | fi | ||
732 | if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then | ||
733 | # Try to use $ssldir/lib if it exists, otherwise | ||
734 | # $ssldir | ||
735 | if test -d "$ssldir/lib" ; then | ||
736 | LDFLAGS="-L$ssldir/lib $saved_LDFLAGS" | ||
737 | if test ! -z "$need_dash_r" ; then | ||
738 | LDFLAGS="-R$ssldir/lib $LDFLAGS" | ||
739 | fi | 718 | fi |
740 | else | 719 | else |
741 | LDFLAGS="-L$ssldir $saved_LDFLAGS" | 720 | if test -n "${need_dash_r}"; then |
742 | if test ! -z "$need_dash_r" ; then | 721 | LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}" |
743 | LDFLAGS="-R$ssldir $LDFLAGS" | 722 | else |
723 | LDFLAGS="-L${withval} ${LDFLAGS}" | ||
744 | fi | 724 | fi |
745 | fi | 725 | fi |
746 | # Try to use $ssldir/include if it exists, otherwise | 726 | if test -d "$withval/include"; then |
747 | # $ssldir | 727 | CPPFLAGS="-I${withval}/include ${CPPFLAGS}" |
748 | if test -d "$ssldir/include" ; then | ||
749 | CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS" | ||
750 | else | 728 | else |
751 | CPPFLAGS="-I$ssldir $saved_CPPFLAGS" | 729 | CPPFLAGS="-I${withval} ${CPPFLAGS}" |
752 | fi | 730 | fi |
753 | fi | 731 | fi |
754 | 732 | ] | |
755 | # Basic test to check for compatible version and correct linking | 733 | ) |
756 | # *does not* test for RSA - that comes later. | 734 | LIBS="$LIBS -lcrypto" |
757 | AC_TRY_RUN( | 735 | AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL), |
758 | [ | ||
759 | #include <string.h> | ||
760 | #include <openssl/rand.h> | ||
761 | int main(void) | ||
762 | { | ||
763 | char a[2048]; | ||
764 | memset(a, 0, sizeof(a)); | ||
765 | RAND_add(a, sizeof(a), sizeof(a)); | ||
766 | return(RAND_status() <= 0); | ||
767 | } | ||
768 | ], | ||
769 | [ | ||
770 | found_crypto=1 | ||
771 | break; | ||
772 | ], [] | ||
773 | ) | ||
774 | |||
775 | if test ! -z "$found_crypto" ; then | ||
776 | break; | ||
777 | fi | ||
778 | done | ||
779 | |||
780 | if test -z "$found_crypto" ; then | ||
781 | AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log]) | ||
782 | fi | ||
783 | if test -z "$ssldir" ; then | ||
784 | ssldir="(system)" | ||
785 | fi | ||
786 | |||
787 | ac_cv_openssldir=$ssldir | ||
788 | ]) | ||
789 | |||
790 | if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then | ||
791 | AC_DEFINE(HAVE_OPENSSL) | ||
792 | dnl Need to recover ssldir - test above runs in subshell | ||
793 | ssldir=$ac_cv_openssldir | ||
794 | if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then | ||
795 | # Try to use $ssldir/lib if it exists, otherwise | ||
796 | # $ssldir | ||
797 | if test -d "$ssldir/lib" ; then | ||
798 | LDFLAGS="-L$ssldir/lib $saved_LDFLAGS" | ||
799 | if test ! -z "$need_dash_r" ; then | ||
800 | LDFLAGS="-R$ssldir/lib $LDFLAGS" | ||
801 | fi | ||
802 | else | ||
803 | LDFLAGS="-L$ssldir $saved_LDFLAGS" | ||
804 | if test ! -z "$need_dash_r" ; then | ||
805 | LDFLAGS="-R$ssldir $LDFLAGS" | ||
806 | fi | ||
807 | fi | ||
808 | # Try to use $ssldir/include if it exists, otherwise | ||
809 | # $ssldir | ||
810 | if test -d "$ssldir/include" ; then | ||
811 | CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS" | ||
812 | else | ||
813 | CPPFLAGS="-I$ssldir $saved_CPPFLAGS" | ||
814 | fi | ||
815 | fi | ||
816 | fi | ||
817 | LIBS="$saved_LIBS -lcrypto" | ||
818 | |||
819 | # Now test RSA support | ||
820 | saved_LIBS="$LIBS" | ||
821 | AC_MSG_CHECKING([for RSA support]) | ||
822 | for WANTS_RSAREF in "" 1 ; do | ||
823 | if test -z "$WANTS_RSAREF" ; then | ||
824 | LIBS="$saved_LIBS" | ||
825 | else | ||
826 | LIBS="$saved_LIBS -lRSAglue -lrsaref" | ||
827 | fi | ||
828 | AC_TRY_RUN([ | ||
829 | #include <string.h> | ||
830 | #include <openssl/rand.h> | ||
831 | #include <openssl/rsa.h> | ||
832 | #include <openssl/bn.h> | ||
833 | #include <openssl/sha.h> | ||
834 | int main(void) | ||
835 | { | ||
836 | int num; RSA *key; static unsigned char p_in[] = "blahblah"; | ||
837 | unsigned char c[256], p[256]; | ||
838 | memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c)); | ||
839 | if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1); | ||
840 | num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING); | ||
841 | return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING)); | ||
842 | } | ||
843 | ], | ||
844 | [ | 736 | [ |
845 | rsa_works=1 | 737 | dnl Check default openssl install dir |
846 | break; | 738 | if test -n "${need_dash_r}"; then |
847 | ], []) | 739 | LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}" |
848 | done | ||
849 | LIBS="$saved_LIBS" | ||
850 | |||
851 | if test ! -z "$no_rsa" ; then | ||
852 | AC_MSG_RESULT(disabled) | ||
853 | RSA_MSG="disabled" | ||
854 | else | ||
855 | if test -z "$rsa_works" ; then | ||
856 | AC_MSG_WARN([*** No RSA support found *** ]) | ||
857 | RSA_MSG="no" | ||
858 | else | ||
859 | if test -z "$WANTS_RSAREF" ; then | ||
860 | AC_MSG_RESULT(yes) | ||
861 | RSA_MSG="yes" | ||
862 | else | 740 | else |
863 | RSA_MSG="yes (using RSAref)" | 741 | LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}" |
864 | AC_MSG_RESULT(using RSAref) | ||
865 | LIBS="$LIBS -lcrypto -lRSAglue -lrsaref" | ||
866 | fi | 742 | fi |
867 | fi | 743 | CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}" |
868 | fi | 744 | AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL), |
745 | [ | ||
746 | AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***]) | ||
747 | ] | ||
748 | ) | ||
749 | ] | ||
750 | ) | ||
751 | |||
869 | 752 | ||
870 | # Sanity check OpenSSL headers | 753 | # Sanity check OpenSSL headers |
871 | AC_MSG_CHECKING([whether OpenSSL's headers match the library]) | 754 | AC_MSG_CHECKING([whether OpenSSL's headers match the library]) |