| 1 | dnl -*- mode: m4; -*- |
|---|
| 2 | dnl Process this file with autoconf to produce a configure script. |
|---|
| 3 | dnl $Id$ |
|---|
| 4 | |
|---|
| 5 | # Require autoconf 2.52 |
|---|
| 6 | AC_PREREQ(2.52) |
|---|
| 7 | |
|---|
| 8 | AC_INIT(src/libopensc/sc.c) |
|---|
| 9 | AM_INIT_AUTOMAKE(opensc, 0.4.0) |
|---|
| 10 | AM_CONFIG_HEADER(config.h) |
|---|
| 11 | |
|---|
| 12 | AC_CANONICAL_HOST |
|---|
| 13 | case $host in |
|---|
| 14 | darwin* | rhapsody*) |
|---|
| 15 | AC_DEFINE(OS_MACOSX,1,[MacOS X]) |
|---|
| 16 | ;; |
|---|
| 17 | beos*) |
|---|
| 18 | AC_DEFINE(OS_BEOS,1,[BeOS]) |
|---|
| 19 | ;; |
|---|
| 20 | cygwin* | mingw* | pw32*) |
|---|
| 21 | AC_DEFINE(OS_CYGWIN,1,[Cywin32 and friends]) |
|---|
| 22 | ;; |
|---|
| 23 | *irix*) |
|---|
| 24 | AC_DEFINE(OS_IRIX,1,[SGI IRIX]) |
|---|
| 25 | ;; |
|---|
| 26 | *hpux*) |
|---|
| 27 | AC_DEFINE(OS_HPUX,1,[HP-UX]) |
|---|
| 28 | ;; |
|---|
| 29 | *solaris* | *sunos*) |
|---|
| 30 | AC_DEFINE(OS_SOLARIS,1,[Sun Solaris]) |
|---|
| 31 | ;; |
|---|
| 32 | *osf*) |
|---|
| 33 | AC_DEFINE(OS_DUNIX,1,[Digital UNIX]) |
|---|
| 34 | ;; |
|---|
| 35 | *aix*) |
|---|
| 36 | AC_DEFINE(OS_AIX,1,[IBM AIX]) |
|---|
| 37 | ;; |
|---|
| 38 | *freebsd*) |
|---|
| 39 | AC_DEFINE(OS_FREEBSD,1,[FreeBSD]) |
|---|
| 40 | ;; |
|---|
| 41 | *netbsd*) |
|---|
| 42 | AC_DEFINE(OS_NETBSD,1,[NetBSD]) |
|---|
| 43 | ;; |
|---|
| 44 | *openbsd*) |
|---|
| 45 | AC_DEFINE(OS_OPENBSD,1,[OpenBSD]) |
|---|
| 46 | ;; |
|---|
| 47 | *linux*) |
|---|
| 48 | AC_DEFINE(OS_LINUX,1,[Linux]) |
|---|
| 49 | ;; |
|---|
| 50 | esac |
|---|
| 51 | AC_PROG_CC |
|---|
| 52 | AC_C_BIGENDIAN |
|---|
| 53 | |
|---|
| 54 | dnl Check for some target-specific stuff |
|---|
| 55 | case "$host" in |
|---|
| 56 | *-*-hpux*) |
|---|
| 57 | CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE" |
|---|
| 58 | AC_DEFINE(PAM_SUN_CODEBASE, 1, [PAM based on SUN codebase]) |
|---|
| 59 | ;; |
|---|
| 60 | *-*-solaris*) |
|---|
| 61 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" |
|---|
| 62 | LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib" |
|---|
| 63 | need_dash_r=1 |
|---|
| 64 | AC_DEFINE(PAM_SUN_CODEBASE, 1, [PAM based on SUN codebase]) |
|---|
| 65 | ;; |
|---|
| 66 | *-*-sunos4*) |
|---|
| 67 | CPPFLAGS="$CPPFLAGS -DSUNOS4" |
|---|
| 68 | AC_CHECK_FUNCS(getpwanam) |
|---|
| 69 | AC_DEFINE(PAM_SUN_CODEBASE, 1, [PAM based on SUN codebase]) |
|---|
| 70 | ;; |
|---|
| 71 | *-*-aix*) |
|---|
| 72 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" |
|---|
| 73 | LDFLAGS="$LDFLAGS -L/usr/local/lib" |
|---|
| 74 | if (test "$LD" != "gcc" && test -z "$blibpath"); then |
|---|
| 75 | blibpath="/usr/lib:/lib:/usr/local/lib" |
|---|
| 76 | fi |
|---|
| 77 | ;; |
|---|
| 78 | *-*-linux*) |
|---|
| 79 | ;; |
|---|
| 80 | esac |
|---|
| 81 | |
|---|
| 82 | dnl Allow user to specify flags |
|---|
| 83 | AC_ARG_WITH(cflags, |
|---|
| 84 | [ --with-cflags Specify additional flags to pass to compiler], |
|---|
| 85 | [ |
|---|
| 86 | if test "x$withval" != "xno" ; then |
|---|
| 87 | CFLAGS="$CFLAGS $withval" |
|---|
| 88 | fi |
|---|
| 89 | ] |
|---|
| 90 | ) |
|---|
| 91 | AC_ARG_WITH(cppflags, |
|---|
| 92 | [ --with-cppflags Specify additional flags to pass to preprocessor] , |
|---|
| 93 | [ |
|---|
| 94 | if test "x$withval" != "xno"; then |
|---|
| 95 | CPPFLAGS="$CPPFLAGS $withval" |
|---|
| 96 | fi |
|---|
| 97 | ] |
|---|
| 98 | ) |
|---|
| 99 | AC_ARG_WITH(ldflags, |
|---|
| 100 | [ --with-ldflags Specify additional flags to pass to linker], |
|---|
| 101 | [ |
|---|
| 102 | if test "x$withval" != "xno" ; then |
|---|
| 103 | LDFLAGS="$LDFLAGS $withval" |
|---|
| 104 | fi |
|---|
| 105 | ] |
|---|
| 106 | ) |
|---|
| 107 | AC_ARG_WITH(libs, |
|---|
| 108 | [ --with-libs Specify additional libraries to link with], |
|---|
| 109 | [ |
|---|
| 110 | if test "x$withval" != "xno" ; then |
|---|
| 111 | LIBS="$LIBS $withval" |
|---|
| 112 | fi |
|---|
| 113 | ] |
|---|
| 114 | ) |
|---|
| 115 | |
|---|
| 116 | dnl Checks for programs. |
|---|
| 117 | AC_PROG_CPP |
|---|
| 118 | AC_PROG_INSTALL |
|---|
| 119 | AC_PROG_LN_S |
|---|
| 120 | AC_PROG_MAKE_SET |
|---|
| 121 | |
|---|
| 122 | dnl Special check for pthread support. |
|---|
| 123 | ACX_PTHREAD( |
|---|
| 124 | [ |
|---|
| 125 | AC_DEFINE(HAVE_PTHREAD,1, |
|---|
| 126 | [Define if you have POSIX threads libraries and header files.]) |
|---|
| 127 | ], [ |
|---|
| 128 | AC_MSG_ERROR([POSIX thread support required]) |
|---|
| 129 | ]) |
|---|
| 130 | LIBS="$PTHREAD_LIBS $LIBS" |
|---|
| 131 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
|---|
| 132 | CC="$PTHREAD_CC" |
|---|
| 133 | |
|---|
| 134 | dnl Add libtool support. |
|---|
| 135 | AM_PROG_LIBTOOL |
|---|
| 136 | dnl Automatically update the libtool script if it becomes out-of-date. |
|---|
| 137 | #AC_SUBST(LIBTOOL_DEPS) |
|---|
| 138 | |
|---|
| 139 | dnl Checks for header files. |
|---|
| 140 | AC_HEADER_STDC |
|---|
| 141 | AC_CHECK_HEADERS([errno.h fcntl.h malloc.h stdlib.h string.h sys/time.h unistd.h syslog.h getopt.h security/pam_appl.h security/_pam_macros.h]) |
|---|
| 142 | |
|---|
| 143 | dnl Checks for typedefs, structures, and compiler characteristics. |
|---|
| 144 | AC_C_CONST |
|---|
| 145 | AC_TYPE_SIZE_T |
|---|
| 146 | AC_HEADER_TIME |
|---|
| 147 | |
|---|
| 148 | dnl Checks for library functions. |
|---|
| 149 | AC_FUNC_ERROR_AT_LINE |
|---|
| 150 | AC_FUNC_MALLOC |
|---|
| 151 | AC_FUNC_MEMCMP |
|---|
| 152 | AC_FUNC_STAT |
|---|
| 153 | AC_FUNC_VPRINTF |
|---|
| 154 | AC_CHECK_FUNCS([getpass gettimeofday memset mkdir strdup strerror]) |
|---|
| 155 | |
|---|
| 156 | dnl C Compiler features |
|---|
| 157 | AC_C_INLINE |
|---|
| 158 | if test "$GCC" = "yes"; then |
|---|
| 159 | CFLAGS="$CFLAGS -Wall -Werror" |
|---|
| 160 | fi |
|---|
| 161 | |
|---|
| 162 | dnl OS specific options |
|---|
| 163 | case "$host_os" in |
|---|
| 164 | hpux*) |
|---|
| 165 | CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" |
|---|
| 166 | ;; |
|---|
| 167 | osf*) |
|---|
| 168 | CFLAGS="$CFLAGS -D_POSIX_PII_SOCKET" |
|---|
| 169 | ;; |
|---|
| 170 | *) |
|---|
| 171 | ;; |
|---|
| 172 | esac |
|---|
| 173 | |
|---|
| 174 | AC_ARG_WITH(common-dir, |
|---|
| 175 | [ --with-common-dir=PATH Specify path for common installation libraries], |
|---|
| 176 | [ |
|---|
| 177 | if test "x$withval" != "xno" ; then |
|---|
| 178 | trycommondir=$withval |
|---|
| 179 | fi |
|---|
| 180 | ] |
|---|
| 181 | ) |
|---|
| 182 | |
|---|
| 183 | saved_LDFLAGS="$LDFLAGS" |
|---|
| 184 | saved_CPPFLAGS="$CPPFLAGS" |
|---|
| 185 | AC_CACHE_CHECK([for common directory], ac_cv_commondir, [ |
|---|
| 186 | for commondir in $trycommondir "" /usr/local /usr/pkg /opt ; do |
|---|
| 187 | # Skip directories if they don't exist |
|---|
| 188 | if test ! -z "$commondir" -a ! -d "$commondir" ; then |
|---|
| 189 | continue; |
|---|
| 190 | fi |
|---|
| 191 | CPPFLAGS="$saved_CPPFLAGS" |
|---|
| 192 | LDFLAGS="$saved_LDFLAGS" |
|---|
| 193 | |
|---|
| 194 | if test ! -z "$commondir" -a "x$commondir" != "x/usr"; then |
|---|
| 195 | # Try to use $commondir/lib if it exists, otherwise |
|---|
| 196 | # $commondir |
|---|
| 197 | if test -d "$commondir/lib" ; then |
|---|
| 198 | LDFLAGS="-L$commondir/lib $saved_LDFLAGS" |
|---|
| 199 | if test ! -z "$need_dash_r" ; then |
|---|
| 200 | LDFLAGS="-R$commondir/lib $LDFLAGS" |
|---|
| 201 | fi |
|---|
| 202 | else |
|---|
| 203 | LDFLAGS="-L$commondir $saved_LDFLAGS" |
|---|
| 204 | if test ! -z "$need_dash_r" ; then |
|---|
| 205 | LDFLAGS="-R$commondir $LDFLAGS" |
|---|
| 206 | fi |
|---|
| 207 | fi |
|---|
| 208 | # Try to use $commondir/include if it exists, otherwise |
|---|
| 209 | # $commondir |
|---|
| 210 | if test -d "$commondir/include" ; then |
|---|
| 211 | CPPFLAGS="-I$commondir/include $saved_CPPFLAGS" |
|---|
| 212 | else |
|---|
| 213 | CPPFLAGS="-I$commondir $saved_CPPFLAGS" |
|---|
| 214 | fi |
|---|
| 215 | fi |
|---|
| 216 | break; |
|---|
| 217 | done |
|---|
| 218 | |
|---|
| 219 | if test -z "$commondir" ; then |
|---|
| 220 | commondir="(system)" |
|---|
| 221 | fi |
|---|
| 222 | |
|---|
| 223 | ac_cv_commondir=$commondir |
|---|
| 224 | ]) |
|---|
| 225 | |
|---|
| 226 | if (test ! -z "$ac_cv_commondir" && test "x$ac_cv_commondir" != "x(system)") ; then |
|---|
| 227 | dnl Need to recover commondir - test above runs in subshell |
|---|
| 228 | commondir=$ac_cv_commondir |
|---|
| 229 | if test ! -z "$commondir" -a "x$commondir" != "x/usr"; then |
|---|
| 230 | # Try to use $commondir/lib if it exists, otherwise |
|---|
| 231 | # $commondir |
|---|
| 232 | if test -d "$commondir/lib" ; then |
|---|
| 233 | LDFLAGS="-L$commondir/lib $saved_LDFLAGS" |
|---|
| 234 | if test ! -z "$need_dash_r" ; then |
|---|
| 235 | LDFLAGS="-R$commondir/lib $LDFLAGS" |
|---|
| 236 | fi |
|---|
| 237 | else |
|---|
| 238 | LDFLAGS="-L$commondir $saved_LDFLAGS" |
|---|
| 239 | if test ! -z "$need_dash_r" ; then |
|---|
| 240 | LDFLAGS="-R$commondir $LDFLAGS" |
|---|
| 241 | fi |
|---|
| 242 | fi |
|---|
| 243 | # Try to use $commondir/include if it exists, otherwise |
|---|
| 244 | # $commondir |
|---|
| 245 | if test -d "$commondir/include" ; then |
|---|
| 246 | CPPFLAGS="-I$commondir/include $saved_CPPFLAGS" |
|---|
| 247 | else |
|---|
| 248 | CPPFLAGS="-I$commondir $saved_CPPFLAGS" |
|---|
| 249 | fi |
|---|
| 250 | fi |
|---|
| 251 | fi |
|---|
| 252 | |
|---|
| 253 | AC_SUBST(LIBPCSC) |
|---|
| 254 | LIBPCSC="-lpcsclite" |
|---|
| 255 | found_pcsclite=no |
|---|
| 256 | saved_LIBS="$LIBS" |
|---|
| 257 | saved_LDFLAGS="$LDFLAGS" |
|---|
| 258 | saved_CPPFLAGS="$CPPFLAGS" |
|---|
| 259 | AC_ARG_WITH(pcsclite, |
|---|
| 260 | [ --with-pcsclite=PATH use PC/SC Lite in PATH], |
|---|
| 261 | [ |
|---|
| 262 | for pcscdir in /pcsc ""; do |
|---|
| 263 | CPPFLAGS="$saved_CPPFLAGS" |
|---|
| 264 | LDFLAGS="$saved_LDFLAGS" |
|---|
| 265 | LIBS="$saved_LIBS" |
|---|
| 266 | |
|---|
| 267 | if test -d "$withval/lib$pcscdir"; then |
|---|
| 268 | if test -n "${need_dash_r}"; then |
|---|
| 269 | LDFLAGS="-L${withval}/lib${pcscdir}/ -R${withval}/lib${pcscdir}/ ${LDFLAGS}" |
|---|
| 270 | else |
|---|
| 271 | LDFLAGS="-L${withval}/lib${pcscdir} ${LDFLAGS}" |
|---|
| 272 | fi |
|---|
| 273 | else |
|---|
| 274 | if test -n "${need_dash_r}"; then |
|---|
| 275 | LDFLAGS="-L${withval}${pcscdir} -R${withval}${pcscdir} ${LDFLAGS}" |
|---|
| 276 | else |
|---|
| 277 | LDFLAGS="-L${withval}${pcscdir} ${LDFLAGS}" |
|---|
| 278 | fi |
|---|
| 279 | fi |
|---|
| 280 | if test -d "$withval/include"; then |
|---|
| 281 | CPPFLAGS="-I${withval}/include${pcscdir} ${CPPFLAGS}" |
|---|
| 282 | else |
|---|
| 283 | CPPFLAGS="-I${withval}${pcscdir} ${CPPFLAGS}" |
|---|
| 284 | fi |
|---|
| 285 | AC_CHECK_LIB(pcsclite, SCardEstablishContext, found_pcsclite=yes, found_pcsclite=no) |
|---|
| 286 | if test "x$found_pcsclite" = "xyes" ; then |
|---|
| 287 | break; |
|---|
| 288 | fi |
|---|
| 289 | done |
|---|
| 290 | ] |
|---|
| 291 | ) |
|---|
| 292 | if test "x$found_pcsclite" != "xyes" ; then |
|---|
| 293 | AC_CHECK_LIB(pcsclite, SCardEstablishContext, , AC_MSG_ERROR([*** PC/SC Lite missing - please install first])) |
|---|
| 294 | fi |
|---|
| 295 | LIBS="$saved_LIBS" |
|---|
| 296 | AM_CONDITIONAL(HAVE_PCSCLITE, test "x$found_pcsclite" = "xyes") |
|---|
| 297 | |
|---|
| 298 | AC_SUBST(LIBDL) |
|---|
| 299 | AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no) |
|---|
| 300 | |
|---|
| 301 | dnl The big search for OpenSSL |
|---|
| 302 | AC_ARG_WITH(ssl-dir, |
|---|
| 303 | [ --with-ssl-dir=PATH Specify path to OpenSSL installation], |
|---|
| 304 | [ |
|---|
| 305 | if test "x$withval" != "xno" ; then |
|---|
| 306 | tryssldir=$withval |
|---|
| 307 | fi |
|---|
| 308 | ] |
|---|
| 309 | ) |
|---|
| 310 | |
|---|
| 311 | SSL_MSG="no" |
|---|
| 312 | saved_LIBS="$LIBS" |
|---|
| 313 | saved_LDFLAGS="$LDFLAGS" |
|---|
| 314 | saved_CPPFLAGS="$CPPFLAGS" |
|---|
| 315 | AC_SUBST(LIBCRYPTO) |
|---|
| 316 | AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [ |
|---|
| 317 | for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do |
|---|
| 318 | # Skip directories if they don't exist |
|---|
| 319 | if test ! -z "$ssldir" -a ! -d "$ssldir" ; then |
|---|
| 320 | continue; |
|---|
| 321 | fi |
|---|
| 322 | LIBCRYPTO="-lcrypto" |
|---|
| 323 | CPPFLAGS="$saved_CPPFLAGS" |
|---|
| 324 | LDFLAGS="$saved_LDFLAGS" |
|---|
| 325 | LIBS="$saved_LIBS $LIBCRYPTO" |
|---|
| 326 | |
|---|
| 327 | if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then |
|---|
| 328 | # Try to use $ssldir/lib if it exists, otherwise |
|---|
| 329 | # $ssldir |
|---|
| 330 | if test -d "$ssldir/lib" ; then |
|---|
| 331 | LDFLAGS="-L$ssldir/lib $saved_LDFLAGS" |
|---|
| 332 | if test ! -z "$need_dash_r" ; then |
|---|
| 333 | LDFLAGS="-R$ssldir/lib $LDFLAGS" |
|---|
| 334 | fi |
|---|
| 335 | else |
|---|
| 336 | LDFLAGS="-L$ssldir $saved_LDFLAGS" |
|---|
| 337 | if test ! -z "$need_dash_r" ; then |
|---|
| 338 | LDFLAGS="-R$ssldir $LDFLAGS" |
|---|
| 339 | fi |
|---|
| 340 | fi |
|---|
| 341 | # Try to use $ssldir/include if it exists, otherwise |
|---|
| 342 | # $ssldir |
|---|
| 343 | if test -d "$ssldir/include" ; then |
|---|
| 344 | CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS" |
|---|
| 345 | else |
|---|
| 346 | CPPFLAGS="-I$ssldir $saved_CPPFLAGS" |
|---|
| 347 | fi |
|---|
| 348 | fi |
|---|
| 349 | |
|---|
| 350 | # Basic test to check for compatible version and correct linking |
|---|
| 351 | # *does not* test for RSA - that comes later. |
|---|
| 352 | AC_TRY_RUN( |
|---|
| 353 | [ |
|---|
| 354 | #include <string.h> |
|---|
| 355 | #include <openssl/rand.h> |
|---|
| 356 | int main(void) |
|---|
| 357 | { |
|---|
| 358 | char a[2048]; |
|---|
| 359 | memset(a, 0, sizeof(a)); |
|---|
| 360 | RAND_add(a, sizeof(a), sizeof(a)); |
|---|
| 361 | return(RAND_status() <= 0); |
|---|
| 362 | } |
|---|
| 363 | ], |
|---|
| 364 | [ |
|---|
| 365 | found_crypto=1 |
|---|
| 366 | break; |
|---|
| 367 | ], [] |
|---|
| 368 | ) |
|---|
| 369 | |
|---|
| 370 | if test ! -z "$found_crypto" ; then |
|---|
| 371 | break; |
|---|
| 372 | fi |
|---|
| 373 | done |
|---|
| 374 | |
|---|
| 375 | if test -n "$found_crypto" ; then |
|---|
| 376 | if test -z "$ssldir" ; then |
|---|
| 377 | ssldir="(system)" |
|---|
| 378 | fi |
|---|
| 379 | ac_cv_openssldir=$ssldir |
|---|
| 380 | SSL_MSG="yes" |
|---|
| 381 | fi |
|---|
| 382 | ]) |
|---|
| 383 | |
|---|
| 384 | if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then |
|---|
| 385 | AC_DEFINE(HAVE_OPENSSL, 1, [Have OpenSSL libraries]) |
|---|
| 386 | dnl Need to recover ssldir - test above runs in subshell |
|---|
| 387 | ssldir=$ac_cv_openssldir |
|---|
| 388 | if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then |
|---|
| 389 | # Try to use $ssldir/lib if it exists, otherwise |
|---|
| 390 | # $ssldir |
|---|
| 391 | if test -d "$ssldir/lib" ; then |
|---|
| 392 | LDFLAGS="-L$ssldir/lib $saved_LDFLAGS" |
|---|
| 393 | if test ! -z "$need_dash_r" ; then |
|---|
| 394 | LDFLAGS="-R$ssldir/lib $LDFLAGS" |
|---|
| 395 | fi |
|---|
| 396 | else |
|---|
| 397 | LDFLAGS="-L$ssldir $saved_LDFLAGS" |
|---|
| 398 | if test ! -z "$need_dash_r" ; then |
|---|
| 399 | LDFLAGS="-R$ssldir $LDFLAGS" |
|---|
| 400 | fi |
|---|
| 401 | fi |
|---|
| 402 | # Try to use $ssldir/include if it exists, otherwise |
|---|
| 403 | # $ssldir |
|---|
| 404 | if test -d "$ssldir/include" ; then |
|---|
| 405 | CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS" |
|---|
| 406 | else |
|---|
| 407 | CPPFLAGS="-I$ssldir $saved_CPPFLAGS" |
|---|
| 408 | fi |
|---|
| 409 | fi |
|---|
| 410 | fi |
|---|
| 411 | LIBS="$saved_LIBS" |
|---|
| 412 | AM_CONDITIONAL(HAVE_SSL, test "x$SSL_MSG" = "xyes") |
|---|
| 413 | |
|---|
| 414 | dnl Check for PAM libs |
|---|
| 415 | PAM_MSG="no" |
|---|
| 416 | no_pam="" |
|---|
| 417 | AC_SUBST(LIBPAM) |
|---|
| 418 | saved_LIBS="$LIBS" |
|---|
| 419 | AC_MSG_CHECKING([PAM support]) |
|---|
| 420 | AC_ARG_WITH(pam, |
|---|
| 421 | [ --with-pam Enable PAM support], |
|---|
| 422 | [ |
|---|
| 423 | if test "x$withval" = "xno" ; then |
|---|
| 424 | AC_MSG_RESULT(disabled) |
|---|
| 425 | no_pam=1 |
|---|
| 426 | fi |
|---|
| 427 | ], |
|---|
| 428 | ) |
|---|
| 429 | if test -z "$no_pam" ; then |
|---|
| 430 | if test "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then |
|---|
| 431 | AC_MSG_RESULT(yes) |
|---|
| 432 | PAM_MSG="yes" |
|---|
| 433 | AC_CHECK_LIB(pam, pam_set_item, [LIBPAM="$LIBPAM -lpam"], AC_MSG_ERROR([*** libpam missing])) |
|---|
| 434 | LIBS="$LIBS $LIBPAM" |
|---|
| 435 | AC_CHECK_FUNCS(pam_getenvlist) |
|---|
| 436 | AC_CHECK_FUNCS(pam_putenv) |
|---|
| 437 | disable_shadow=yes |
|---|
| 438 | AC_DEFINE(HAVE_PAM, 1, [Have Pluggable Authentication Modules]) |
|---|
| 439 | else |
|---|
| 440 | AC_MSG_RESULT(no) |
|---|
| 441 | fi |
|---|
| 442 | fi |
|---|
| 443 | |
|---|
| 444 | dnl Check for older PAM |
|---|
| 445 | if test "x$PAM_MSG" = "xyes" ; then |
|---|
| 446 | # Check PAM strerror arguments (old PAM) |
|---|
| 447 | AC_MSG_CHECKING([whether pam_strerror takes only one argument]) |
|---|
| 448 | AC_TRY_COMPILE( |
|---|
| 449 | [ |
|---|
| 450 | #include <stdlib.h> |
|---|
| 451 | #include <security/pam_appl.h> |
|---|
| 452 | ], |
|---|
| 453 | [(void)pam_strerror((pam_handle_t *)NULL, -1);], |
|---|
| 454 | [AC_MSG_RESULT(no)], |
|---|
| 455 | [ |
|---|
| 456 | AC_DEFINE(HAVE_OLD_PAM, 1, [Have OLD Pluggable Authentication Modules]) |
|---|
| 457 | AC_MSG_RESULT(yes) |
|---|
| 458 | PAM_MSG="yes (old library)" |
|---|
| 459 | ] |
|---|
| 460 | ) |
|---|
| 461 | fi |
|---|
| 462 | LIBS="$saved_LIBS" |
|---|
| 463 | AM_CONDITIONAL(HAVE_PAM, test "x$PAM_MSG" = "xyes") |
|---|
| 464 | AM_CONDITIONAL(HAVE_PAM_AND_SSL, test "x$PAM_MSG" = "xyes" -a "x$SSL_MSG" = "xyes") |
|---|
| 465 | |
|---|
| 466 | dnl Enable/disable debugging messages. |
|---|
| 467 | AC_ARG_ENABLE(debug, |
|---|
| 468 | [ --enable-debug enable debug messages. [default=no]], |
|---|
| 469 | , enable_debug=no) |
|---|
| 470 | if (test x$enable_debug = xyes); then |
|---|
| 471 | AC_DEFINE(DEBUG, 1, [Enable debug messages.]) |
|---|
| 472 | fi |
|---|
| 473 | |
|---|
| 474 | AC_OUTPUT([ |
|---|
| 475 | Makefile |
|---|
| 476 | aclocal/Makefile |
|---|
| 477 | src/Makefile |
|---|
| 478 | src/libopensc/Makefile |
|---|
| 479 | src/openssh/Makefile |
|---|
| 480 | src/pam/Makefile |
|---|
| 481 | src/pkcs11/Makefile |
|---|
| 482 | src/pkcs11/pkcs11/Makefile |
|---|
| 483 | src/tests/Makefile |
|---|
| 484 | src/tools/Makefile |
|---|
| 485 | ]) |
|---|
| 486 | |
|---|
| 487 | dnl Someone please show me a better way :) |
|---|
| 488 | A=`eval echo ${prefix}` ; A=`eval echo ${A}` |
|---|
| 489 | B=`eval echo ${bindir}` ; B=`eval echo ${B}` |
|---|
| 490 | |
|---|
| 491 | echo "" |
|---|
| 492 | echo "OpenSC has been configured with the following options" |
|---|
| 493 | |
|---|
| 494 | echo "" |
|---|
| 495 | echo "User binaries: ${B}" |
|---|
| 496 | |
|---|
| 497 | echo "" |
|---|
| 498 | echo "Host: ${host}" |
|---|
| 499 | echo "Compiler: ${CC}" |
|---|
| 500 | echo "Compiler flags: ${CFLAGS}" |
|---|
| 501 | echo "Preprocessor flags: ${CPPFLAGS}" |
|---|
| 502 | echo "Linker flags: ${LDFLAGS}" |
|---|
| 503 | echo "Libraries: ${LIBS}" |
|---|
| 504 | |
|---|
| 505 | echo "" |
|---|
| 506 | echo "OpenSSL support: ${SSL_MSG}" |
|---|
| 507 | echo "PAM support: ${PAM_MSG}" |
|---|
| 508 | |
|---|
| 509 | echo "" |
|---|