root/releases/opensc-0.8.0/configure.in

Revision 1375, 28.2 KB (checked in by aet, 5 years ago)

Add missing zero to version number, sigh.

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