Hi,

I forgot to attach the Makefile.am and configure.in.

Pat
dnl $Id: configure.in,v 1.1 2002/04/07 18:50:05 akorty Exp $

dnl Process this file with autoconf to produce a configure script.

AC_INIT(pam_ssh, 1.7, [EMAIL PROTECTED])
AC_CONFIG_SRCDIR([pam_ssh.c])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(dist-bzip2)
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)

dnl Checks for programs.

dnl Checks for libraries.

# The big search for OpenSSL (stolen from OpenSSH 3.1's configure.ac)
AC_ARG_WITH(ssl-dir,
        [  --with-ssl-dir=PATH     Specify path to OpenSSL installation ],
        [
                if test "x$withval" != "xno" ; then
                        tryssldir=$withval
                fi
        ]
)

saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"
saved_CPPFLAGS="$CPPFLAGS"
if test "x$prefix" != "xNONE" ; then
        tryssldir="$tryssldir $prefix"
fi
AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
        for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl 
/usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
                CPPFLAGS="$saved_CPPFLAGS"
                LDFLAGS="$saved_LDFLAGS"
                LIBS="$saved_LIBS -lcrypto"
                
                # Skip directories if they don't exist
                if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
                        continue;
                fi
                if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
                        # Try to use $ssldir/lib if it exists, otherwise 
                        # $ssldir
                        if test -d "$ssldir/lib" ; then
                                LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
                                if test ! -z "$need_dash_r" ; then
                                        LDFLAGS="-R$ssldir/lib $LDFLAGS"
                                fi
                        else
                                LDFLAGS="-L$ssldir $saved_LDFLAGS"
                                if test ! -z "$need_dash_r" ; then
                                        LDFLAGS="-R$ssldir $LDFLAGS"
                                fi
                        fi
                        # Try to use $ssldir/include if it exists, otherwise 
                        # $ssldir
                        if test -d "$ssldir/include" ; then
                                CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
                        else
                                CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
                        fi
                fi

                # Basic test to check for compatible version and correct linking
                # *does not* test for RSA - that comes later.
                AC_TRY_RUN(
                        [
#include <string.h>
#include <openssl/rand.h>
int main(void) 
{
        char a[2048];
        memset(a, 0, sizeof(a));
        RAND_add(a, sizeof(a), sizeof(a));
        return(RAND_status() <= 0);
}
                        ],
                        [
                                found_crypto=1
                                break;
                        ], []
                )

                if test ! -z "$found_crypto" ; then
                        break;
                fi
        done

        if test -z "$found_crypto" ; then
                AC_MSG_ERROR([Could not find working OpenSSL library, please install 
or check config.log])      
        fi
        if test -z "$ssldir" ; then
                ssldir="(system)"
        fi

        ac_cv_openssldir=$ssldir
])

if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
        AC_DEFINE(HAVE_OPENSSL)
        dnl Need to recover ssldir - test above runs in subshell
        ssldir=$ac_cv_openssldir
        if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
                # Try to use $ssldir/lib if it exists, otherwise 
                # $ssldir
                if test -d "$ssldir/lib" ; then
                        LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
                        if test ! -z "$need_dash_r" ; then
                                LDFLAGS="-R$ssldir/lib $LDFLAGS"
                        fi
                else
                        LDFLAGS="-L$ssldir $saved_LDFLAGS"
                        if test ! -z "$need_dash_r" ; then
                                LDFLAGS="-R$ssldir $LDFLAGS"
                        fi
                fi
                # Try to use $ssldir/include if it exists, otherwise 
                # $ssldir
                if test -d "$ssldir/include" ; then
                        CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
                else
                        CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
                fi
        fi
fi
LIBS="$saved_LIBS -lcrypto"

# Now test RSA support
saved_LIBS="$LIBS"
AC_MSG_CHECKING([for RSA support])
for WANTS_RSAREF in "" 1 ; do
        if test -z "$WANTS_RSAREF" ; then
                LIBS="$saved_LIBS"
        else
                LIBS="$saved_LIBS -lRSAglue -lrsaref"
        fi
        AC_TRY_RUN([
#include <string.h>
#include <openssl/rand.h>
#include <openssl/rsa.h>
#include <openssl/bn.h>
#include <openssl/sha.h>
int main(void) 
{
        int num; RSA *key; static unsigned char p_in[] = "blahblah";
        unsigned char c[256], p[256];
        memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
        if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
        num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
        return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
}
        ],
        [
                rsa_works=1
                break;
        ], [])
done
LIBS="$saved_LIBS"

if test ! -z "$no_rsa" ; then
        AC_MSG_RESULT(disabled)
        RSA_MSG="disabled"
else
        if test -z "$rsa_works" ; then
                AC_MSG_WARN([*** No RSA support found *** ])
                RSA_MSG="no"
        else
                if test -z "$WANTS_RSAREF" ; then
                        AC_MSG_RESULT(yes)
                        RSA_MSG="yes"
                else
                        RSA_MSG="yes (using RSAref)"
                        AC_MSG_RESULT(using RSAref)
                        LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
                fi
        fi
fi

# Sanity check OpenSSL headers
AC_MSG_CHECKING([whether OpenSSL's headers match the library])
AC_TRY_RUN(
        [
#include <string.h>
#include <openssl/opensslv.h>
int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
        ],
        [
                AC_MSG_RESULT(yes)
        ],
        [
                AC_MSG_RESULT(no)
                AC_MSG_ERROR(Your OpenSSL headers do not match your library)
        ]
)

dnl Checks for header files.

AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(stdlib.h string.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T

dnl Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS(memmove memset)
AC_REPLACE_FUNCS(strlcpy)
AC_CHECK_PAM

AC_CONFIG_FILES([Makefile])
AC_CONFIG_COMMANDS_PRE(
[LTLIBOBJS=`echo $LIBOBJS | sed 's/\.o/\.lo/g'`
AC_SUBST(LTLIBOBJS)])
AC_OUTPUT
# $Id: Makefile.am,v 1.3 2002/04/09 02:23:57 akorty Exp $

lib_LTLIBRARIES         = libpam_ssh.la
libpam_ssh_la_LIBADD    = @LTLIBOBJS@
libpam_ssh_la_SOURCES   = atomicio.c authfd.c authfile.c bufaux.c \
                          buffer.c cipher.c key.c log.c pam_ssh.c \
                          rijndael.c xmalloc.c
man_MANS                = pam_ssh.8
securitydir             = @PAMDIR@
EXTRA_DIST              = $(man_MANS)

libtool: $(LIBTOOL_DEPS)
        $(SHELL) ./config.status --recheck

install-libLTLIBRARIES: $(lib_LTLIBRARIES)
        @$(NORMAL_INSTALL)
        $(mkinstalldirs) $(DESTDIR)$(securitydir)
        $(INSTALL_DATA) .libs/libpam_ssh.so \
            $(DESTDIR)$(securitydir)/pam_ssh.so

Reply via email to