root/releases/opensc-0.9.5/configure.in

Revision 2070, 27.9 KB (checked in by aj, 4 years ago)

clean LIBS after trying libcrypto.a

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