| 1 | dnl -*- mode: m4; -*- |
|---|
| 2 | dnl Process this file with autoconf to produce a configure script. |
|---|
| 3 | |
|---|
| 4 | # Require autoconf 2.52 |
|---|
| 5 | AC_PREREQ(2.52) |
|---|
| 6 | |
|---|
| 7 | AC_INIT(src/libopensc/sc.c) |
|---|
| 8 | AM_INIT_AUTOMAKE(opensc, 0.7.0) |
|---|
| 9 | AM_CONFIG_HEADER(config.h) |
|---|
| 10 | |
|---|
| 11 | AC_CANONICAL_HOST |
|---|
| 12 | case $host in |
|---|
| 13 | darwin* | rhapsody*) |
|---|
| 14 | AC_DEFINE(OS_MACOSX,1,[MacOS X]) |
|---|
| 15 | ;; |
|---|
| 16 | beos*) |
|---|
| 17 | AC_DEFINE(OS_BEOS,1,[BeOS]) |
|---|
| 18 | ;; |
|---|
| 19 | cygwin* | mingw* | pw32*) |
|---|
| 20 | AC_DEFINE(OS_CYGWIN32,1,[Cywin32 and friends]) |
|---|
| 21 | ;; |
|---|
| 22 | *irix*) |
|---|
| 23 | AC_DEFINE(OS_IRIX,1,[SGI IRIX]) |
|---|
| 24 | ;; |
|---|
| 25 | *hpux*) |
|---|
| 26 | AC_DEFINE(OS_HPUX,1,[HP-UX]) |
|---|
| 27 | ;; |
|---|
| 28 | *solaris* | *sunos*) |
|---|
| 29 | AC_DEFINE(OS_SOLARIS,1,[Sun Solaris]) |
|---|
| 30 | ;; |
|---|
| 31 | *osf*) |
|---|
| 32 | AC_DEFINE(OS_DIGITAL_UNIX,1,[Digital UNIX]) |
|---|
| 33 | ;; |
|---|
| 34 | *aix*) |
|---|
| 35 | AC_DEFINE(OS_AIX,1,[IBM AIX]) |
|---|
| 36 | ;; |
|---|
| 37 | *freebsd*) |
|---|
| 38 | AC_DEFINE(OS_FREEBSD,1,[FreeBSD]) |
|---|
| 39 | ;; |
|---|
| 40 | *netbsd*) |
|---|
| 41 | AC_DEFINE(OS_NETBSD,1,[NetBSD]) |
|---|
| 42 | ;; |
|---|
| 43 | *openbsd*) |
|---|
| 44 | AC_DEFINE(OS_OPENBSD,1,[OpenBSD]) |
|---|
| 45 | ;; |
|---|
| 46 | *linux*) |
|---|
| 47 | AC_DEFINE(OS_LINUX,1,[Linux]) |
|---|
| 48 | ;; |
|---|
| 49 | esac |
|---|
| 50 | AC_PROG_CC |
|---|
| 51 | AC_C_BIGENDIAN |
|---|
| 52 | |
|---|
| 53 | dnl Check for some target-specific stuff |
|---|
| 54 | case "$host" in |
|---|
| 55 | *-*-hpux*) |
|---|
| 56 | CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE" |
|---|
| 57 | AC_DEFINE(PAM_SUN_CODEBASE, 1, [PAM based on SUN codebase]) |
|---|
| 58 | ;; |
|---|
| 59 | *-*-solaris*) |
|---|
| 60 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" |
|---|
| 61 | LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib" |
|---|
| 62 | need_dash_r=1 |
|---|
| 63 | AC_DEFINE(PAM_SUN_CODEBASE, 1, [PAM based on SUN codebase]) |
|---|
| 64 | ;; |
|---|
| 65 | *-*-sunos4*) |
|---|
| 66 | CPPFLAGS="$CPPFLAGS -DSUNOS4" |
|---|
| 67 | AC_CHECK_FUNCS(getpwanam) |
|---|
| 68 | AC_DEFINE(PAM_SUN_CODEBASE, 1, [PAM based on SUN codebase]) |
|---|
| 69 | ;; |
|---|
| 70 | *-*-aix*) |
|---|
| 71 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" |
|---|
| 72 | LDFLAGS="$LDFLAGS -L/usr/local/lib" |
|---|
| 73 | if (test "$LD" != "gcc" && test -z "$blibpath"); then |
|---|
| 74 | blibpath="/usr/lib:/lib:/usr/local/lib" |
|---|
| 75 | fi |
|---|
| 76 | ;; |
|---|
| 77 | esac |
|---|
| 78 | |
|---|
| 79 | dnl Allow user to specify flags |
|---|
| 80 | AC_ARG_WITH(cflags, |
|---|
| 81 | [ --with-cflags Specify additional flags to pass to compiler], |
|---|
| 82 | [ |
|---|
| 83 | if test "x$withval" != "xno" ; then |
|---|
| 84 | CFLAGS="$CFLAGS $withval" |
|---|
| 85 | fi |
|---|
| 86 | ] |
|---|
| 87 | ) |
|---|
| 88 | AC_ARG_WITH(cppflags, |
|---|
| 89 | [ --with-cppflags Specify additional flags to pass to preprocessor] , |
|---|
| 90 | [ |
|---|
| 91 | if test "x$withval" != "xno"; then |
|---|
| 92 | CPPFLAGS="$CPPFLAGS $withval" |
|---|
| 93 | fi |
|---|
| 94 | ] |
|---|
| 95 | ) |
|---|
| 96 | AC_ARG_WITH(ldflags, |
|---|
| 97 | [ --with-ldflags Specify additional flags to pass to linker], |
|---|
| 98 | [ |
|---|
| 99 | if test "x$withval" != "xno" ; then |
|---|
| 100 | LDFLAGS="$LDFLAGS $withval" |
|---|
| 101 | fi |
|---|
| 102 | ] |
|---|
| 103 | ) |
|---|
| 104 | AC_ARG_WITH(libs, |
|---|
| 105 | [ --with-libs Specify additional libraries to link with], |
|---|
| 106 | [ |
|---|
| 107 | if test "x$withval" != "xno" ; then |
|---|
| 108 | LIBS="$LIBS $withval" |
|---|
| 109 | fi |
|---|
| 110 | ] |
|---|
| 111 | ) |
|---|
| 112 | |
|---|
| 113 | AC_ARG_WITH(common-dir, |
|---|
| 114 | [ --with-common-dir=PATH Specify path for common installation libraries], |
|---|
| 115 | [ |
|---|
| 116 | if test "x$withval" != "xno" ; then |
|---|
| 117 | trycommondir=$withval |
|---|
| 118 | fi |
|---|
| 119 | ] |
|---|
| 120 | ) |
|---|
| 121 | |
|---|
| 122 | saved_LDFLAGS="$LDFLAGS" |
|---|
| 123 | saved_CPPFLAGS="$CPPFLAGS" |
|---|
| 124 | AC_CACHE_CHECK([for common directory], ac_cv_commondir, [ |
|---|
| 125 | for commondir in $trycommondir "" /usr/local /usr/pkg /opt ; do |
|---|
| 126 | # Skip directories if they don't exist |
|---|
| 127 | if test ! -z "$commondir" -a ! -d "$commondir" ; then |
|---|
| 128 | continue; |
|---|
| 129 | fi |
|---|
| 130 | CPPFLAGS="$saved_CPPFLAGS" |
|---|
| 131 | LDFLAGS="$saved_LDFLAGS" |
|---|
| 132 | |
|---|
| 133 | if test ! -z "$commondir" -a "x$commondir" != "x/usr"; then |
|---|
| 134 | # Try to use $commondir/lib if it exists, otherwise |
|---|
| 135 | # $commondir |
|---|
| 136 | if test -d "$commondir/lib" ; then |
|---|
| 137 | LDFLAGS="-L$commondir/lib $saved_LDFLAGS" |
|---|
| 138 | if test ! -z "$need_dash_r" ; then |
|---|
| 139 | LDFLAGS="-R$commondir/lib $LDFLAGS" |
|---|
| 140 | fi |
|---|
| 141 | else |
|---|
| 142 | LDFLAGS="-L$commondir $saved_LDFLAGS" |
|---|
| 143 | if test ! -z "$need_dash_r" ; then |
|---|
| 144 | LDFLAGS="-R$commondir $LDFLAGS" |
|---|
| 145 | fi |
|---|
| 146 | fi |
|---|
| 147 | # Try to use $commondir/include if it exists, otherwise |
|---|
| 148 | # $commondir |
|---|
| 149 | if test -d "$commondir/include" ; then |
|---|
| 150 | CPPFLAGS="-I$commondir/include $saved_CPPFLAGS" |
|---|
| 151 | else |
|---|
| 152 | CPPFLAGS="-I$commondir $saved_CPPFLAGS" |
|---|
| 153 | fi |
|---|
| 154 | fi |
|---|
| 155 | break; |
|---|
| 156 | done |
|---|
| 157 | |
|---|
| 158 | if test -z "$commondir" ; then |
|---|
| 159 | commondir="(system)" |
|---|
| 160 | fi |
|---|
| 161 | |
|---|
| 162 | ac_cv_commondir=$commondir |
|---|
| 163 | ]) |
|---|
| 164 | |
|---|
| 165 | if (test ! -z "$ac_cv_commondir" && test "x$ac_cv_commondir" != "x(system)") ; then |
|---|
| 166 | dnl Need to recover commondir - test above runs in subshell |
|---|
| 167 | commondir=$ac_cv_commondir |
|---|
| 168 | if test ! -z "$commondir" -a "x$commondir" != "x/usr"; then |
|---|
| 169 | # Try to use $commondir/lib if it exists, otherwise |
|---|
| 170 | # $commondir |
|---|
| 171 | if test -d "$commondir/lib" ; then |
|---|
| 172 | LDFLAGS="-L$commondir/lib $saved_LDFLAGS" |
|---|
| 173 | if test ! -z "$need_dash_r" ; then |
|---|
| 174 | LDFLAGS="-R$commondir/lib $LDFLAGS" |
|---|
| 175 | fi |
|---|
| 176 | else |
|---|
| 177 | LDFLAGS="-L$commondir $saved_LDFLAGS" |
|---|
| 178 | if test ! -z "$need_dash_r" ; then |
|---|
| 179 | LDFLAGS="-R$commondir $LDFLAGS" |
|---|
| 180 | fi |
|---|
| 181 | fi |
|---|
| 182 | # Try to use $commondir/include if it exists, otherwise |
|---|
| 183 | # $commondir |
|---|
| 184 | if test -d "$commondir/include" ; then |
|---|
| 185 | CPPFLAGS="-I$commondir/include $saved_CPPFLAGS" |
|---|
| 186 | else |
|---|
| 187 | CPPFLAGS="-I$commondir $saved_CPPFLAGS" |
|---|
| 188 | fi |
|---|
| 189 | fi |
|---|
| 190 | fi |
|---|
| 191 | |
|---|
| 192 | dnl Checks for programs. |
|---|
| 193 | AC_PROG_CPP |
|---|
| 194 | AC_PROG_INSTALL |
|---|
| 195 | AC_PROG_LN_S |
|---|
| 196 | AC_PROG_MAKE_SET |
|---|
| 197 | AM_PROG_LEX |
|---|
| 198 | AC_PATH_PROG(TEST_MINUS_S_SH, bash) |
|---|
| 199 | AC_PATH_PROG(TEST_MINUS_S_SH, ksh) |
|---|
| 200 | AC_PATH_PROG(TEST_MINUS_S_SH, sh) |
|---|
| 201 | |
|---|
| 202 | dnl Special check for pthread support. |
|---|
| 203 | ACX_PTHREAD( |
|---|
| 204 | [ |
|---|
| 205 | AC_DEFINE(HAVE_PTHREAD,1, |
|---|
| 206 | [Define if you have POSIX threads libraries and header files.]) |
|---|
| 207 | ], [ |
|---|
| 208 | AC_MSG_ERROR([POSIX thread support required]) |
|---|
| 209 | ]) |
|---|
| 210 | LIBS="$PTHREAD_LIBS $LIBS" |
|---|
| 211 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
|---|
| 212 | CC="$PTHREAD_CC" |
|---|
| 213 | |
|---|
| 214 | dnl Add libtool support. |
|---|
| 215 | AM_PROG_LIBTOOL |
|---|
| 216 | dnl Automatically update the libtool script if it becomes out-of-date. |
|---|
| 217 | #AC_SUBST(LIBTOOL_DEPS) |
|---|
| 218 | |
|---|
| 219 | dnl Checks for header files. |
|---|
| 220 | AC_HEADER_STDC |
|---|
| 221 | AC_HEADER_SYS_WAIT |
|---|
| 222 | AC_CHECK_HEADERS([errno.h fcntl.h malloc.h stdlib.h string.h sys/time.h unistd.h libgen.h utmp.h getopt.h dlfcn.h security/pam_appl.h security/_pam_macros.h]) |
|---|
| 223 | |
|---|
| 224 | dnl Checks for typedefs, structures, and compiler characteristics. |
|---|
| 225 | AC_C_CONST |
|---|
| 226 | AC_TYPE_UID_T |
|---|
| 227 | AC_TYPE_SIZE_T |
|---|
| 228 | AC_HEADER_TIME |
|---|
| 229 | |
|---|
| 230 | AC_SUBST(GETOPTSRC) |
|---|
| 231 | AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define if you have the `getopt_long' function.]), |
|---|
| 232 | [GETOPTSRC="$GETOPTSRC \$(top_srcdir)/src/common/getopt.c \$(top_srcdir)/src/common/getopt1.c" |
|---|
| 233 | CPPFLAGS="-I\$(top_srcdir)/src/common $CPPFLAGS" |
|---|
| 234 | AC_DEFINE(HAVE_GETOPT_H, 1, [Define if you have the <getopt.h> header file.])]) |
|---|
| 235 | |
|---|
| 236 | dnl Checks for library functions. |
|---|
| 237 | AC_FUNC_ERROR_AT_LINE |
|---|
| 238 | AC_FUNC_MALLOC |
|---|
| 239 | AC_FUNC_MEMCMP |
|---|
| 240 | AC_FUNC_STAT |
|---|
| 241 | AC_FUNC_VPRINTF |
|---|
| 242 | AC_CHECK_FUNCS([getpass gettimeofday memset mkdir strdup strerror setutent]) |
|---|
| 243 | |
|---|
| 244 | dnl C Compiler features |
|---|
| 245 | AC_C_INLINE |
|---|
| 246 | if test "$GCC" = "yes"; then |
|---|
| 247 | CFLAGS="-Wall $CFLAGS" |
|---|
| 248 | # Disabled until lex-parse.l doesn't give us a warning |
|---|
| 249 | # -Werror |
|---|
| 250 | fi |
|---|
| 251 | |
|---|
| 252 | dnl OS specific options |
|---|
| 253 | case "$host_os" in |
|---|
| 254 | hpux*) |
|---|
| 255 | CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" |
|---|
| 256 | ;; |
|---|
| 257 | osf*) |
|---|
| 258 | CFLAGS="$CFLAGS -D_POSIX_PII_SOCKET" |
|---|
| 259 | ;; |
|---|
| 260 | *) |
|---|
| 261 | ;; |
|---|
| 262 | esac |
|---|
| 263 | |
|---|
| 264 | AC_SUBST(LIBDL) |
|---|
| 265 | AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no) |
|---|
| 266 | |
|---|
| 267 | AC_CHECK_HEADERS([readline/readline.h]) |
|---|
| 268 | AC_SUBST(LIBREADLINE) |
|---|
| 269 | saved_LIBS="$LIBS" |
|---|
| 270 | # libreadline will also need libtermcap on some OSes |
|---|
| 271 | for add in "" "-ltermcap"; do |
|---|
| 272 | if test "x$add" != x; then |
|---|
| 273 | AC_MSG_CHECKING([for readline with]) |
|---|
| 274 | AC_MSG_RESULT($add) |
|---|
| 275 | fi |
|---|
| 276 | LIBS="$saved_LIBS $add" |
|---|
| 277 | unset ac_cv_lib_readline_readline |
|---|
| 278 | AC_CHECK_LIB(readline, readline, [ |
|---|
| 279 | LIBREADLINE="-lreadline $add" |
|---|
| 280 | ac_cv_func_readline_lreadline=yes |
|---|
| 281 | ], ac_cv_func_readline_lreadline=no) |
|---|
| 282 | test "x$ac_cv_func_readline_lreadline" = xyes && break |
|---|
| 283 | done |
|---|
| 284 | LIBS="$LIBS $LIBREADLINE" |
|---|
| 285 | AC_CHECK_FUNCS(readline) |
|---|
| 286 | LIBS="$saved_LIBS" |
|---|
| 287 | |
|---|
| 288 | # |
|---|
| 289 | # We check for various libraries |
|---|
| 290 | # - SysVr4 style of "-lsocket" at first (unless in libc) |
|---|
| 291 | # The hallmark is connect() routine (we presume) |
|---|
| 292 | # |
|---|
| 293 | AC_SUBST(LIBSOCKET)dnl |
|---|
| 294 | ac_cv_libsocket_both=1 |
|---|
| 295 | AC_CHECK_FUNC(connect, ac_cv_libsocket_both=0) |
|---|
| 296 | AC_CHECK_FUNC(gethostbyname, ac_cv_libsocket_both=0) |
|---|
| 297 | if test "$ac_cv_libsocket_both" = 1 ; then |
|---|
| 298 | # Check cache |
|---|
| 299 | if test "$ac_cv_func_socket_lsocket" = yes ; then |
|---|
| 300 | AC_MSG_RESULT([need -lsocket library (cached)]) |
|---|
| 301 | LIBSOCKET="-lsocket" |
|---|
| 302 | if test "$ac_cv_func_gethostbyname_lnsl" = yes ; then |
|---|
| 303 | LIBSOCKET="-lsocket -lnsl" |
|---|
| 304 | fi |
|---|
| 305 | else |
|---|
| 306 | # Well, will this work ? SysVR4, but not Sun Solaris ? |
|---|
| 307 | AC_CHECK_LIB(socket, connect, [LIBSOCKET="-lsocket" |
|---|
| 308 | ac_cv_func_socket_lsocket=yes], |
|---|
| 309 | ac_cv_func_socket_lsocket=no) |
|---|
| 310 | if test "$ac_cv_func_socket_lsocket" = yes ; then |
|---|
| 311 | t_oldLibs="$LIBS" |
|---|
| 312 | LIBS="$LIBS -lsocket $LIBRESOLV" |
|---|
| 313 | AC_TRY_LINK([],[gethostbyname();], ,[ |
|---|
| 314 | LIBS="$LIBS -lnsl" # Add this Solaris library.. |
|---|
| 315 | AC_TRY_LINK([],[gethostbyname();],[ |
|---|
| 316 | LIBSOCKET="-lsocket -lnsl" |
|---|
| 317 | ac_cv_func_gethostbyname_lnsl=yes |
|---|
| 318 | ], [ |
|---|
| 319 | AC_MSG_ERROR([Weird, '$LIBS' not enough to find gethostbyname() ?!]) |
|---|
| 320 | ]) |
|---|
| 321 | ]) |
|---|
| 322 | LIBS="$t_oldLibs" |
|---|
| 323 | fi |
|---|
| 324 | fi |
|---|
| 325 | fi |
|---|
| 326 | |
|---|
| 327 | AC_SUBST(LIBRESOLV)dnl |
|---|
| 328 | if test "x$LIBRESOLV" = "x"; then |
|---|
| 329 | # Ok, No -lresolv, is this enough for the _res to appear ? |
|---|
| 330 | t_oldLibs="$LIBS" |
|---|
| 331 | LIBS="$LIBS $LIBSOCKET" |
|---|
| 332 | ac_cv_var__res_options=no |
|---|
| 333 | # This following is for IRIX6.4, and I sincerely hope it |
|---|
| 334 | # will not fail on other systems... It did! It did! |
|---|
| 335 | # Many systems don't have idemponent headers, they need specific |
|---|
| 336 | # includes before latter ones, or the latter ones won't be successful... |
|---|
| 337 | AC_TRY_LINK([#include <sys/types.h> |
|---|
| 338 | #include <sys/socket.h> |
|---|
| 339 | #include <netinet/in.h> |
|---|
| 340 | #include <arpa/nameser.h> |
|---|
| 341 | #include <resolv.h>], |
|---|
| 342 | [_res.options = RES_INIT;], |
|---|
| 343 | ac_cv_var__res_options=yes); |
|---|
| 344 | if test "$ac_cv_var__res_options" != "yes"; then |
|---|
| 345 | LIBRESOLV="-lresolv" |
|---|
| 346 | fi |
|---|
| 347 | LIBS="$t_oldLibs" |
|---|
| 348 | fi |
|---|
| 349 | |
|---|
| 350 | if test "x$LIBRESOLV" = "x"; then |
|---|
| 351 | # glibc 2.2.4 and libresolv is difficult |
|---|
| 352 | # - gethostbyname won't require lresolv because all |
|---|
| 353 | # queries are made through the nsswitch |
|---|
| 354 | # - checking for the variable _res will not require |
|---|
| 355 | # lresolv because _res is defined somewhere |
|---|
| 356 | AC_CHECK_LIB(resolv, res_query, [LIBRESOLV=-lresolv]) |
|---|
| 357 | LIBS="$t_oldLibs" |
|---|
| 358 | fi |
|---|
| 359 | |
|---|
| 360 | # See about the routines that possibly exist at the libraries.. |
|---|
| 361 | LIBS="$t_oldLibs $LIBSOCKET" |
|---|
| 362 | AC_CHECK_FUNCS(socket socketpair) |
|---|
| 363 | LIBS="$t_oldLibs" |
|---|
| 364 | |
|---|
| 365 | if test "$ac_cv_func_socket" = no -a "$LIBSOCKET" != ""; then |
|---|
| 366 | LIBS="$LIBS $LIBSOCKET" |
|---|
| 367 | AC_TRY_LINK([],[socket();], ac_cv_func_socket=yes) |
|---|
| 368 | if test $ac_cv_func_socket = yes; then |
|---|
| 369 | AC_DEFINE(HAVE_SOCKET, 1, [Have socket]) |
|---|
| 370 | fi |
|---|
| 371 | LIBS="$t_oldLibs" |
|---|
| 372 | fi |
|---|
| 373 | if test "$ac_cv_func_socketpair" = no -a "$LIBSOCKET" != ""; then |
|---|
| 374 | LIBS="$LIBS $LIBSOCKET" |
|---|
| 375 | AC_TRY_LINK([],[socketpair();], ac_cv_func_socketpair=yes) |
|---|
| 376 | if test $ac_cv_func_socketpair = yes; then |
|---|
| 377 | AC_DEFINE(HAVE_SOCKETPAIR, 1, [Have socketpair]) |
|---|
| 378 | fi |
|---|
| 379 | LIBS="$t_oldLibs" |
|---|
| 380 | fi |
|---|
| 381 | |
|---|
| 382 | # Always link lib{socket,nsl,resolv) if found, sigh. |
|---|
| 383 | LIBS="$LIBS $LIBSOCKET $LIBRESOLV" |
|---|
| 384 | |
|---|
| 385 | AC_ARG_WITH(flex-dir, |
|---|
| 386 | [ --with-flex-dir=PATH Specify path to flex installation], |
|---|
| 387 | [ |
|---|
| 388 | if test "x$withval" != "xno" ; then |
|---|
| 389 | tryflexdir=$withval |
|---|
| 390 | fi |
|---|
| 391 | ] |
|---|
| 392 | ) |
|---|
| 393 | |
|---|
| 394 | saved_LDFLAGS="$LDFLAGS" |
|---|
| 395 | saved_CPPFLAGS="$CPPFLAGS" |
|---|
| 396 | AC_SUBST(LIBFL) |
|---|
| 397 | AC_CACHE_CHECK([for flex directory], ac_cv_flexdir, [ |
|---|
| 398 | for flexdir in $tryflexdir "" /usr/local/flex /usr/lib/flex /usr/local/flex /usr/lib/flex /usr/local /usr/pkg /opt /opt/flex ; do |
|---|
| 399 | # Skip directories if they don't exist |
|---|
| 400 | if test ! -z "$flexdir" -a ! -d "$flexdir" ; then |
|---|
| 401 | continue; |
|---|
| 402 | fi |
|---|
| 403 | |
|---|
| 404 | LIBFL="-lfl" |
|---|
| 405 | CPPFLAGS="$saved_CPPFLAGS" |
|---|
| 406 | LDFLAGS="$saved_LDFLAGS" |
|---|
| 407 | if test ! -z "$flexdir" -a "x$flexdir" != "x/usr"; then |
|---|
| 408 | # Try to use $flexdir/lib if it exists, otherwise |
|---|
| 409 | # $flexdir |
|---|
| 410 | if test -d "$flexdir/lib" ; then |
|---|
| 411 | LDFLAGS="-L$flexdir/lib $saved_LDFLAGS" |
|---|
| 412 | if test ! -z "$need_dash_r" ; then |
|---|
| 413 | LDFLAGS="-R$flexdir/lib $LDFLAGS" |
|---|
| 414 | fi |
|---|
| 415 | else |
|---|
| 416 | LDFLAGS="-L$flexdir $saved_LDFLAGS" |
|---|
| 417 | if test ! -z "$need_dash_r" ; then |
|---|
| 418 | LDFLAGS="-R$flexdir $LDFLAGS" |
|---|
| 419 | fi |
|---|
| 420 | fi |
|---|
| 421 | # Try to use $flexdir/include if it exists, otherwise |
|---|
| 422 | # $flexdir |
|---|
| 423 | if test -d "$flexdir/include" ; then |
|---|
| 424 | CPPFLAGS="-I$flexdir/include $saved_CPPFLAGS" |
|---|
| 425 | else |
|---|
| 426 | CPPFLAGS="-I$flexdir $saved_CPPFLAGS" |
|---|
| 427 | fi |
|---|
| 428 | fi |
|---|
| 429 | break; |
|---|
| 430 | done |
|---|
| 431 | |
|---|
| 432 | if test -z "$flexdir" ; then |
|---|
| 433 | flexdir="(system)" |
|---|
| 434 | fi |
|---|
| 435 | |
|---|
| 436 | ac_cv_flexdir=$flexdir |
|---|
| 437 | ]) |
|---|
| 438 | |
|---|
| 439 | if (test ! -z "$ac_cv_flexdir" && test "x$ac_cv_flexdir" != "x(system)") ; then |
|---|
| 440 | dnl Need to recover flexdir - test above runs in subshell |
|---|
| 441 | flexdir=$ac_cv_flexdir |
|---|
| 442 | if test ! -z "$flexdir" -a "x$flexdir" != "x/usr"; then |
|---|
| 443 | # Try to use $flexdir/lib if it exists, otherwise |
|---|
| 444 | # $flexdir |
|---|
| 445 | if test -d "$flexdir/lib" ; then |
|---|
| 446 | LDFLAGS="-L$flexdir/lib $saved_LDFLAGS" |
|---|
| 447 | if test ! -z "$need_dash_r" ; then |
|---|
| 448 | LDFLAGS="-R$flexdir/lib $LDFLAGS" |
|---|
| 449 | fi |
|---|
| 450 | else |
|---|
| 451 | LDFLAGS="-L$flexdir $saved_LDFLAGS" |
|---|
| 452 | if test ! -z "$need_dash_r" ; then |
|---|
| 453 | LDFLAGS="-R$flexdir $LDFLAGS" |
|---|
| 454 | fi |
|---|
| 455 | fi |
|---|
| 456 | # Try to use $flexdir/include if it exists, otherwise |
|---|
| 457 | # $flexdir |
|---|
| 458 | if test -d "$flexdir/include" ; then |
|---|
| 459 | CPPFLAGS="-I$flexdir/include $saved_CPPFLAGS" |
|---|
| 460 | else |
|---|
| 461 | CPPFLAGS="-I$flexdir $saved_CPPFLAGS" |
|---|
| 462 | fi |
|---|
| 463 | fi |
|---|
| 464 | fi |
|---|
| 465 | |
|---|
| 466 | dnl The big search for OpenSSL |
|---|
| 467 | AC_ARG_WITH(ssl-dir, |
|---|
| 468 | [ --with-ssl-dir=PATH Specify path to OpenSSL installation], |
|---|
| 469 | [ |
|---|
| 470 | if test "x$withval" != "xno" ; then |
|---|
| 471 | tryssldir=$withval |
|---|
| 472 | fi |
|---|
| 473 | ] |
|---|
| 474 | ) |
|---|
| 475 | |
|---|
| 476 | SSL_MSG="no" |
|---|
| 477 | saved_LIBS="$LIBS" |
|---|
| 478 | saved_LDFLAGS="$LDFLAGS" |
|---|
| 479 | saved_CPPFLAGS="$CPPFLAGS" |
|---|
| 480 | AC_SUBST(LIBCRYPTO) |
|---|
| 481 | AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [ |
|---|
| 482 | for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do |
|---|
| 483 | # Skip directories if they don't exist |
|---|
| 484 | if test ! -z "$ssldir" -a ! -d "$ssldir" ; then |
|---|
| 485 | continue; |
|---|
| 486 | fi |
|---|
| 487 | LIBCRYPTO="-lcrypto" |
|---|
| 488 | CPPFLAGS="$saved_CPPFLAGS" |
|---|
| 489 | LDFLAGS="$saved_LDFLAGS" |
|---|
| 490 | LIBS="$saved_LIBS $LIBCRYPTO" |
|---|
| 491 | |
|---|
| 492 | if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then |
|---|
| 493 | # Try to use $ssldir/lib if it exists, otherwise |
|---|
| 494 | # $ssldir |
|---|
| 495 | if test -d "$ssldir/lib" ; then |
|---|
| 496 | LDFLAGS="-L$ssldir/lib $saved_LDFLAGS" |
|---|
| 497 | if test ! -z "$need_dash_r" ; then |
|---|
| 498 | LDFLAGS="-R$ssldir/lib $LDFLAGS" |
|---|
| 499 | fi |
|---|
| 500 | else |
|---|
| 501 | LDFLAGS="-L$ssldir $saved_LDFLAGS" |
|---|
| 502 | if test ! -z "$need_dash_r" ; then |
|---|
| 503 | LDFLAGS="-R$ssldir $LDFLAGS" |
|---|
| 504 | fi |
|---|
| 505 | fi |
|---|
| 506 | # Try to use $ssldir/include if it exists, otherwise |
|---|
| 507 | # $ssldir |
|---|
| 508 | if test -d "$ssldir/include" ; then |
|---|
| 509 | CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS" |
|---|
| 510 | else |
|---|
| 511 | CPPFLAGS="-I$ssldir $saved_CPPFLAGS" |
|---|
| 512 | fi |
|---|
| 513 | fi |
|---|
| 514 | |
|---|
| 515 | # Basic test to check for compatible version and correct linking |
|---|
| 516 | # *does not* test for RSA - that comes later. |
|---|
| 517 | AC_TRY_RUN( |
|---|
| 518 | [ |
|---|
| 519 | #include <string.h> |
|---|
| 520 | #include <openssl/rand.h> |
|---|
| 521 | int main(void) |
|---|
| 522 | { |
|---|
| 523 | char a[2048]; |
|---|
| 524 | memset(a, 0, sizeof(a)); |
|---|
| 525 | RAND_add(a, sizeof(a), sizeof(a)); |
|---|
| 526 | return(RAND_status() <= 0); |
|---|
| 527 | } |
|---|
| 528 | ], |
|---|
| 529 | [ |
|---|
| 530 | found_crypto=1 |
|---|
| 531 | break; |
|---|
| 532 | ], [] |
|---|
| 533 | ) |
|---|
| 534 | |
|---|
| 535 | if test ! -z "$found_crypto" ; then |
|---|
| 536 | break; |
|---|
| 537 | fi |
|---|
| 538 | done |
|---|
| 539 | |
|---|
| 540 | # if test -z "$found_crypto" ; then |
|---|
| 541 | # AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log]) |
|---|
| 542 | # fi |
|---|
| 543 | if test -n "$found_crypto" ; then |
|---|
| 544 | if test -z "$ssldir" ; then |
|---|
| 545 | ssldir="(system)" |
|---|
| 546 | fi |
|---|
| 547 | ac_cv_openssldir=$ssldir |
|---|
| 548 | SSL_MSG="yes" |
|---|
| 549 | fi |
|---|
| 550 | ], [SSL_MSG=yes]) |
|---|
| 551 | |
|---|
| 552 | if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then |
|---|
| 553 | dnl Need to recover ssldir - test above runs in subshell |
|---|
| 554 | ssldir=$ac_cv_openssldir |
|---|
| 555 | if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then |
|---|
| 556 | # Try to use $ssldir/lib if it exists, otherwise |
|---|
| 557 | # $ssldir |
|---|
| 558 | if test -d "$ssldir/lib" ; then |
|---|
| 559 | LDFLAGS="-L$ssldir/lib $saved_LDFLAGS" |
|---|
| 560 | if test ! -z "$need_dash_r" ; then |
|---|
| 561 | LDFLAGS="-R$ssldir/lib $LDFLAGS" |
|---|
| 562 | fi |
|---|
| 563 | else |
|---|
| 564 | LDFLAGS="-L$ssldir $saved_LDFLAGS" |
|---|
| 565 | if test ! -z "$need_dash_r" ; then |
|---|
| 566 | LDFLAGS="-R$ssldir $LDFLAGS" |
|---|
| 567 | fi |
|---|
| 568 | fi |
|---|
| 569 | # Try to use $ssldir/include if it exists, otherwise |
|---|
| 570 | # $ssldir |
|---|
| 571 | if test -d "$ssldir/include" ; then |
|---|
| 572 | CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS" |
|---|
| 573 | else |
|---|
| 574 | CPPFLAGS="-I$ssldir $saved_CPPFLAGS" |
|---|
| 575 | fi |
|---|
| 576 | fi |
|---|
| 577 | fi |
|---|
| 578 | LIBS="$saved_LIBS" |
|---|
| 579 | if test "x$SSL_MSG" = "xyes" ; then |
|---|
| 580 | AC_DEFINE(HAVE_OPENSSL, 1, [Have OpenSSL libraries]) |
|---|
| 581 | fi |
|---|
| 582 | AM_CONDITIONAL(HAVE_SSL, test "x$SSL_MSG" = "xyes") |
|---|
| 583 | |
|---|
| 584 | AC_ARG_WITH(pam-dir, |
|---|
| 585 | [ --with-pam-dir=PATH Specify path for PAM installation libraries], |
|---|
| 586 | [ |
|---|
| 587 | if test "x$withval" != "xno" ; then |
|---|
| 588 | trypamdir=$withval |
|---|
| 589 | fi |
|---|
| 590 | ] |
|---|
| 591 | ) |
|---|
| 592 | |
|---|
| 593 | saved_LDFLAGS="$LDFLAGS" |
|---|
| 594 | saved_CPPFLAGS="$CPPFLAGS" |
|---|
| 595 | AC_CACHE_CHECK([for pam directory], ac_cv_pamdir, [ |
|---|
| 596 | for pamdir in $trypamdir "" /usr/local /usr/pkg /opt ; do |
|---|
| 597 | # Skip directories if they don't exist |
|---|
| 598 | if test ! -z "$pamdir" -a ! -d "$pamdir" ; then |
|---|
| 599 | continue; |
|---|
| 600 | fi |
|---|
| 601 | |
|---|
| 602 | CPPFLAGS="$saved_CPPFLAGS" |
|---|
| 603 | LDFLAGS="$saved_LDFLAGS" |
|---|
| 604 | if test ! -z "$pamdir" -a "x$pamdir" != "x/usr"; then |
|---|
| 605 | # Try to use $pamdir/lib if it exists, otherwise |
|---|
| 606 | # $pamdir |
|---|
| 607 | if test -d "$pamdir/lib" ; then |
|---|
| 608 | LDFLAGS="-L$pamdir/lib $saved_LDFLAGS" |
|---|
| 609 | if test ! -z "$need_dash_r" ; then |
|---|
| 610 | LDFLAGS="-R$pamdir/lib $LDFLAGS" |
|---|
| 611 | fi |
|---|
| 612 | else |
|---|
| 613 | LDFLAGS="-L$pamdir $saved_LDFLAGS" |
|---|
| 614 | if test ! -z "$need_dash_r" ; then |
|---|
| 615 | LDFLAGS="-R$pamdir $LDFLAGS" |
|---|
| 616 | fi |
|---|
| 617 | fi |
|---|
| 618 | # Try to use $pamdir/include if it exists, otherwise |
|---|
| 619 | # $pamdir |
|---|
| 620 | if test -d "$pamdir/include" ; then |
|---|
| 621 | CPPFLAGS="-I$pamdir/include $saved_CPPFLAGS" |
|---|
| 622 | else |
|---|
| 623 | CPPFLAGS="-I$pamdir $saved_CPPFLAGS" |
|---|
| 624 | fi |
|---|
| 625 | fi |
|---|
| 626 | break; |
|---|
| 627 | done |
|---|
| 628 | |
|---|
| 629 | if test -z "$pamdir" ; then |
|---|
| 630 | pamdir="(system)" |
|---|
| 631 | fi |
|---|
| 632 | |
|---|
| 633 | ac_cv_pamdir=$pamdir |
|---|
| 634 | ]) |
|---|
| 635 | |
|---|
| 636 | if (test ! -z "$ac_cv_pamdir" && test "x$ac_cv_pamdir" != "x(system)") ; then |
|---|
| 637 | dnl Need to recover pamdir - test above runs in subshell |
|---|
| 638 | pamdir=$ac_cv_pamdir |
|---|
| 639 | if test ! -z "$pamdir" -a "x$pamdir" != "x/usr"; then |
|---|
| 640 | # Try to use $pamdir/lib if it exists, otherwise |
|---|
| 641 | # $pamdir |
|---|
| 642 | if test -d "$pamdir/lib" ; then |
|---|
| 643 | LDFLAGS="-L$pamdir/lib $saved_LDFLAGS" |
|---|
| 644 | if test ! -z "$need_dash_r" ; then |
|---|
| 645 | LDFLAGS="-R$pamdir/lib $LDFLAGS" |
|---|
| 646 | fi |
|---|
| 647 | else |
|---|
| 648 | LDFLAGS="-L$pamdir $saved_LDFLAGS" |
|---|
| 649 | if test ! -z "$need_dash_r" ; then |
|---|
| 650 | LDFLAGS="-R$pamdir $LDFLAGS" |
|---|
| 651 | fi |
|---|
| 652 | fi |
|---|
| 653 | # Try to use $pamdir/include if it exists, otherwise |
|---|
| 654 | # $pamdir |
|---|
| 655 | if test -d "$pamdir/include" ; then |
|---|
| 656 | CPPFLAGS="-I$pamdir/include $saved_CPPFLAGS" |
|---|
| 657 | else |
|---|
| 658 | CPPFLAGS="-I$pamdir $saved_CPPFLAGS" |
|---|
| 659 | fi |
|---|
| 660 | fi |
|---|
| 661 | fi |
|---|
| 662 | |
|---|
| 663 | dnl Check for PAM libs |
|---|
| 664 | PAM_MSG="no" |
|---|
| 665 | no_pam="" |
|---|
| 666 | AC_SUBST(LIBPAM) |
|---|
| 667 | saved_LIBS="$LIBS" |
|---|
| 668 | AC_MSG_CHECKING([PAM support]) |
|---|
| 669 | AC_ARG_WITH(pam, |
|---|
| 670 | [ --with-pam Enable PAM support], |
|---|
| 671 | [ |
|---|
| 672 | if test "x$withval" = "xno" ; then |
|---|
| 673 | AC_MSG_RESULT(disabled) |
|---|
| 674 | no_pam=1 |
|---|
| 675 | fi |
|---|
| 676 | ], |
|---|
| 677 | ) |
|---|
| 678 | if test -z "$no_pam" ; then |
|---|
| 679 | if test "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then |
|---|
| 680 | AC_MSG_RESULT(yes) |
|---|
| 681 | PAM_MSG="yes" |
|---|
| 682 | AC_CHECK_LIB(pam, pam_set_item, [LIBPAM="$LIBPAM -lpam"], AC_MSG_ERROR([*** libpam missing])) |
|---|
| 683 | LIBS="$LIBS $LIBPAM" |
|---|
| 684 | AC_CHECK_FUNCS(pam_getenvlist) |
|---|
| 685 | AC_CHECK_FUNCS(pam_putenv) |
|---|
| 686 | disable_shadow=yes |
|---|
| 687 | AC_DEFINE(HAVE_PAM, 1, [Have Pluggable Authentication Modules]) |
|---|
| 688 | else |
|---|
| 689 | AC_MSG_RESULT(no) |
|---|
| 690 | fi |
|---|
| 691 | fi |
|---|
| 692 | |
|---|
| 693 | dnl Check for older PAM |
|---|
| 694 | if test "x$PAM_MSG" = "xyes" ; then |
|---|
| 695 | # Check PAM strerror arguments (old PAM) |
|---|
| 696 | AC_MSG_CHECKING([whether pam_strerror takes only one argument]) |
|---|
| 697 | AC_TRY_COMPILE( |
|---|
| 698 | [ |
|---|
| 699 | #include <stdlib.h> |
|---|
| 700 | #include <security/pam_appl.h> |
|---|
| 701 | ], |
|---|
| 702 | [(void)pam_strerror((pam_handle_t *)NULL, -1);], |
|---|
| 703 | [AC_MSG_RESULT(no)], |
|---|
| 704 | [ |
|---|
| 705 | AC_DEFINE(HAVE_OLD_PAM, 1, [Have OLD Pluggable Authentication Modules]) |
|---|
| 706 | AC_MSG_RESULT(yes) |
|---|
| 707 | PAM_MSG="yes (old library)" |
|---|
| 708 | ] |
|---|
| 709 | ) |
|---|
| 710 | fi |
|---|
| 711 | LIBS="$saved_LIBS" |
|---|
| 712 | AM_CONDITIONAL(HAVE_PAM, test "x$PAM_MSG" = "xyes") |
|---|
| 713 | |
|---|
| 714 | dnl Check for SIA libs |
|---|
| 715 | AC_SUBST(LIBSIA) |
|---|
| 716 | SIA_MSG="no" |
|---|
| 717 | no_osfsia="" |
|---|
| 718 | AC_MSG_CHECKING([SIA support]) |
|---|
| 719 | AC_ARG_WITH(osfsia, |
|---|
| 720 | [ --with-osfsia Enable Digital Unix SIA], |
|---|
| 721 | [ |
|---|
| 722 | if test "x$withval" = "xno" ; then |
|---|
| 723 | AC_MSG_RESULT(disabled) |
|---|
| 724 | no_osfsia=1 |
|---|
| 725 | fi |
|---|
| 726 | ], |
|---|
| 727 | ) |
|---|
| 728 | if test -z "$no_osfsia" ; then |
|---|
| 729 | if test -f /etc/sia/matrix.conf; then |
|---|
| 730 | AC_MSG_RESULT(yes) |
|---|
| 731 | AC_DEFINE(HAVE_OSF_SIA, 1, [Have Digital Unix SIA]) |
|---|
| 732 | LIBSIA="$LIBSIA -lsecurity -ldb -lm -laud" |
|---|
| 733 | SIA_MSG="yes" |
|---|
| 734 | else |
|---|
| 735 | AC_MSG_RESULT(no) |
|---|
| 736 | fi |
|---|
| 737 | fi |
|---|
| 738 | |
|---|
| 739 | AM_CONDITIONAL(HAVE_SIA, test "x$SIA_MSG" = "xyes") |
|---|
| 740 | |
|---|
| 741 | AC_SUBST(CFLAGS_PCSC) |
|---|
| 742 | AC_SUBST(LIBPCSC) |
|---|
| 743 | LIBPCSC="-lpcsclite" |
|---|
| 744 | found_pcsclite=no |
|---|
| 745 | saved_LIBS="$LIBS" |
|---|
| 746 | saved_LDFLAGS="$LDFLAGS" |
|---|
| 747 | saved_CPPFLAGS="$CPPFLAGS" |
|---|
| 748 | LIBS="$LIBPCSC $saved_LIBS" |
|---|
| 749 | AC_ARG_WITH(pcsclite, |
|---|
| 750 | [ --with-pcsclite=PATH use PC/SC Lite in PATH], |
|---|
| 751 | [ |
|---|
| 752 | AC_MSG_CHECKING([for SCardEstablishContext]) |
|---|
| 753 | for pcscdir in /pcsc ""; do |
|---|
| 754 | LDFLAGS="$saved_LDFLAGS" |
|---|
| 755 | |
|---|
| 756 | if test -d "$withval/lib$pcscdir"; then |
|---|
| 757 | if test -n "${need_dash_r}"; then |
|---|
| 758 | LDFLAGS="-L${withval}/lib${pcscdir}/ -R${withval}/lib${pcscdir}/ ${LDFLAGS}" |
|---|
| 759 | else |
|---|
| 760 | LDFLAGS="-L${withval}/lib${pcscdir} ${LDFLAGS}" |
|---|
| 761 | fi |
|---|
| 762 | else |
|---|
| 763 | if test -n "${need_dash_r}"; then |
|---|
| 764 | LDFLAGS="-L${withval}${pcscdir} -R${withval}${pcscdir} ${LDFLAGS}" |
|---|
| 765 | else |
|---|
| 766 | LDFLAGS="-L${withval}${pcscdir} ${LDFLAGS}" |
|---|
| 767 | fi |
|---|
| 768 | fi |
|---|
| 769 | if test -d "$withval/include"; then |
|---|
| 770 | CFLAGS_PCSC="-I${withval}/include${pcscdir} ${CFLAGS_PCSC}" |
|---|
| 771 | else |
|---|
| 772 | CFLAGS_PCSC="-I${withval}${pcscdir} ${CFLAGS_PCSC}" |
|---|
| 773 | fi |
|---|
| 774 | CPPFLAGS="$CFLAGS_PCSC $saved_CPPFLAGS" |
|---|
| 775 | AC_TRY_LINK([#include <stdlib.h> |
|---|
| 776 | #include <winscard.h>],[SCardEstablishContext(0, NULL, NULL, NULL);], ac_cv_lib_pcsclite_SCardEstablishContext=yes) |
|---|
| 777 | CPPFLAGS="$saved_CPPFLAGS" |
|---|
| 778 | if test "x$ac_cv_lib_pcsclite_SCardEstablishContext" = "xyes"; then |
|---|
| 779 | AC_DEFINE(HAVE_LIBPCSCLITE) |
|---|
| 780 | found_pcsclite=yes |
|---|
| 781 | break; |
|---|
| 782 | fi |
|---|
| 783 | done |
|---|
| 784 | if test "x$found_pcsclite" != "xyes" ; then |
|---|
| 785 | AC_MSG_RESULT(no) |
|---|
| 786 | else |
|---|
| 787 | AC_MSG_RESULT(yes) |
|---|
| 788 | fi |
|---|
| 789 | ] |
|---|
| 790 | ) |
|---|
| 791 | if test "x$found_pcsclite" != "xyes" ; then |
|---|
| 792 | AC_CHECK_LIB(pcsclite, SCardEstablishContext, , AC_MSG_ERROR([*** PC/SC Lite missing - please install first])) |
|---|
| 793 | fi |
|---|
| 794 | LIBS="$saved_LIBS" |
|---|
| 795 | AM_CONDITIONAL(HAVE_PCSCLITE, test "x$ac_cv_lib_pcsclite_SCardEstablishContext" = "xyes") |
|---|
| 796 | |
|---|
| 797 | # Check for user-specified random device, otherwise check /dev/urandom |
|---|
| 798 | AC_ARG_WITH(random, |
|---|
| 799 | [ --with-random=FILE read entropy from FILE (default=/dev/urandom)], |
|---|
| 800 | [ |
|---|
| 801 | if test "x$withval" != "xno" ; then |
|---|
| 802 | RANDOM_POOL="$withval"; |
|---|
| 803 | AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL", [Location of random number pool]) |
|---|
| 804 | fi |
|---|
| 805 | ], |
|---|
| 806 | [ |
|---|
| 807 | # Check for random device |
|---|
| 808 | AC_CHECK_FILE("/dev/urandom", |
|---|
| 809 | [ |
|---|
| 810 | RANDOM_POOL="/dev/urandom"; |
|---|
| 811 | AC_SUBST(RANDOM_POOL) |
|---|
| 812 | AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL", [Location of random number pool]) |
|---|
| 813 | ] |
|---|
| 814 | ) |
|---|
| 815 | ] |
|---|
| 816 | ) |
|---|
| 817 | |
|---|
| 818 | # Check for PRNGD/EGD pool file |
|---|
| 819 | AC_ARG_WITH(prngd-port, |
|---|
| 820 | [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT], |
|---|
| 821 | [ |
|---|
| 822 | if test ! -z "$withval" -a "x$withval" != "xno" ; then |
|---|
| 823 | PRNGD_PORT="$withval" |
|---|
| 824 | AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT, [Port number of PRNGD/EGD random number socket]) |
|---|
| 825 | fi |
|---|
| 826 | ] |
|---|
| 827 | ) |
|---|
| 828 | |
|---|
| 829 | # Check for PRNGD/EGD pool file |
|---|
| 830 | AC_ARG_WITH(prngd-socket, |
|---|
| 831 | [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)], |
|---|
| 832 | [ |
|---|
| 833 | if test "x$withval" != "xno" ; then |
|---|
| 834 | PRNGD_SOCKET="$withval" |
|---|
| 835 | AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET", [Location of PRNGD/EGD random number socket]) |
|---|
| 836 | fi |
|---|
| 837 | ], |
|---|
| 838 | [ |
|---|
| 839 | # Check for existing socket only if we don't have a random device already |
|---|
| 840 | if test -z "$RANDOM_POOL" ; then |
|---|
| 841 | AC_MSG_CHECKING(for PRNGD/EGD socket) |
|---|
| 842 | # Insert other locations here |
|---|
| 843 | for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy /tmp/entropy; do |
|---|
| 844 | if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then |
|---|
| 845 | PRNGD_SOCKET="$sock" |
|---|
| 846 | AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET", [Location of PRNGD/EGD random number socket]) |
|---|
| 847 | break; |
|---|
| 848 | fi |
|---|
| 849 | done |
|---|
| 850 | if test ! -z "$PRNGD_SOCKET" ; then |
|---|
| 851 | AC_MSG_RESULT($PRNGD_SOCKET) |
|---|
| 852 | else |
|---|
| 853 | AC_MSG_RESULT(not found) |
|---|
| 854 | fi |
|---|
| 855 | fi |
|---|
| 856 | ] |
|---|
| 857 | ) |
|---|
| 858 | |
|---|
| 859 | ### BEGIN LDAP SPECIFIC OPTIONS |
|---|
| 860 | dnl ldap autoconf magic partly taken from pam_ldap |
|---|
| 861 | |
|---|
| 862 | dnl --enable-ldap option. |
|---|
| 863 | AC_ARG_ENABLE(ldap, |
|---|
| 864 | [ --enable-ldap enable use of LDAP for authentication. [default=yes]], |
|---|
| 865 | , enable_ldap=yes) |
|---|
| 866 | AC_ARG_ENABLE(ssl, [ --disable-ssl disable SSL/TSL support for ldap]) |
|---|
| 867 | AC_ARG_WITH(ldap-lib, [ --with-ldap-lib=type select ldap library [auto|netscape5|netscape4|netscape3|umich|openldap]]) |
|---|
| 868 | AC_ARG_WITH(ldap-dir, [ --with-ldap-dir=DIR base directory of ldap SDK]) |
|---|
| 869 | |
|---|
| 870 | AC_SUBST(LIBLDAP) |
|---|
| 871 | LDAP_MSG="no" |
|---|
| 872 | if (test x$enable_ldap = xyes); then |
|---|
| 873 | if test -n "$with_ldap_dir"; then |
|---|
| 874 | CPPFLAGS="$CPPFLAGS -I$with_ldap_dir/include" |
|---|
| 875 | LDFLAGS="$LDFLAGS -L$with_ldap_dir/lib" |
|---|
| 876 | case "$target_os" in |
|---|
| 877 | solaris*) LDFLAGS="$LDFLAGS -Wl,-R$with_ldap_dir/lib" ;; |
|---|
| 878 | *) LDFLAGS="$LDFLAGS -Wl,-rpath,$with_ldap_dir/lib" ;; |
|---|
| 879 | esac |
|---|
| 880 | fi |
|---|
| 881 | |
|---|
| 882 | AC_CHECK_HEADERS(lber.h ldap.h ldap_ssl.h) |
|---|
| 883 | |
|---|
| 884 | dnl check which ldap library we have |
|---|
| 885 | if test -z "$with_ldap_lib"; then |
|---|
| 886 | with_ldap_lib=auto |
|---|
| 887 | fi |
|---|
| 888 | |
|---|
| 889 | if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = umich -o $with_ldap_lib = openldap \); then |
|---|
| 890 | AC_CHECK_LIB(lber, ber_init, LIBLDAP="-llber $LIBLDAP" found_lber_lib=yes) |
|---|
| 891 | saved_LIBS="$LIBS" |
|---|
| 892 | LIBS="$LIBS $LIBLDAP" |
|---|
| 893 | AC_CHECK_LIB(ldap, ldap_search, LIBLDAP="-lldap $LIBLDAP" found_ldap_lib=yes) |
|---|
| 894 | AC_CHECK_LIB(ldap, ldap_start_tls_s, LIBLDAP="-lssl $LIBLDAP" need_ssl_lib=yes) |
|---|
| 895 | LIBS="$saved_LIBS" |
|---|
| 896 | fi |
|---|
| 897 | if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape5 \); then |
|---|
| 898 | AC_CHECK_LIB(ldap50, ldap_search, LIBLDAP="-lldap50 -lssldap50 -lssl3 -lnss3 -lnspr4 -lprldap50 -lplc4 -lplds4 $LIBLDAP" found_ldap_lib=yes need_pthread=true,, -lpthread) |
|---|
| 899 | fi |
|---|
| 900 | if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape4 \); then |
|---|
| 901 | AC_CHECK_LIB(ldapssl41, ldap_search, LIBLDAP="-lldapssl41 -lplc3 -lplds3 -lnspr3 $LIBLDAP" found_ldap_lib=yes need_pthread=true,, -lpthread) |
|---|
| 902 | if test -z "$found_ldap_lib"; then |
|---|
| 903 | AC_CHECK_LIB(ldapssl40, ldap_search, LIBLDAP="-lldapssl40 $LIBLDAP" found_ldap_lib=yes need_pthread=true,, -lpthread) |
|---|
| 904 | fi |
|---|
| 905 | fi |
|---|
| 906 | if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape3 \); then |
|---|
| 907 | AC_CHECK_LIB(ldapssl30, ldap_search, LIBLDAP="-lldapssl30 $LIBLDAP" found_ldap_lib=yes need_pthread=true,, -lpthread) |
|---|
| 908 | fi |
|---|
| 909 | |
|---|
| 910 | if test -n "$found_ldap_lib"; then |
|---|
| 911 | AC_DEFINE(LDAP_REFERRALS,1,[This is needed for the native Solaris LDAP SDK]) |
|---|
| 912 | AC_DEFINE(HAVE_LDAP, 1, [Use LDAP for authentication etc.]) |
|---|
| 913 | LDAP_MSG="yes" |
|---|
| 914 | |
|---|
| 915 | saved_LIBS="$LIBS" |
|---|
| 916 | LIBS="$LIBS $LIBLDAP" |
|---|
| 917 | AC_CHECK_FUNCS(ldap_init) |
|---|
| 918 | if test "$enable_ssl" \!= "no"; then |
|---|
| 919 | AC_CHECK_FUNCS(ldapssl_init ldap_start_tls_s ldap_pvt_tls_set_option) |
|---|
| 920 | fi |
|---|
| 921 | LIBS="$saved_LIBS" |
|---|
| 922 | fi |
|---|
| 923 | fi |
|---|
| 924 | AM_CONDITIONAL(HAVE_LDAP, test "x$LDAP_MSG" = "xyes") |
|---|
| 925 | ### END LDAP SPECIFIC OPTIONS |
|---|
| 926 | |
|---|
| 927 | ### BEGIN ASSUAN SPECIFIC OPTIONS |
|---|
| 928 | ASSUAN_MSG="no" |
|---|
| 929 | AC_SUBST(CFLAGS_ASSUAN) |
|---|
| 930 | AC_SUBST(LIBASSUAN) |
|---|
| 931 | LIBASSUAN="-lassuan" |
|---|
| 932 | AC_ARG_WITH(assuan, |
|---|
| 933 | [ --with-assuan=PATH use Assuan libraries in PATH], |
|---|
| 934 | [ |
|---|
| 935 | if test -d "$withval/lib"; then |
|---|
| 936 | if test -n "${need_dash_r}"; then |
|---|
| 937 | LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}" |
|---|
| 938 | else |
|---|
| 939 | LDFLAGS="-L${withval}/lib ${LDFLAGS}" |
|---|
| 940 | fi |
|---|
| 941 | else |
|---|
| 942 | if test -n "${need_dash_r}"; then |
|---|
| 943 | LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}" |
|---|
| 944 | else |
|---|
| 945 | LDFLAGS="-L${withval} ${LDFLAGS}" |
|---|
| 946 | fi |
|---|
| 947 | fi |
|---|
| 948 | if test -d "$withval/include"; then |
|---|
| 949 | CFLAGS_ASSUAN="-I${withval}/include ${CFLAGS_ASSUAN}" |
|---|
| 950 | else |
|---|
| 951 | CFLAGS_ASSUAN="-I${withval} ${CFLAGS_ASSUAN}" |
|---|
| 952 | fi |
|---|
| 953 | ] |
|---|
| 954 | ) |
|---|
| 955 | |
|---|
| 956 | AC_CHECK_LIB(assuan, assuan_pipe_connect, ASSUAN_MSG="yes", ASSUAN_MSG="no") |
|---|
| 957 | if test "x$ASSUAN_MSG" != "xno" ; then |
|---|
| 958 | saved_CPPFLAGS="$CPPFLAGS" |
|---|
| 959 | CPPFLAGS="$CFLAGS_ASSUAN $CPPFLAGS" |
|---|
| 960 | AC_CHECK_HEADER(assuan.h, ASSUAN_MSG="yes", ASSUAN_MSG="no") |
|---|
| 961 | CPPFLAGS="$saved_CPPFLAGS" |
|---|
| 962 | fi |
|---|
| 963 | AM_CONDITIONAL(HAVE_ASSUAN, test "x$ASSUAN_MSG" = "xyes") |
|---|
| 964 | ### END ASSUAN SPECIFIC OPTIONS |
|---|
| 965 | |
|---|
| 966 | PLUGINDIR="/usr/lib/mozilla/plugins" |
|---|
| 967 | AC_ARG_WITH(plugin-dir, |
|---|
| 968 | [ --with-plugin-dir=PATH install plugin to PATH [[/usr/lib/mozilla/plugins]]], |
|---|
| 969 | [ |
|---|
| 970 | PLUGINDIR="$withval" |
|---|
| 971 | ] |
|---|
| 972 | ) |
|---|
| 973 | AC_SUBST(PLUGINDIR) |
|---|
| 974 | |
|---|
| 975 | # Check for PIN entry program used by OpenSC Signer |
|---|
| 976 | PIN_ENTRY="/usr/local/bin/gpinentry" |
|---|
| 977 | AC_ARG_WITH(pin-entry, |
|---|
| 978 | [ --with-pin-entry=PROG Run PROG as PIN-entry for OpenSC Signer], |
|---|
| 979 | [ |
|---|
| 980 | if test ! -z "$withval" -a "x$withval" != "xno" ; then |
|---|
| 981 | PIN_ENTRY="$withval" |
|---|
| 982 | fi |
|---|
| 983 | ] |
|---|
| 984 | ) |
|---|
| 985 | AC_DEFINE_UNQUOTED(PIN_ENTRY, "$PIN_ENTRY", [PIN-entry program for OpenSC Signer]) |
|---|
| 986 | |
|---|
| 987 | if test "x$prefix" = xNONE; then |
|---|
| 988 | prefix=$ac_default_prefix |
|---|
| 989 | fi |
|---|
| 990 | |
|---|
| 991 | dnl Enable/disable debugging messages. |
|---|
| 992 | AC_ARG_ENABLE(debug, |
|---|
| 993 | [ --enable-debug enable debug messages. [default=no]], |
|---|
| 994 | , enable_debug=no) |
|---|
| 995 | if (test x$enable_debug = xyes); then |
|---|
| 996 | AC_DEFINE(DEBUG, 1, [Enable debug messages.]) |
|---|
| 997 | fi |
|---|
| 998 | |
|---|
| 999 | CPPFLAGS="-I\${top_srcdir}/src/include $CPPFLAGS" |
|---|
| 1000 | |
|---|
| 1001 | AC_SUBST(LIBSCCONF) |
|---|
| 1002 | LIBSCCONF="\${top_srcdir}/src/scconf/libscconf.la" |
|---|
| 1003 | AC_SUBST(LIBSCLDAP) |
|---|
| 1004 | LIBSCLDAP="\${top_srcdir}/src/scldap/libscldap.la" |
|---|
| 1005 | AC_SUBST(LIBSCRANDOM) |
|---|
| 1006 | LIBSCRANDOM="\${top_srcdir}/src/scrandom/libscrandom.a" |
|---|
| 1007 | |
|---|
| 1008 | AM_CONDITIONAL(HAVE_SCIDI, test "foo" = "bar") |
|---|
| 1009 | |
|---|
| 1010 | scldap_etc_path=`eval echo ${sysconfdir}` ; scldap_etc_path=`eval echo ${scldap_etc_path}` |
|---|
| 1011 | AC_DEFINE_UNQUOTED(SCLDAP_ETC_PATH, "$scldap_etc_path", [etc path for libscldap]) |
|---|
| 1012 | scldap_conf_path=`eval echo ${scldap_etc_path}/scldap.conf` |
|---|
| 1013 | AC_DEFINE_UNQUOTED(SCLDAP_CONF_PATH, "$scldap_conf_path", [default config file for libscldap]) |
|---|
| 1014 | |
|---|
| 1015 | opensc_etc_path=`eval echo ${sysconfdir}` ; opensc_etc_path=`eval echo ${opensc_etc_path}` |
|---|
| 1016 | AC_DEFINE_UNQUOTED(OPENSC_ETC_PATH, "$opensc_etc_path", [etc path for libopensc]) |
|---|
| 1017 | opensc_conf_path=`eval echo ${opensc_etc_path}/opensc.conf` |
|---|
| 1018 | AC_DEFINE_UNQUOTED(OPENSC_CONF_PATH, "$opensc_conf_path", [default config file for libopensc]) |
|---|
| 1019 | |
|---|
| 1020 | AC_SUBST(CFLAGS_OPENSC) |
|---|
| 1021 | CFLAGS_OPENSC="" |
|---|
| 1022 | AC_SUBST(LIBOPENSC) |
|---|
| 1023 | LIBOPENSC="\${top_srcdir}/src/libopensc/libopensc.la" |
|---|
| 1024 | |
|---|
| 1025 | # Pass information about installed OpenSC requirements, so that |
|---|
| 1026 | # a proper opensc-config file will be build. |
|---|
| 1027 | OPENSC_LIBS="-L${libdir} -lopensc" |
|---|
| 1028 | OPENSC_CFLAGS="" |
|---|
| 1029 | AC_SUBST(OPENSC_LIBS) |
|---|
| 1030 | AC_SUBST(OPENSC_CFLAGS) |
|---|
| 1031 | |
|---|
| 1032 | pkgdata=`eval echo ${datadir}/${PACKAGE}` ; pkgdata=`eval echo ${pkgdata}` |
|---|
| 1033 | AC_SUBST(pkgdata) |
|---|
| 1034 | |
|---|
| 1035 | AC_OUTPUT([ |
|---|
| 1036 | Makefile |
|---|
| 1037 | aclocal/Makefile |
|---|
| 1038 | docs/Makefile |
|---|
| 1039 | docs/pkcs15-profile.5 |
|---|
| 1040 | etc/Makefile |
|---|
| 1041 | src/Makefile |
|---|
| 1042 | src/common/Makefile |
|---|
| 1043 | src/include/Makefile |
|---|
| 1044 | src/include/opensc/Makefile |
|---|
| 1045 | src/libopensc/Makefile |
|---|
| 1046 | src/libopensc/opensc-config |
|---|
| 1047 | src/openssh/Makefile |
|---|
| 1048 | src/pam/Makefile |
|---|
| 1049 | src/pkcs11/Makefile |
|---|
| 1050 | src/pkcs11/rsaref/Makefile |
|---|
| 1051 | src/pkcs15init/Makefile |
|---|
| 1052 | src/scam/Makefile |
|---|
| 1053 | src/scconf/Makefile |
|---|
| 1054 | src/scldap/Makefile |
|---|
| 1055 | src/scrandom/Makefile |
|---|
| 1056 | src/sia/Makefile |
|---|
| 1057 | src/signer/Makefile |
|---|
| 1058 | src/signer/npinclude/Makefile |
|---|
| 1059 | src/tests/Makefile |
|---|
| 1060 | src/tools/Makefile |
|---|
| 1061 | ]) |
|---|
| 1062 | |
|---|
| 1063 | if test ! -z "$RANDOM_POOL" ; then |
|---|
| 1064 | RAND_MSG="device ($RANDOM_POOL)" |
|---|
| 1065 | else |
|---|
| 1066 | if test ! -z "$PRNGD_PORT" ; then |
|---|
| 1067 | RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)" |
|---|
| 1068 | elif test ! -z "$PRNGD_SOCKET" ; then |
|---|
| 1069 | RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)" |
|---|
| 1070 | else |
|---|
| 1071 | RAND_MSG="Builtin kluge" |
|---|
| 1072 | BUILTIN_RNG=1 |
|---|
| 1073 | fi |
|---|
| 1074 | fi |
|---|
| 1075 | |
|---|
| 1076 | dnl Someone please show me a better way :) |
|---|
| 1077 | A=`eval echo ${prefix}` ; A=`eval echo ${A}` |
|---|
| 1078 | B=`eval echo ${bindir}` ; B=`eval echo ${B}` |
|---|
| 1079 | C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}` |
|---|
| 1080 | |
|---|
| 1081 | echo "" |
|---|
| 1082 | echo "OpenSC has been configured with the following options" |
|---|
| 1083 | |
|---|
| 1084 | echo "" |
|---|
| 1085 | echo "User binaries: ${B}" |
|---|
| 1086 | echo "Configuration files: ${C}" |
|---|
| 1087 | |
|---|
| 1088 | echo "" |
|---|
| 1089 | echo "Host: ${host}" |
|---|
| 1090 | echo "Compiler: ${CC}" |
|---|
| 1091 | echo "Compiler flags: ${CFLAGS}" |
|---|
| 1092 | echo "Preprocessor flags: ${CPPFLAGS}" |
|---|
| 1093 | echo "Linker flags: ${LDFLAGS}" |
|---|
| 1094 | echo "Libraries: ${LIBS}" |
|---|
| 1095 | |
|---|
| 1096 | echo "" |
|---|
| 1097 | echo "Random number collection: ${RAND_MSG}" |
|---|
| 1098 | echo "OpenSSL support: ${SSL_MSG}" |
|---|
| 1099 | echo "Assuan support: ${ASSUAN_MSG}" |
|---|
| 1100 | echo "LDAP support: ${LDAP_MSG}" |
|---|
| 1101 | echo "PAM support: ${PAM_MSG}" |
|---|
| 1102 | echo "SIA support: ${SIA_MSG}" |
|---|
| 1103 | |
|---|
| 1104 | echo "" |
|---|
| 1105 | |
|---|
| 1106 | if test ! -z "$BUILTIN_RNG" ; then |
|---|
| 1107 | echo "WARNING: you are using the builtin random number service." |
|---|
| 1108 | echo "The random number service is very simple and is only" |
|---|
| 1109 | echo "intended for testing purposes. Please request your OS" |
|---|
| 1110 | echo "vendor to include /dev/random in future versions of" |
|---|
| 1111 | echo "their OS. Or use PRNGD/EGD instead, your choice." |
|---|
| 1112 | fi |
|---|