root/releases/opensc-0.9.0/configure.in

Revision 1813, 26.0 KB (checked in by anonymous, 5 years ago)

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

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