root/branches/opensc-0.9/configure.in

Revision 2323, 28.2 KB (checked in by aj, 4 years ago)

final release.

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