-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure.in
138 lines (118 loc) · 3.58 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
dnl Process this file with autoconf to produce a configure script.
AC_INIT(t_pwd.h)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(libsrp, 2.0.0)
test "$CFLAGS" = "" && CFLAGS="-O"
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
AC_ARG_PROGRAM
dnl Checks for libraries.
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(dl, dlopen)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sgtty.h sys/ioctl.h sys/time.h termio.h termios.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_TRY_COMPILE(, [volatile int i;], , AC_DEFINE(volatile, ))
dnl Checks for library functions.
AC_CHECK_FUNCS(sigaction strchr memcpy)
AC_TYPE_SIGNAL
AC_HEADER_CHECK(termios.h,AC_FUNC_CHECK(cfsetispeed,AC_DEFINE(POSIX_TERMIOS)))
dnl User options
AC_ARG_WITH(openssl, [ --with-openssl=DIR compile to use OpenSSL ], OPENSSLDIR=$withval)
AC_ARG_WITH(cryptolib, [ --with-cryptolib=DIR compile to use cryptolib ], CRYPTOLIBDIR=$withval, with_cryptolib=no)
AC_ARG_WITH(gmp, [ --with-gmp=DIR compile to use GNU MP ], GMPDIR=$withval, with_gmp=no)
AC_ARG_WITH(gcrypt, [ --with-gcrypt=DIR compile to use libgcrypt ], GCRYPTDIR=$withval, with_gcrypt=no)
AC_ARG_WITH(mpi, [ --with-mpi=DIR compile to use MPI ], MPIDIR=$withval, with_mpi=no)
AC_ARG_WITH(tomcrypt, [ --with-tomcrypt=DIR compile to use libtomcrypt ], TOMCRYPTDIR=$withval, with_tomcrypt=no)
AC_ARG_WITH(tommath, [ --with-tommath=DIR compile to use libtommath ], TOMMATHDIR=$withval, with_tommath=no)
if test "$with_gmp" != "no"
then
AC_DEFINE(GNU_MP)
LIBS="-lgmp $LIBS"
if test "$GMPDIR" != "yes"; then
LIBS="-L$GMPDIR/.libs -L$GMPDIR $LIBS"
CPPFLAGS="-I$GMPDIR $CPPFLAGS"
fi
elif test "$with_gcrypt" != "no"
then
AC_DEFINE(GCRYPT)
LIBS="-lgcrypt $LIBS"
if test "$GCRYPTDIR" != "yes"; then
LIBS="-L$GCRYPTDIR/src/.libs -L$GCRYPTDIR $LIBS"
CPPFLAGS="-I$GCRYPTDIR $CPPFLAGS"
fi
elif test "$with_mpi" != "no"
then
AC_DEFINE(MPI)
LIBS="-lmpi $LIBS"
if test "$MPIDIR" != "yes"; then
LIBS="-L$MPIDIR $LIBS"
CPPFLAGS="-I$MPIDIR $CPPFLAGS"
fi
elif test "$with_tomcrypt" != "no"
then
AC_DEFINE(TOMCRYPT)
AC_DEFINE(TOMMATH)
LIBS="-ltomcrypt $LIBS"
if test "$TOMCRYPTDIR" != "yes"; then
LIBS="-L$TOMCRYPTDIR $LIBS"
CPPFLAGS="-I$TOMCRYPTDIR/src/headers $CPPFLAGS"
fi
elif test "$with_tommath" != "no"
then
AC_DEFINE(TOMMATH)
LIBS="-ltommath $LIBS"
if test "$TOMMATHDIR" != "yes"; then
LIBS="-L$TOMMATHDIR $LIBS"
CPPFLAGS="-I$TOMMATHDIR $CPPFLAGS"
fi
elif test "$with_cryptolib" != "no"
then
AC_DEFINE(CRYPTOLIB)
LIBS="-lcrypt $LIBS"
if test "$CRYPTOLIBDIR" != "yes"; then
LIBS="-L$CRYPTOLIBDIR/cryptolib/lib $LIBS"
CPPFLAGS="-I$CRYPTOLIBDIR/cryptolib/include $CPPFLAGS"
fi
else
AC_DEFINE(OPENSSL)
LIBS="-lcrypto $LIBS"
if test -n "$OPENSSLDIR" -a "$OPENSSLDIR" != "yes"; then
LIBS="-L$OPENSSLDIR/lib -L$OPENSSLDIR $LIBS"
CPPFLAGS="-I$OPENSSLDIR/include $CPPFLAGS"
fi
fi
AC_ARG_WITH(engine, [ --with-engine compile with ENGINE support in OpenSSL ], AC_DEFINE(OPENSSL_ENGINE))
AC_ARG_WITH(nis, [ --with-nis compile with NIS/YP support])
if test "$with_nis" = "yes"
then
AC_DEFINE(ENABLE_YP)
fi
dnl Some platforms want PIC-compiled libsrp in a PAM module
AC_SUBST(PICFLAG)
AC_SUBST(SHAREDFLAG)
if test "$GCC" = "yes"
then
PICFLAG="-fPIC"
SHAREDFLAG="--shared"
else
dnl TODO: let user specify PICFLAG...
PICFLAG=""
SHAREDFLAG="-G"
fi
dnl Some defines for now.
AC_DEFINE(HIGHFIRST)
AC_DEFINE(SHA1HANDSOFF)
AC_OUTPUT(Makefile)