root/releases/opensc-0.9.3/configure.in

Revision 1957, 26.9 KB (checked in by anonymous, 4 years ago)

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

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