root/releases/opensc-0.9.2/configure.in

Revision 1872, 26.7 KB (checked in by anonymous, 4 years ago)

This commit was manufactured by cvs2svn to create branch 'opensc-0.9.2'.

  • 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.2)
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=0
19OPENSC_LT_REVISION=9
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 -lobjc"
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
230dnl The big mess with OpenSSL
231AC_ARG_WITH(openssl,
232        [  --with-openssl=PATH     use OpenSSL in PATH],
233        [tryssldir=$withval])
234
235SSL_MSG="no"
236ENGINE_MSG="no"
237saved_LIBS="$LIBS"
238saved_LDFLAGS="$LDFLAGS"
239saved_CPPFLAGS="$CPPFLAGS"
240AC_SUBST(LIBCRYPTO)
241AC_SUBST(ENGINE_LINK)
242AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
243        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
244                # Skip empty variables
245                if test -z "$ssldir"; then
246                        continue;
247                fi
248                # Disable OpenSSL support
249                if test "x$ssldir" = "xno" ; then
250                        SSL_MSG="no (disabled)"
251                        ENGINE_MSG="no (disabled)"
252                        break;
253                fi
254                # Skip directories if they don't exist
255                if test ! -d "$ssldir/" ; then
256                        continue;
257                fi
258                LIBCRYPTO="-lcrypto"
259                CPPFLAGS="$saved_CPPFLAGS"
260                LDFLAGS="$saved_LDFLAGS"
261                LIBS="$saved_LIBS $LIBCRYPTO"
262
263                if test "x$ssldir" != "x/usr"; then
264                        LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
265                        if test ! -z "$need_dash_r" ; then
266                                LDFLAGS="-R$ssldir/lib $LDFLAGS"
267                        fi
268                        CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
269                fi
270
271                # Basic test to check for compatible version and correct linking
272                # *does not* test for RSA - that comes later.
273                AC_TRY_RUN(
274                        [
275#include <string.h>
276#include <openssl/rand.h>
277int main(void)
278{
279        char a[2048];
280        memset(a, 0, sizeof(a));
281        RAND_add(a, sizeof(a), sizeof(a));
282        return(RAND_status() <= 0);
283}
284                        ],
285                        [
286                                SSL_MSG="yes"
287                        ], []
288                )
289
290                if test "x$SSL_MSG" != "xyes"
291                then
292                        continue
293                fi
294
295                # latest openssl version with engine
296                # properly integrated?
297                AC_MSG_CHECKING([for openssl version])
298                AC_TRY_RUN(
299                [
300#include <stdlib.h>
301#include <string.h>
302#include <openssl/opensslv.h>
303
304int main(void)
305{
306
307        if(OPENSSL_VERSION_NUMBER >= 0x0090704fL) {
308                exit(0);
309        } else {
310                exit(1);
311        }
312}
313                ],
314                [
315                        AC_MSG_RESULT("good, 0.9.7d or later")
316                        GOOD_OPENSSL=yes
317                ],
318                [
319                        AC_MSG_RESULT("not so good, 0.9.7d or later woudl be better")
320                        GOOD_OPENSSL=no
321                ]
322                )
323
324                if test "x$GOOD_OPENSSL" == "xyes"
325                then
326                        # engine has to be there and working
327                        LIBS="$saved_LIBS $LIBCRYPTO"
328                        AC_TRY_RUN(
329                        [
330#include <string.h>
331#include <openssl/opensslv.h>
332#include <openssl/engine.h>
333#include <openssl/rand.h>
334int main(void)
335{
336        char a[2048];
337        ENGINE *e;
338
339        e = ENGINE_new();
340        ENGINE_load_dynamic();
341        if (!e) return 1;
342        memset(a, 0, sizeof(a));
343        RAND_add(a, sizeof(a), sizeof(a));
344        return(RAND_status() <= 0);
345}
346                                ],
347                                [
348                                        ENGINE_MSG=yes
349                                        ENGINE_LINK="$LIBCRYPTO"
350                                ], [
351                                        # should never happen,
352                                        # every 0.9.7* version has engine
353                                        # support integrated, it can't
354                                        # be missing.
355  AC_MSG_ERROR([OpenSSL support broken: openssl >= 0.9.7d without engine detected.])
356                                ])
357                                break;
358                else
359                        # openssl found, but version less than 0.9.7d
360                       
361                        # openssl with engine support?
362                        LIBCRYPTOA="$ssldir/lib/libcrypto.a $LIBDL"
363                        LIBS="$saved_LIBS $LIBCRYPTOA"
364                        AC_TRY_RUN(
365                        [
366#include <string.h>
367#include <openssl/opensslv.h>
368#include <openssl/engine.h>
369#include <openssl/rand.h>
370int main(void)
371{
372        char a[2048];
373        ENGINE *e;
374
375        e = ENGINE_new();
376        ENGINE_load_dynamic();
377        if (!e) return 1;
378        memset(a, 0, sizeof(a));
379        RAND_add(a, sizeof(a), sizeof(a));
380        return(RAND_status() <= 0);
381}
382                        ],
383                        [
384                                ENGINE_MSG=yes
385                                ENGINE_LINK="$LIBCRYPTOA"
386                        ], []
387                )
388                break;
389                fi
390
391        done
392
393        if test "x$SSL_MSG" = "xyes" ; then
394                ac_cv_openssldir="$ssldir"
395        else
396                ac_cv_openssldir="no"
397        fi
398], [SSL_MSG=yes])
399CPPFLAGS="$saved_CPPFLAGS"
400LDFLAGS="$saved_LDFLAGS"
401LIBS="$saved_LIBS"
402
403if test "x$SSL_MSG" = "xyes" ; then
404  AC_DEFINE(HAVE_OPENSSL, 1, [Have OpenSSL libraries])
405else
406  LIBCRYPTO=""
407  LIBCRYPTOA=""
408  ENGINE_LINK=""
409fi
410AM_CONDITIONAL(HAVE_SSL, test "x$SSL_MSG" = "xyes")
411AM_CONDITIONAL(HAVE_ENGINE, test "x$ENGINE_MSG" = "xyes")
412
413AC_SUBST(OPENSSL_LDFLAGS)
414if test "x$ENGINE_MSG" = "xyes" ; then
415  for openssl_ldflag in "-Wl,-Bsymbolic" "-G -Wl,-Bsymbolic" "-shared -G -Wl,-Bsymbolic" "-Wl,-all_load"; do
416        AC_MSG_CHECKING([whether we can use $openssl_ldflag])
417        saved_CFLAGS=$CFLAGS
418        CFLAGS="$CFLAGS $openssl_ldflag"
419        AC_TRY_LINK(,[return 1],ac_cv_use_openssl_flag="yes",ac_cv_use_openssl_flag="no")
420        CFLAGS=$saved_CFLAGS
421        AC_MSG_RESULT($ac_cv_use_openssl_flag)
422        if test "$ac_cv_use_openssl_flag" = "yes"; then
423                OPENSSL_LDFLAGS="$openssl_ldflag"
424                break;
425        fi
426  done
427fi
428
429AC_ARG_WITH(pam-dir,
430        [  --with-pam-dir=PATH     Specify path for PAM installation libraries],
431        [
432                if test "x$withval" != "xno" ; then
433                        trypamdir=$withval
434                fi
435        ]
436)
437
438saved_LDFLAGS="$LDFLAGS"
439saved_CPPFLAGS="$CPPFLAGS"
440AC_CACHE_CHECK([for pam directory], ac_cv_pamdir, [
441        for pamdir in $trypamdir "" /usr/local /usr/pkg /opt ; do
442                # Skip directories if they don't exist
443                if test ! -z "$pamdir" -a ! -d "$pamdir/" ; then
444                        continue;
445                fi
446
447                CPPFLAGS="$saved_CPPFLAGS"
448                LDFLAGS="$saved_LDFLAGS"
449                if test ! -z "$pamdir" -a "x$pamdir" != "x/usr"; then
450                        LDFLAGS="-L$pamdir/lib $saved_LDFLAGS"
451                        if test ! -z "$need_dash_r" ; then
452                                LDFLAGS="-R$pamdir/lib $LDFLAGS"
453                        fi
454                        CPPFLAGS="-I$pamdir/include $saved_CPPFLAGS"
455                fi
456                break;
457        done
458
459        if test -z "$pamdir" ; then
460                pamdir="(system)"
461        fi
462        ac_cv_pamdir=$pamdir
463])
464
465dnl Check for PAM libs
466PAM_MSG="no"
467no_pam=""
468AC_SUBST(LIBPAM)
469saved_LIBS="$LIBS"
470AC_MSG_CHECKING([PAM support])
471AC_ARG_WITH(pam,
472        [  --with-pam              Enable PAM support],
473        [
474                if test "x$withval" = "xno" ; then
475                        AC_MSG_RESULT(disabled)
476                        no_pam=1
477                fi
478        ],
479)
480if test -z "$no_pam" ; then
481        if test "x$ac_cv_header_security_pam_appl_h" = "xyes" -o "x$ac_cv_header_pam_pam_appl_h" = "xyes"; then
482                AC_MSG_RESULT(yes)
483                PAM_MSG="yes"
484                AC_CHECK_LIB(pam, pam_set_item, [LIBPAM="$LIBPAM -lpam"], AC_MSG_ERROR([*** libpam missing]))
485                LIBS="$LIBS $LIBPAM"
486                AC_CHECK_FUNCS(pam_getenvlist)
487                AC_CHECK_FUNCS(pam_putenv)
488                disable_shadow=yes
489                AC_DEFINE(HAVE_PAM, 1, [Have Pluggable Authentication Modules])
490        else
491                AC_MSG_RESULT(no)
492        fi
493fi
494LIBS="$saved_LIBS"
495AM_CONDITIONAL(HAVE_PAM, test "x$PAM_MSG" = "xyes")
496
497dnl Check for SIA libs
498AC_SUBST(LIBSIA)
499SIA_MSG="no"
500no_osfsia=""
501AC_MSG_CHECKING([SIA support])
502AC_ARG_WITH(osfsia,
503        [  --with-osfsia           Enable Digital Unix SIA],
504        [
505                if test "x$withval" = "xno" ; then
506                        AC_MSG_RESULT(disabled)
507                        no_osfsia=1
508                fi
509        ],
510)
511if test -z "$no_osfsia" ; then
512        if test -f /etc/sia/matrix.conf; then
513                AC_MSG_RESULT(yes)
514                AC_DEFINE(HAVE_OSF_SIA, 1, [Have Digital Unix SIA])
515                LIBSIA="$LIBSIA -lsecurity -ldb -lm -laud"
516                SIA_MSG="yes"
517        else
518                AC_MSG_RESULT(no)
519        fi
520fi
521
522AM_CONDITIONAL(HAVE_SIA, test "x$SIA_MSG" = "xyes")
523
524PCSC_MSG=no
525pcsc_path=/usr
526AC_SUBST(PCSC_CFLAGS)
527AC_SUBST(PCSC_LIBS)
528
529case "$host" in
530*-*-darwin*)
531        PCSC_MSG=yes
532        PCSC_CFLAGS=""
533        PCSC_LIBS="-Wl,-framework,PCSC"
534        ;;
535esac
536
537saved_LIBS="$LIBS"
538saved_LDFLAGS="$LDFLAGS"
539saved_CPPFLAGS="$CPPFLAGS"
540AC_ARG_WITH(pcsclite,
541        [  --with-pcsclite=PATH    use PC/SC Lite in PATH],
542        [pcsc_path=$withval])
543if test "x$pcsc_path" = "xno"; then
544        PCSC_MSG="no"
545fi
546if test "x$pcsc_path" != "xno" -a "x$PCSC_MSG" != "xyes"; then
547        PKG_CHECK_MODULES(PCSC, libpcsclite, [
548                PCSC_MSG="yes"
549                AC_MSG_RESULT($PCSC_MSG)
550                ],[
551        AC_MSG_CHECKING(for PC/SC Lite support (old style))
552        for pcscdir in "" /pcsc /PCSC; do
553                CPPFLAGS="$saved_CPPFLAGS"
554                LDFLAGS="$saved_LDFLAGS"
555                LIBS="-lpcsclite $saved_LIBS"
556                PCSC_CFLAGS=""
557
558                for pcsc_libdir in $pcsc_path/lib$pcscdir \
559                              $pcsc_path$pcscdir/lib \
560                              $pcsc_path$pcscdir; do
561                        if test -d $pcsc_libdir; then
562                                if test -n "${need_dash_r}"; then
563                                        LDFLAGS="-R${pcsc_libdir}/ ${LDFLAGS}"
564                                fi
565                                LDFLAGS="-L${pcsc_libdir} ${LDFLAGS}"
566                        fi
567                done
568
569                for pcsc_incdir in $pcsc_path/include$pcscdir \
570                              $pcsc_path$pcscdir/include \
571                              $pcsc_path$pcscdir; do
572                      if test -d $pcsc_incdir; then
573                                PCSC_CFLAGS="-I${pcsc_incdir}"
574                                break;
575                      fi
576                done
577
578                CPPFLAGS="${PCSC_CFLAGS} ${CPPFLAGS}"
579                AC_TRY_LINK([#include <stdlib.h>
580#include <winscard.h>],[SCardEstablishContext(0, NULL, NULL, NULL);], ac_cv_lib_pcsclite_SCardEstablishContext=yes)
581                if test "x$ac_cv_lib_pcsclite_SCardEstablishContext" = "xyes"; then
582                        PCSC_MSG=yes
583                        break;
584                fi
585                CPPFLAGS="$saved_CPPFLAGS"
586                LDFLAGS="$saved_LDFLAGS"
587                LIBS="$saved_LIBS"
588                PCSC_CFLAGS=""
589        done
590        AC_MSG_RESULT($PCSC_MSG)
591        if test "x$PCSC_MSG" = "xyes" ; then
592                PCSC_LIBS="-lpcsclite"
593                CPPFLAGS="$saved_CPPFLAGS"
594                LIBS="$saved_LIBS"
595        fi
596        ])
597fi
598AM_CONDITIONAL(HAVE_PCSC, test "x$PCSC_MSG" = "xyes")
599if test "x$PCSC_MSG" = "xyes"; then
600        AC_DEFINE(HAVE_PCSC, 1, [Have PC/SC implementation])
601else
602        PCSC_LIBS=""
603        PCSC_CFLAGS=""
604fi
605
606if test "x$PCSC_MSG" = "xyes"; then
607        CFLAGS="$PCSC_CFLAGS $saved_CFLAGS"
608        LIBS="$PCSC_LIBS $saved_LIBS"
609        AC_TRY_LINK([
610#include <stdlib.h>
611#include <winscard.h>
612        ], [
613SCardControl(NULL, NULL, 0, NULL, 0);
614        ], [
615                AC_DEFINE(HAVE_PCSC_OLD, 1, [old version of pc/sc-lite])
616        ])     
617        CFLAGS="$saved_CFLAGS"
618        LIBS="$saved_LIBS"
619fi
620
621OPENCT_MSG=no
622openct_path=/usr
623AC_SUBST(OPENCT_CFLAGS)
624AC_SUBST(OPENCT_LDFLAGS)
625AC_SUBST(OPENCT_LIBS)
626
627saved_LIBS="$LIBS"
628saved_LDFLAGS="$LDFLAGS"
629saved_CFLAGS="$CFLAGS"
630AC_ARG_WITH(openct,
631        [  --with-openct=PATH      use OpenCT in PATH],
632        [openct_path=$withval])
633if test "x$openct_path" = "xno"; then
634        OPENCT_MSG="no"
635fi
636if test "x$openct_path" != "xno" -a "x$OPENCT_MSG" != "xyes"; then
637        PKG_CHECK_MODULES(OPENCT, libopenct, [
638                OPENCT_MSG="yes"
639                AC_MSG_RESULT($OPENCT_MSG)
640                ], [
641        AC_MSG_CHECKING(for OpenCT support (old style))
642        CPPFLAGS="$saved_CPPFLAGS"
643        LDFLAGS="$saved_LDFLAGS"
644        LIBS="$saved_LIBS"
645
646        OPENCT_CFLAGS="-I${openct_path}/include"
647        OPENCT_LIBS="-lopenct"
648        OPENCT_LDFLAGS=""
649        if test -n "${need_dash_r}"; then
650                OPENCT_LDFLAGS="-R${openct_path}/lib"
651        fi
652        OPENCT_LDFLAGS="-L${openct_path}/lib $OPENCT_LDFLAGS"
653
654        LIBS="$OPENCT_LIBS $saved_LIBS"
655        LDFLAGS="$OPENCT_LDFLAGS $saved_LDFLAGS"
656        CFLAGS="$OPENCT_CFLAGS $saved_CFLAGS"
657
658        AC_TRY_LINK([#include <openct/openct.h>],[ct_reader_connect(0);],OPENCT_MSG=yes,OPENCT_MSG=no)
659        AC_MSG_RESULT($OPENCT_MSG)
660
661        CFLAGS="$saved_CFLAGS"
662        LDFLAGS="$saved_LDFLAGS"
663        LIBS="$saved_LIBS"
664        ])
665fi
666
667AM_CONDITIONAL(HAVE_OPENCT, test "x$OPENCT_MSG" = "xyes")
668if test "x$OPENCT_MSG" = "xyes"; then
669        AC_DEFINE(HAVE_OPENCT, 1, [Have OpenCT libraries and header files])
670else
671        OPENCT_LDFLAGS=""
672        OPENCT_LIBS=""
673        OPENCT_CFLAGS=""
674fi
675
676# Check for user-specified random device, otherwise check /dev/urandom
677AC_ARG_WITH(random,
678        [  --with-random=FILE      read entropy from FILE (default=/dev/urandom)],
679        [
680                if test "x$withval" != "xno" ; then
681                        RANDOM_POOL="$withval";
682                        AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL", [Location of random number pool])
683                fi
684        ],
685        [
686                # Check for random device
687                AC_CHECK_FILE("/dev/urandom",
688                        [
689                                RANDOM_POOL="/dev/urandom";
690                                AC_SUBST(RANDOM_POOL)
691                                AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL", [Location of random number pool])
692                        ]
693                )
694        ]
695)
696
697# Check for PRNGD/EGD pool file
698AC_ARG_WITH(prngd-port,
699        [  --with-prngd-port=PORT  read entropy from PRNGD/EGD localhost:PORT],
700        [
701                if test ! -z "$withval" -a "x$withval" != "xno" ; then
702                        PRNGD_PORT="$withval"
703                        AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT, [Port number of PRNGD/EGD random number socket])
704                fi
705        ]
706)
707
708# Check for PRNGD/EGD pool file
709AC_ARG_WITH(prngd-socket,
710        [  --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
711        [
712                if test "x$withval" != "xno" ; then
713                        PRNGD_SOCKET="$withval"
714                        AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET", [Location of PRNGD/EGD random number socket])
715                fi
716        ],
717        [
718                # Check for existing socket only if we don't have a random device already
719                if test -z "$RANDOM_POOL" ; then
720                        AC_MSG_CHECKING(for PRNGD/EGD socket)
721                        # Insert other locations here
722                        for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy /tmp/entropy; do
723                                if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
724                                        PRNGD_SOCKET="$sock"
725                                        AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET", [Location of PRNGD/EGD random number socket])
726                                        break;
727                                fi
728                        done
729                        if test ! -z "$PRNGD_SOCKET" ; then
730                                AC_MSG_RESULT($PRNGD_SOCKET)
731                        else
732                                AC_MSG_RESULT(not found)
733                        fi
734                fi
735        ]
736)
737
738### BEGIN LDAP SPECIFIC OPTIONS
739dnl ldap autoconf magic partly taken from pam_ldap
740
741dnl --enable-ldap option.
742AC_ARG_ENABLE(ldap,
743[  --enable-ldap           enable use of LDAP for authentication. [default=yes]],
744        , enable_ldap=yes)
745AC_ARG_ENABLE(ldap-ssl, [  --disable-ldap-ssl      disable SSL/TSL support for ldap])
746AC_ARG_WITH(ldap-lib, [  --with-ldap-lib=type    select ldap library [auto|netscape5|netscape4|netscape3|umich|openldap]])
747AC_ARG_WITH(ldap-dir, [  --with-ldap-dir=DIR     base directory of ldap SDK])
748
749AC_SUBST(LIBLDAP)
750LDAP_MSG="no"
751if (test x$enable_ldap = xyes); then
752  if test -n "$with_ldap_dir"; then
753    CPPFLAGS="$CPPFLAGS -I$with_ldap_dir/include"
754    LDFLAGS="$LDFLAGS -L$with_ldap_dir/lib"
755    case "$target_os" in
756    solaris*) LDFLAGS="$LDFLAGS -Wl,-R$with_ldap_dir/lib" ;;
757    *) LDFLAGS="$LDFLAGS -Wl,-rpath,$with_ldap_dir/lib" ;;
758    esac
759  fi
760
761  AC_CHECK_HEADERS(lber.h ldap.h ldap_ssl.h)
762
763  dnl check which ldap library we have
764  if test -z "$with_ldap_lib"; then
765    with_ldap_lib=auto
766  fi
767
768  if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = umich -o $with_ldap_lib = openldap \); then
769    AC_CHECK_LIB(lber, ber_init, LIBLDAP="-llber $LIBLDAP" found_lber_lib=yes)
770    saved_LIBS="$LIBS"
771    LIBS="$LIBS $LIBLDAP"
772    AC_CHECK_LIB(ldap, ldap_search, LIBLDAP="-lldap $LIBLDAP" found_ldap_lib=yes)
773    AC_CHECK_LIB(ldap, ldap_start_tls_s, LIBLDAP="-lssl $LIBLDAP" need_ssl_lib=yes)
774    LIBS="$saved_LIBS"
775  fi
776  if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape5 \); then
777    AC_CHECK_LIB(ldap50, ldap_search, LIBLDAP="-lldap50 -lssldap50 -lssl3 -lnss3 -lnspr4 -lprldap50 -lplc4 -lplds4 $LIBLDAP" found_ldap_lib=yes need_pthread=true,, -lpthread)
778  fi
779  if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape4 \); then
780    AC_CHECK_LIB(ldapssl41, ldap_search, LIBLDAP="-lldapssl41 -lplc3 -lplds3 -lnspr3 $LIBLDAP" found_ldap_lib=yes need_pthread=true,, -lpthread)
781    if test -z "$found_ldap_lib"; then
782      AC_CHECK_LIB(ldapssl40, ldap_search, LIBLDAP="-lldapssl40 $LIBLDAP" found_ldap_lib=yes need_pthread=true,, -lpthread)
783    fi
784  fi
785  if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape3 \); then
786    AC_CHECK_LIB(ldapssl30, ldap_search, LIBLDAP="-lldapssl30 $LIBLDAP" found_ldap_lib=yes need_pthread=true,, -lpthread)
787  fi
788
789  if test -n "$found_ldap_lib" -a "x$ac_cv_header_ldap_h" = "xyes"; then
790    AC_DEFINE(LDAP_REFERRALS,1,[This is needed for the native Solaris LDAP SDK])
791    AC_DEFINE(HAVE_LDAP, 1, [Use LDAP for authentication etc.])
792    LDAP_MSG="yes"
793
794    saved_LIBS="$LIBS"
795    LIBS="$LIBS $LIBLDAP"
796    AC_CHECK_FUNCS(ldap_init)
797    if test "$enable_ldap_ssl" \!= "no"; then
798      AC_CHECK_FUNCS(ldapssl_init ldap_start_tls_s ldap_pvt_tls_set_option)
799    fi
800    LIBS="$saved_LIBS"
801  fi
802fi
803AM_CONDITIONAL(HAVE_LDAP, test "x$LDAP_MSG" = "xyes")
804### END LDAP SPECIFIC OPTIONS
805
806### BEGIN ASSUAN SPECIFIC OPTIONS
807ASSUAN_MSG="no"
808AC_SUBST(CFLAGS_ASSUAN)
809AC_SUBST(LIBASSUAN)
810LIBASSUAN="-lassuan"
811AC_ARG_WITH(assuan,
812        [  --with-assuan=PATH      use Assuan libraries in PATH],
813        [
814                if test -n "${need_dash_r}"; then
815                        LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
816                else
817                        LDFLAGS="-L${withval}/lib ${LDFLAGS}"
818                fi
819                CFLAGS_ASSUAN="-I${withval}/include ${CFLAGS_ASSUAN}"
820        ]
821)
822
823AC_CHECK_LIB(assuan, assuan_pipe_connect, ASSUAN_MSG="yes", ASSUAN_MSG="no")
824if test "x$ASSUAN_MSG" != "xno" ; then
825  saved_CPPFLAGS="$CPPFLAGS"
826  CPPFLAGS="$CFLAGS_ASSUAN $CPPFLAGS"
827  AC_CHECK_HEADER(assuan.h, ASSUAN_MSG="yes", ASSUAN_MSG="no")
828  CPPFLAGS="$saved_CPPFLAGS"
829fi
830AM_CONDITIONAL(HAVE_ASSUAN, test "x$ASSUAN_MSG" = "xyes")
831### END ASSUAN SPECIFIC OPTIONS
832
833PLUGINDIR="/usr/lib/mozilla/plugins"
834AC_ARG_WITH(plugin-dir,
835        [  --with-plugin-dir=PATH  install Mozilla plugin to PATH [[/usr/lib/mozilla/plugins]]],
836        [
837                PLUGINDIR="$withval"
838        ]
839)
840AC_SUBST(PLUGINDIR)
841
842BUNDLEDIR="${libdir}"
843AC_ARG_WITH(bundle-dir,
844        [  --with-bundle-dir=PATH  install MacOS X bundles to PATH [[EPREFIX/lib]]],
845        [
846                BUNDLEDIR="$withval"
847        ]
848)
849AC_SUBST(BUNDLEDIR)
850
851# Check for PIN entry program used by OpenSC Signer
852PIN_ENTRY="/usr/local/bin/gpinentry"
853AC_ARG_WITH(pin-entry,
854        [  --with-pin-entry=PROG   Run PROG as PIN-entry for OpenSC Signer],
855        [
856                if test ! -z "$withval" -a "x$withval" != "xno" ; then
857                        PIN_ENTRY="$withval"
858                fi
859        ]
860)
861AC_DEFINE_UNQUOTED(PIN_ENTRY, "$PIN_ENTRY", [PIN-entry program for OpenSC Signer])
862
863dnl Check for SGML processor
864AC_ARG_WITH(docbook,
865[  --without-docbook       do no generate html manual (needs docbook)],
866        with_docbook=$withval)
867AC_CHECK_PROG(XSLTPROC, xsltproc, xsltproc)
868if test "x$XSLTPROC" = "x"; then
869        if test "x$with_docbook" = "xyes"; then
870                AC_MSG_ERROR([Docbook support requested, but cannot find xsltproc])
871        fi
872        with_docbook=no
873fi
874AM_CONDITIONAL(HAVE_DOCBOOK, test "x$with_docbook" = "xyes")
875
876if test "x$prefix" = xNONE; then
877  prefix=$ac_default_prefix
878fi
879if test "x$exec_prefix" = xNONE; then
880  exec_prefix='${prefix}'
881fi
882
883dnl Enable/disable debugging messages.
884AC_ARG_ENABLE(debug,
885[  --enable-debug          enable debug messages. [default=no]],
886        , enable_debug=no)
887if (test x$enable_debug = xyes); then
888        AC_DEFINE(DEBUG, 1, [Enable debug messages.])
889fi
890
891CPPFLAGS="-I\${top_builddir}/src/include $CPPFLAGS"
892AM_CONDITIONAL(HAVE_BUNDLES, test "x$with_bundles" = "xyes")
893
894scldap_etc_path=`eval echo ${sysconfdir}` ; scldap_etc_path=`eval echo ${scldap_etc_path}`
895AC_DEFINE_UNQUOTED(SCLDAP_ETC_PATH, "$scldap_etc_path", [etc path for libscldap])
896scldap_conf_path=`eval echo ${scldap_etc_path}/scldap.conf`
897AC_DEFINE_UNQUOTED(SCLDAP_CONF_PATH, "$scldap_conf_path", [default config file for libscldap])
898
899opensc_etc_path=`eval echo ${sysconfdir}` ; opensc_etc_path=`eval echo ${opensc_etc_path}`
900AC_DEFINE_UNQUOTED(OPENSC_ETC_PATH, "$opensc_etc_path", [etc path for libopensc])
901opensc_conf_path=`eval echo ${opensc_etc_path}/opensc.conf`
902AC_DEFINE_UNQUOTED(OPENSC_CONF_PATH, "$opensc_conf_path", [default config file for libopensc])
903
904AC_SUBST(LIBSCCONF)
905LIBSCCONF="\${top_builddir}/src/scconf/libscconf.la"
906AC_SUBST(LIBSCLDAP)
907if test "x$LDAP_MSG" = "xyes" ; then
908  LIBSCLDAP="\${top_builddir}/src/scldap/libscldap.la"
909fi
910AC_SUBST(LIBOPENSC)
911LIBOPENSC="\${top_builddir}/src/libopensc/libopensc.la"
912
913# Pass information about installed OpenSC requirements, so that
914# a proper opensc-config file will be build.
915OPENSC_LIBS="-L${libdir} -lopensc"
916OPENSC_CFLAGS=""
917AC_SUBST(OPENSC_LIBS)
918AC_SUBST(OPENSC_CFLAGS)
919
920pkgdata=`eval echo ${datadir}/${PACKAGE}` ; pkgdata=`eval echo ${pkgdata}`
921AC_SUBST(pkgdata)
922
923AC_OUTPUT([
924Makefile
925aclocal/Makefile
926docs/Makefile
927docs/pkcs15-profile.5
928etc/Makefile
929macos/Makefile
930src/Makefile
931src/common/Makefile
932src/include/Makefile
933src/include/opensc/Makefile
934src/include/opensc/rsaref/Makefile
935src/libopensc/Makefile
936src/libopensc/opensc-config
937src/libopensc/libopensc.pc
938src/openscd/Makefile
939src/openssh/Makefile
940src/pam/Makefile
941src/pkcs11/Makefile
942src/pkcs11/rsaref/Makefile
943src/pkcs15init/Makefile
944src/scam/Makefile
945src/scconf/Makefile
946src/scdl/Makefile
947src/scldap/Makefile
948src/scrandom/Makefile
949src/sia/Makefile
950src/signer/Makefile
951src/signer/npinclude/Makefile
952src/sslengines/Makefile
953src/tests/Makefile
954src/tests/regression/Makefile
955src/tools/Makefile
956win32/Makefile
957])
958
959if test ! -z "$RANDOM_POOL" ; then
960        RAND_MSG="device ($RANDOM_POOL)"
961else
962        if test ! -z "$PRNGD_PORT" ; then
963                RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
964        elif test ! -z "$PRNGD_SOCKET" ; then
965                RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
966        else
967                RAND_MSG="Builtin kluge"
968                BUILTIN_RNG=1
969        fi
970fi
971
972dnl Someone please show me a better way :)
973A=`eval echo ${prefix}` ; A=`eval echo ${A}`
974B=`eval echo ${bindir}` ; B=`eval echo ${B}`
975C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
976
977echo ""
978echo "OpenSC has been configured with the following options"
979
980echo ""
981echo "User binaries:       ${B}"
982echo "Configuration files: ${C}"
983
984echo ""
985echo "Host:                ${host}"
986echo "Compiler:            ${CC}"
987echo "Compiler flags:      ${CFLAGS}"
988echo "Preprocessor flags:  ${CPPFLAGS}"
989echo "Linker flags:        ${LDFLAGS}"
990echo "Libraries:           ${LIBS}"
991
992echo ""
993echo "Random number collection: ${RAND_MSG}"
994echo "OpenSSL support:          ${SSL_MSG}"
995echo "        with engine:      ${ENGINE_MSG}"
996echo "PC/SC support:            ${PCSC_MSG}"
997echo "OpenCT support:           ${OPENCT_MSG}"
998echo "Assuan support:           ${ASSUAN_MSG}"
999echo "LDAP support:             ${LDAP_MSG}"
1000echo "PAM support:              ${PAM_MSG}"
1001case "$host" in
1002*-*-osf*)
1003        echo "SIA support:              ${SIA_MSG}"
1004        ;;
1005esac
1006echo ""
1007
1008if test "x$ENGINE_MSG" = "xno" -a "x$SSL_MSG" = "xyes"; then
1009  echo "OpenSSL was found. But to use the engine you will need"
1010  echo "version 0.9.7a or later."
1011fi
1012
1013if test ! -z "$BUILTIN_RNG"; then
1014  echo "WARNING: you are using the builtin random number service."
1015  echo "The random number service is very simple and is only"
1016  echo "intended for testing purposes. Please request your OS"
1017  echo "vendor to include /dev/random in future versions of"
1018  echo "their OS. Or use PRNGD/EGD instead, your choice."
1019fi
Note: See TracBrowser for help on using the browser.