root/releases/opensc-0.8.1/configure.in

Revision 1470, 25.3 KB (checked in by aet, 5 years ago)

Rename HAVE_PCSCLITE to HAVE_PCSC, which is more correct.

  • 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.8.1)
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 Checks for programs.
102AC_PROG_CPP
103AC_PROG_INSTALL
104AC_PROG_LN_S
105AC_PROG_MAKE_SET
106AM_PROG_LEX
107AC_PATH_PROG(TEST_MINUS_S_SH, bash)
108AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
109AC_PATH_PROG(TEST_MINUS_S_SH, sh)
110
111dnl Special check for pthread support.
112ACX_PTHREAD(
113[
114 AC_DEFINE(HAVE_PTHREAD,1,
115  [Define if you have POSIX threads libraries and header files.])
116], [
117 AC_MSG_ERROR([POSIX thread support required])
118])
119LIBS="$PTHREAD_LIBS $LIBS"
120CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
121CC="$PTHREAD_CC"
122
123dnl Add libtool support.
124AM_PROG_LIBTOOL
125dnl Automatically update the libtool script if it becomes out-of-date.
126#AC_SUBST(LIBTOOL_DEPS)
127
128dnl Checks for header files.
129AC_HEADER_STDC
130AC_HEADER_SYS_WAIT
131AC_CHECK_HEADERS([errno.h fcntl.h malloc.h stdlib.h string.h strings.h sys/time.h unistd.h getopt.h dlfcn.h utmp.h security/pam_appl.h security/_pam_macros.h pam/pam_appl.h pam/_pam_macros.h])
132
133dnl Checks for typedefs, structures, and compiler characteristics.
134AC_C_CONST
135AC_TYPE_UID_T
136AC_TYPE_SIZE_T
137AC_HEADER_TIME
138
139dnl Checks for library functions.
140AC_FUNC_ERROR_AT_LINE
141AC_FUNC_STAT
142AC_FUNC_VPRINTF
143AC_CHECK_FUNCS([getpass gettimeofday memset mkdir strdup strerror setutent])
144
145dnl C Compiler features
146AC_C_INLINE
147if test "$GCC" = "yes"; then
148        CFLAGS="-Wall $CFLAGS"
149fi
150
151AC_SUBST(LIBDL)
152AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no)
153
154dnl See if socket() is found from libsocket
155AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket" ac_cv_func_socket_in_lsocket=yes], ac_cv_func_socket_in_lsocket=no)
156
157ac_cv_func_res_query_in_lresolv=no
158if test x$ac_cv_func_socket_in_lsocket = xyes; then
159  AC_CHECK_LIB(resolv, res_query, [LIBS="$LIBS -lresolv" ac_cv_func_res_query_in_lresolv=yes])
160fi
161
162AC_SUBST(GETOPTSRC)
163AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define if you have the `getopt_long' function.]),
164              [GETOPTSRC="$GETOPTSRC \$(top_srcdir)/src/common/getopt.c \$(top_srcdir)/src/common/getopt1.c"
165               CPPFLAGS="-I\$(top_srcdir)/src/common $CPPFLAGS"
166               AC_DEFINE(HAVE_GETOPT_H, 1, [Define if you have the <getopt.h> header file.])])
167
168AC_CHECK_HEADERS([readline/readline.h])
169AC_SUBST(LIBREADLINE)
170saved_LIBS="$LIBS"
171# libreadline will also need libtermcap on some OSes
172for add in "" "-ltermcap"; do
173        if test "x$add" != x; then
174                AC_MSG_CHECKING([for readline with])
175                AC_MSG_RESULT($add)
176        fi
177        LIBS="$saved_LIBS $add"
178        unset ac_cv_lib_readline_readline
179        AC_CHECK_LIB(readline, readline, [
180                LIBREADLINE="-lreadline $add"
181                ac_cv_func_readline_lreadline=yes
182        ], ac_cv_func_readline_lreadline=no)
183        test "x$ac_cv_func_readline_lreadline" = xyes && break
184done
185LIBS="$LIBS $LIBREADLINE"
186AC_CHECK_FUNCS(readline)
187LIBS="$saved_LIBS"
188
189AC_ARG_WITH(flex-dir,
190        [  --with-flex-dir=PATH    Specify path to flex installation],
191        [
192                if test "x$withval" != "xno" ; then
193                        tryflexdir=$withval
194                fi
195        ]
196)
197
198saved_LDFLAGS="$LDFLAGS"
199saved_CPPFLAGS="$CPPFLAGS"
200AC_SUBST(LIBFL)
201AC_CACHE_CHECK([for flex directory], ac_cv_flexdir, [
202        for flexdir in $tryflexdir "" /usr/local/flex /usr/lib/flex /usr/local/flex /usr/lib/flex /usr/local /usr/pkg /opt /opt/flex ; do
203                # Skip directories if they don't exist
204                if test ! -z "$flexdir" -a ! -d "$flexdir/" ; then
205                        continue;
206                fi
207
208                LIBFL="-lfl"
209                CPPFLAGS="$saved_CPPFLAGS"
210                LDFLAGS="$saved_LDFLAGS"
211                if test ! -z "$flexdir" -a "x$flexdir" != "x/usr"; then
212                        LDFLAGS="-L$flexdir/lib $saved_LDFLAGS"
213                        if test ! -z "$need_dash_r" ; then
214                                LDFLAGS="-R$flexdir/lib $LDFLAGS"
215                        fi
216                        CPPFLAGS="-I$flexdir/include $saved_CPPFLAGS"
217                fi
218                break;
219        done
220
221        if test -z "$flexdir" ; then
222                flexdir="(system)"
223        fi
224        ac_cv_flexdir=$flexdir
225])
226
227dnl The big mess with OpenSSL
228AC_ARG_WITH(openssl,
229        [  --with-openssl=PATH     use OpenSSL in PATH],
230        [tryssldir=$withval])
231
232SSL_MSG="no"
233ENGINE_MSG="no"
234saved_LIBS="$LIBS"
235saved_LDFLAGS="$LDFLAGS"
236saved_CPPFLAGS="$CPPFLAGS"
237AC_SUBST(LIBCRYPTO)
238AC_SUBST(LIBCRYPTOA)
239AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
240        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
241                # Skip empty variables
242                if test -z "$ssldir"; then
243                        continue;
244                fi
245                # Disable OpenSSL support
246                if test "x$ssldir" = "xno" ; then
247                        SSL_MSG="no (disabled)"
248                        ENGINE_MSG="no (disabled)"
249                        break;
250                fi
251                # Skip directories if they don't exist
252                if test ! -d "$ssldir/" ; then
253                        continue;
254                fi
255                LIBCRYPTO="-lcrypto"
256                CPPFLAGS="$saved_CPPFLAGS"
257                LDFLAGS="$saved_LDFLAGS"
258                LIBS="$saved_LIBS $LIBCRYPTO"
259
260                if test "x$ssldir" != "x/usr"; then
261                        LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
262                        if test ! -z "$need_dash_r" ; then
263                                LDFLAGS="-R$ssldir/lib $LDFLAGS"
264                        fi
265                        CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
266                fi
267
268                # Basic test to check for compatible version and correct linking
269                # *does not* test for RSA - that comes later.
270                AC_TRY_RUN(
271                        [
272#include <string.h>
273#include <openssl/rand.h>
274int main(void)
275{
276        char a[2048];
277        memset(a, 0, sizeof(a));
278        RAND_add(a, sizeof(a), sizeof(a));
279        return(RAND_status() <= 0);
280}
281                        ],
282                        [
283                                SSL_MSG="yes"
284                        ], []
285                )
286
287                if test "x$SSL_MSG" = "xyes" ; then
288                        # openssl with engine support?
289                        LIBCRYPTOA="$ssldir/lib/libcrypto.a $LIBDL"
290                        LIBS="$saved_LIBS $LIBCRYPTOA"
291                        AC_TRY_RUN(
292                        [
293#include <string.h>
294#include <openssl/opensslv.h>
295#include <openssl/engine.h>
296#include <openssl/rand.h>
297int main(void)
298{
299        char a[2048];
300        ENGINE *e;
301
302        e = ENGINE_new();
303        ENGINE_load_dynamic();
304        if (!e) return 1;
305        memset(a, 0, sizeof(a));
306        RAND_add(a, sizeof(a), sizeof(a));
307        return(RAND_status() <= 0);
308}
309                        ],
310                        [
311                                ENGINE_MSG=yes
312                        ], []
313                )
314                fi
315
316                if test "x$SSL_MSG" = "xyes" ; then
317                        break;
318                fi
319                CPPFLAGS="$saved_CPPFLAGS"
320                LDFLAGS="$saved_LDFLAGS"
321                LIBS="$saved_LIBS"
322        done
323
324        if test "x$SSL_MSG" = "xyes" ; then
325                ac_cv_openssldir="$ssldir"
326        else
327                ac_cv_openssldir="no"
328        fi
329], [SSL_MSG=yes])
330LIBS="$saved_LIBS"
331
332if test "x$SSL_MSG" = "xyes" ; then
333  AC_DEFINE(HAVE_OPENSSL, 1, [Have OpenSSL libraries])
334else
335  LIBCRYPTO=""
336  LIBCRYPTOA=""
337fi
338AM_CONDITIONAL(HAVE_SSL, test "x$SSL_MSG" = "xyes")
339AM_CONDITIONAL(HAVE_ENGINE, test "x$ENGINE_MSG" = "xyes")
340
341AC_SUBST(OPENSSL_LDFLAGS)
342if test "x$ENGINE_MSG" = "xyes" ; then
343  for openssl_ldflag in "-Wl,-Bsymbolic" "-G -Wl,-Bsymbolic" "-shared -G -Wl,-Bsymbolic" "-Wl,-all_load"; do
344        AC_MSG_CHECKING([whether we can use $openssl_ldflag])
345        saved_CFLAGS=$CFLAGS
346        CFLAGS="$CFLAGS $openssl_ldflag"
347        AC_TRY_LINK(,[return 1],ac_cv_use_openssl_flag="yes",ac_cv_use_openssl_flag="no")
348        CFLAGS=$saved_CFLAGS
349        AC_MSG_RESULT($ac_cv_use_openssl_flag)
350        if test "$ac_cv_use_openssl_flag" = "yes"; then
351                OPENSSL_LDFLAGS="$openssl_ldflag"
352                break;
353        fi
354  done
355fi
356
357AC_ARG_WITH(pam-dir,
358        [  --with-pam-dir=PATH     Specify path for PAM installation libraries],
359        [
360                if test "x$withval" != "xno" ; then
361                        trypamdir=$withval
362                fi
363        ]
364)
365
366saved_LDFLAGS="$LDFLAGS"
367saved_CPPFLAGS="$CPPFLAGS"
368AC_CACHE_CHECK([for pam directory], ac_cv_pamdir, [
369        for pamdir in $trypamdir "" /usr/local /usr/pkg /opt ; do
370                # Skip directories if they don't exist
371                if test ! -z "$pamdir" -a ! -d "$pamdir/" ; then
372                        continue;
373                fi
374
375                CPPFLAGS="$saved_CPPFLAGS"
376                LDFLAGS="$saved_LDFLAGS"
377                if test ! -z "$pamdir" -a "x$pamdir" != "x/usr"; then
378                        LDFLAGS="-L$pamdir/lib $saved_LDFLAGS"
379                        if test ! -z "$need_dash_r" ; then
380                                LDFLAGS="-R$pamdir/lib $LDFLAGS"
381                        fi
382                        CPPFLAGS="-I$pamdir/include $saved_CPPFLAGS"
383                fi
384                break;
385        done
386
387        if test -z "$pamdir" ; then
388                pamdir="(system)"
389        fi
390        ac_cv_pamdir=$pamdir
391])
392
393dnl Check for PAM libs
394PAM_MSG="no"
395no_pam=""
396AC_SUBST(LIBPAM)
397saved_LIBS="$LIBS"
398AC_MSG_CHECKING([PAM support])
399AC_ARG_WITH(pam,
400        [  --with-pam              Enable PAM support],
401        [
402                if test "x$withval" = "xno" ; then
403                        AC_MSG_RESULT(disabled)
404                        no_pam=1
405                fi
406        ],
407)
408if test -z "$no_pam" ; then
409        if test "x$ac_cv_header_security_pam_appl_h" = "xyes" -o "x$ac_cv_header_pam_pam_appl_h" = "xyes"; then
410                AC_MSG_RESULT(yes)
411                PAM_MSG="yes"
412                AC_CHECK_LIB(pam, pam_set_item, [LIBPAM="$LIBPAM -lpam"], AC_MSG_ERROR([*** libpam missing]))
413                LIBS="$LIBS $LIBPAM"
414                AC_CHECK_FUNCS(pam_getenvlist)
415                AC_CHECK_FUNCS(pam_putenv)
416                disable_shadow=yes
417                AC_DEFINE(HAVE_PAM, 1, [Have Pluggable Authentication Modules])
418        else
419                AC_MSG_RESULT(no)
420        fi
421fi
422LIBS="$saved_LIBS"
423AM_CONDITIONAL(HAVE_PAM, test "x$PAM_MSG" = "xyes")
424
425dnl Check for SIA libs
426AC_SUBST(LIBSIA)
427SIA_MSG="no"
428no_osfsia=""
429AC_MSG_CHECKING([SIA support])
430AC_ARG_WITH(osfsia,
431        [  --with-osfsia           Enable Digital Unix SIA],
432        [
433                if test "x$withval" = "xno" ; then
434                        AC_MSG_RESULT(disabled)
435                        no_osfsia=1
436                fi
437        ],
438)
439if test -z "$no_osfsia" ; then
440        if test -f /etc/sia/matrix.conf; then
441                AC_MSG_RESULT(yes)
442                AC_DEFINE(HAVE_OSF_SIA, 1, [Have Digital Unix SIA])
443                LIBSIA="$LIBSIA -lsecurity -ldb -lm -laud"
444                SIA_MSG="yes"
445        else
446                AC_MSG_RESULT(no)
447        fi
448fi
449
450AM_CONDITIONAL(HAVE_SIA, test "x$SIA_MSG" = "xyes")
451
452PCSC_MSG=no
453pcsc_path=/usr
454AC_SUBST(CFLAGS_PCSC)
455AC_SUBST(LIBPCSC)
456
457case "$host" in
458*-*-darwin*)
459        PCSC_MSG=yes
460        CFLAGS_PCSC=""
461        LIBPCSC="-Wl,-framework,PCSC"
462        ;;
463esac
464
465saved_LIBS="$LIBS"
466saved_LDFLAGS="$LDFLAGS"
467saved_CPPFLAGS="$CPPFLAGS"
468AC_ARG_WITH(pcsclite,
469        [  --with-pcsclite=PATH    use PC/SC Lite in PATH],
470        [pcsc_path=$withval])
471if test "x$pcsc_path" = "xno"; then
472        PCSC_MSG="no"
473fi
474if test "x$pcsc_path" != "xno" -a "x$PCSC_MSG" != "xyes"; then
475        AC_MSG_CHECKING(for PC/SC-Lite support)
476        for pcscdir in /pcsc ""; do
477                CPPFLAGS="$saved_CPPFLAGS"
478                LDFLAGS="$saved_LDFLAGS"
479                LIBS="-lpcsclite $saved_LIBS"
480                CFLAGS_PCSC=""
481
482                for pcsc_libdir in $pcsc_path/lib$pcscdir \
483                              $pcsc_path$pcscdir/lib \
484                              $pcsc_path$pcscdir; do
485                        if test -d $pcsc_libdir; then
486                                if test -n "${need_dash_r}"; then
487                                        LDFLAGS="-R${pcsc_libdir}/ ${LDFLAGS}"
488                                fi
489                                LDFLAGS="-L${pcsc_libdir} ${LDFLAGS}"
490                        fi
491                done
492
493                for pcsc_incdir in $pcsc_path/include$pcscdir \
494                              $pcsc_path$pcscdir/include \
495                              $pcsc_path$pcscdir; do
496                      if test -d $pcsc_incdir; then
497                                CFLAGS_PCSC="-I${pcsc_incdir}"
498                                break;
499                      fi
500                done
501
502                CPPFLAGS="${CFLAGS_PCSC} ${CPPFLAGS}"
503                AC_TRY_LINK([#include <stdlib.h>
504#include <winscard.h>],[SCardEstablishContext(0, NULL, NULL, NULL);], ac_cv_lib_pcsclite_SCardEstablishContext=yes)
505                if test "x$ac_cv_lib_pcsclite_SCardEstablishContext" = "xyes"; then
506                        PCSC_MSG=yes
507                        break;
508                fi
509                CPPFLAGS="$saved_CPPFLAGS"
510                LDFLAGS="$saved_LDFLAGS"
511                LIBS="$saved_LIBS"
512                CFLAGS_PCSC=""
513        done
514        AC_MSG_RESULT($PCSC_MSG)
515        if test "x$PCSC_MSG" = "xyes" ; then
516                LIBPCSC="-lpcsclite"
517                CPPFLAGS="$saved_CPPFLAGS"
518                LIBS="$saved_LIBS"
519        fi
520fi
521AM_CONDITIONAL(HAVE_PCSC, test "x$PCSC_MSG" = "xyes")
522if test "x$PCSC_MSG" = "xyes"; then
523        AC_DEFINE(HAVE_PCSC, 1, [Have PC/SC implementation])
524else
525        LIBPCSC=""
526        CFLAGS_PCSC=""
527fi
528
529dnl --enable-usbtoken option.
530AC_ARG_ENABLE(usbtoken, AC_HELP_STRING(
531[--enable-usbtoken],    [enable the usbtoken reader backed. [default=no]]),
532        , enable_usbtoken=no)
533if test "x$enable_usbtoken" = "xyes"; then
534        AC_DEFINE(HAVE_USBTOKEN, 1, [Enable usbtoken support])
535        USBTOKEN_MSG=yes
536else
537        USBTOKEN_MSG=no
538fi
539AM_CONDITIONAL(HAVE_USBTOKEN, test "x$USBTOKEN_MSG" = "xyes")
540
541OPENCT_MSG=no
542openct_path=/usr
543AC_SUBST(OPENCT_CFLAGS)
544AC_SUBST(OPENCT_LDFLAGS)
545AC_SUBST(OPENCT_LIBS)
546
547saved_LIBS="$LIBS"
548saved_LDFLAGS="$LDFLAGS"
549saved_CFLAGS="$CFLAGS"
550AC_ARG_WITH(openct,
551        [  --with-openct=PATH      use OpenCT in PATH],
552        [openct_path=$withval])
553if test "x$openct_path" = "xno"; then
554        OPENCT_MSG="no"
555fi
556if test "x$openct_path" != "xno" -a "x$OPENCT_MSG" != "xyes"; then
557        AC_MSG_CHECKING(for OpenCT support)
558        CPPFLAGS="$saved_CPPFLAGS"
559        LDFLAGS="$saved_LDFLAGS"
560        LIBS="$saved_LIBS"
561
562        OPENCT_CFLAGS="-I${openct_path}/include"
563        OPENCT_LIBS="-lopenct"
564        OPENCT_LDFLAGS=""
565        if test -n "${need_dash_r}"; then
566                OPENCT_LDFLAGS="-R${openct_path}/lib"
567        fi
568        OPENCT_LDFLAGS="-L${openct_path}/lib $OPENCT_LDFLAGS"
569
570        LIBS="$OPENCT_LIBS $saved_LIBS"
571        LDFLAGS="$OPENCT_LDFLAGS $saved_LDFLAGS"
572        CFLAGS="$OPENCT_CFLAGS $saved_CFLAGS"
573
574        AC_TRY_LINK([#include <openct/openct.h>],[ct_reader_connect(0);],OPENCT_MSG=yes,OPENCT_MSG=no)
575        AC_MSG_RESULT($OPENCT_MSG)
576
577        CFLAGS="$saved_CFLAGS"
578        LDFLAGS="$saved_LDFLAGS"
579        LIBS="$saved_LIBS"
580fi
581
582AM_CONDITIONAL(HAVE_OPENCT, test "x$OPENCT_MSG" = "xyes")
583if test "x$OPENCT_MSG" = "xyes"; then
584        AC_DEFINE(HAVE_OPENCT, 1, [Have OpenCT libraries and header files])
585else
586        OPENCT_LDFLAGS=""
587        OPENCT_LIBS=""
588        OPENCT_CFLAGS=""
589fi
590
591# Check for user-specified random device, otherwise check /dev/urandom
592AC_ARG_WITH(random,
593        [  --with-random=FILE      read entropy from FILE (default=/dev/urandom)],
594        [
595                if test "x$withval" != "xno" ; then
596                        RANDOM_POOL="$withval";
597                        AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL", [Location of random number pool])
598                fi
599        ],
600        [
601                # Check for random device
602                AC_CHECK_FILE("/dev/urandom",
603                        [
604                                RANDOM_POOL="/dev/urandom";
605                                AC_SUBST(RANDOM_POOL)
606                                AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL", [Location of random number pool])
607                        ]
608                )
609        ]
610)
611
612# Check for PRNGD/EGD pool file
613AC_ARG_WITH(prngd-port,
614        [  --with-prngd-port=PORT  read entropy from PRNGD/EGD localhost:PORT],
615        [
616                if test ! -z "$withval" -a "x$withval" != "xno" ; then
617                        PRNGD_PORT="$withval"
618                        AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT, [Port number of PRNGD/EGD random number socket])
619                fi
620        ]
621)
622
623# Check for PRNGD/EGD pool file
624AC_ARG_WITH(prngd-socket,
625        [  --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
626        [
627                if test "x$withval" != "xno" ; then
628                        PRNGD_SOCKET="$withval"
629                        AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET", [Location of PRNGD/EGD random number socket])
630                fi
631        ],
632        [
633                # Check for existing socket only if we don't have a random device already
634                if test -z "$RANDOM_POOL" ; then
635                        AC_MSG_CHECKING(for PRNGD/EGD socket)
636                        # Insert other locations here
637                        for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy /tmp/entropy; do
638                                if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
639                                        PRNGD_SOCKET="$sock"
640                                        AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET", [Location of PRNGD/EGD random number socket])
641                                        break;
642                                fi
643                        done
644                        if test ! -z "$PRNGD_SOCKET" ; then
645                                AC_MSG_RESULT($PRNGD_SOCKET)
646                        else
647                                AC_MSG_RESULT(not found)
648                        fi
649                fi
650        ]
651)
652
653### BEGIN LDAP SPECIFIC OPTIONS
654dnl ldap autoconf magic partly taken from pam_ldap
655
656dnl --enable-ldap option.
657AC_ARG_ENABLE(ldap,
658[  --enable-ldap           enable use of LDAP for authentication. [default=yes]],
659        , enable_ldap=yes)
660AC_ARG_ENABLE(ldap-ssl, [  --disable-ldap-ssl      disable SSL/TSL support for ldap])
661AC_ARG_WITH(ldap-lib, [  --with-ldap-lib=type    select ldap library [auto|netscape5|netscape4|netscape3|umich|openldap]])
662AC_ARG_WITH(ldap-dir, [  --with-ldap-dir=DIR     base directory of ldap SDK])
663
664AC_SUBST(LIBLDAP)
665LDAP_MSG="no"
666if (test x$enable_ldap = xyes); then
667  if test -n "$with_ldap_dir"; then
668    CPPFLAGS="$CPPFLAGS -I$with_ldap_dir/include"
669    LDFLAGS="$LDFLAGS -L$with_ldap_dir/lib"
670    case "$target_os" in
671    solaris*) LDFLAGS="$LDFLAGS -Wl,-R$with_ldap_dir/lib" ;;
672    *) LDFLAGS="$LDFLAGS -Wl,-rpath,$with_ldap_dir/lib" ;;
673    esac
674  fi
675
676  AC_CHECK_HEADERS(lber.h ldap.h ldap_ssl.h)
677
678  dnl check which ldap library we have
679  if test -z "$with_ldap_lib"; then
680    with_ldap_lib=auto
681  fi
682
683  if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = umich -o $with_ldap_lib = openldap \); then
684    AC_CHECK_LIB(lber, ber_init, LIBLDAP="-llber $LIBLDAP" found_lber_lib=yes)
685    saved_LIBS="$LIBS"
686    LIBS="$LIBS $LIBLDAP"
687    AC_CHECK_LIB(ldap, ldap_search, LIBLDAP="-lldap $LIBLDAP" found_ldap_lib=yes)
688    AC_CHECK_LIB(ldap, ldap_start_tls_s, LIBLDAP="-lssl $LIBLDAP" need_ssl_lib=yes)
689    LIBS="$saved_LIBS"
690  fi
691  if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape5 \); then
692    AC_CHECK_LIB(ldap50, ldap_search, LIBLDAP="-lldap50 -lssldap50 -lssl3 -lnss3 -lnspr4 -lprldap50 -lplc4 -lplds4 $LIBLDAP" found_ldap_lib=yes need_pthread=true,, -lpthread)
693  fi
694  if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape4 \); then
695    AC_CHECK_LIB(ldapssl41, ldap_search, LIBLDAP="-lldapssl41 -lplc3 -lplds3 -lnspr3 $LIBLDAP" found_ldap_lib=yes need_pthread=true,, -lpthread)
696    if test -z "$found_ldap_lib"; then
697      AC_CHECK_LIB(ldapssl40, ldap_search, LIBLDAP="-lldapssl40 $LIBLDAP" found_ldap_lib=yes need_pthread=true,, -lpthread)
698    fi
699  fi
700  if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape3 \); then
701    AC_CHECK_LIB(ldapssl30, ldap_search, LIBLDAP="-lldapssl30 $LIBLDAP" found_ldap_lib=yes need_pthread=true,, -lpthread)
702  fi
703
704  if test -n "$found_ldap_lib" -a "x$ac_cv_header_ldap_h" = "xyes"; then
705    AC_DEFINE(LDAP_REFERRALS,1,[This is needed for the native Solaris LDAP SDK])
706    AC_DEFINE(HAVE_LDAP, 1, [Use LDAP for authentication etc.])
707    LDAP_MSG="yes"
708
709    saved_LIBS="$LIBS"
710    LIBS="$LIBS $LIBLDAP"
711    AC_CHECK_FUNCS(ldap_init)
712    if test "$enable_ldap_ssl" \!= "no"; then
713      AC_CHECK_FUNCS(ldapssl_init ldap_start_tls_s ldap_pvt_tls_set_option)
714    fi
715    LIBS="$saved_LIBS"
716  fi
717fi
718AM_CONDITIONAL(HAVE_LDAP, test "x$LDAP_MSG" = "xyes")
719### END LDAP SPECIFIC OPTIONS
720
721### BEGIN ASSUAN SPECIFIC OPTIONS
722ASSUAN_MSG="no"
723AC_SUBST(CFLAGS_ASSUAN)
724AC_SUBST(LIBASSUAN)
725LIBASSUAN="-lassuan"
726AC_ARG_WITH(assuan,
727        [  --with-assuan=PATH      use Assuan libraries in PATH],
728        [
729                if test -n "${need_dash_r}"; then
730                        LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
731                else
732                        LDFLAGS="-L${withval}/lib ${LDFLAGS}"
733                fi
734                CFLAGS_ASSUAN="-I${withval}/include ${CFLAGS_ASSUAN}"
735        ]
736)
737
738AC_CHECK_LIB(assuan, assuan_pipe_connect, ASSUAN_MSG="yes", ASSUAN_MSG="no")
739if test "x$ASSUAN_MSG" != "xno" ; then
740  saved_CPPFLAGS="$CPPFLAGS"
741  CPPFLAGS="$CFLAGS_ASSUAN $CPPFLAGS"
742  AC_CHECK_HEADER(assuan.h, ASSUAN_MSG="yes", ASSUAN_MSG="no")
743  CPPFLAGS="$saved_CPPFLAGS"
744fi
745AM_CONDITIONAL(HAVE_ASSUAN, test "x$ASSUAN_MSG" = "xyes")
746### END ASSUAN SPECIFIC OPTIONS
747
748PLUGINDIR="/usr/lib/mozilla/plugins"
749AC_ARG_WITH(plugin-dir,
750        [  --with-plugin-dir=PATH  install Mozilla plugin to PATH [[/usr/lib/mozilla/plugins]]],
751        [
752                PLUGINDIR="$withval"
753        ]
754)
755AC_SUBST(PLUGINDIR)
756
757BUNDLEDIR="${libdir}"
758AC_ARG_WITH(bundle-dir,
759        [  --with-bundle-dir=PATH  install MacOS X bundles to PATH [[EPREFIX/lib]]],
760        [
761                BUNDLEDIR="$withval"
762        ]
763)
764AC_SUBST(BUNDLEDIR)
765
766# Check for PIN entry program used by OpenSC Signer
767PIN_ENTRY="/usr/local/bin/gpinentry"
768AC_ARG_WITH(pin-entry,
769        [  --with-pin-entry=PROG   Run PROG as PIN-entry for OpenSC Signer],
770        [
771                if test ! -z "$withval" -a "x$withval" != "xno" ; then
772                        PIN_ENTRY="$withval"
773                fi
774        ]
775)
776AC_DEFINE_UNQUOTED(PIN_ENTRY, "$PIN_ENTRY", [PIN-entry program for OpenSC Signer])
777
778dnl Check for SGML processor
779AC_ARG_WITH(docbook,
780[  --without-docbook       do no generate html manual (needs docbook)],
781        with_docbook=$withval)
782AC_CHECK_PROG(XSLTPROC, xsltproc, xsltproc)
783if test "x$XSLTPROC" = "x"; then
784        if test "x$with_docbook" = "xyes"; then
785                AC_MSG_ERROR([Docbook support requested, but cannot find xsltproc])
786        fi
787        with_docbook=no
788fi
789AM_CONDITIONAL(HAVE_DOCBOOK, test "x$with_docbook" = "xyes")
790
791if test "x$prefix" = xNONE; then
792  prefix=$ac_default_prefix
793fi
794if test "x$exec_prefix" = xNONE; then
795  exec_prefix=$prefix
796fi
797
798dnl Enable/disable debugging messages.
799AC_ARG_ENABLE(debug,
800[  --enable-debug          enable debug messages. [default=no]],
801        , enable_debug=no)
802if (test x$enable_debug = xyes); then
803        AC_DEFINE(DEBUG, 1, [Enable debug messages.])
804fi
805
806CPPFLAGS="-I\${top_builddir}/src/include $CPPFLAGS"
807AM_CONDITIONAL(HAVE_BUNDLES, test "x$with_bundles" = "xyes")
808
809scldap_etc_path=`eval echo ${sysconfdir}` ; scldap_etc_path=`eval echo ${scldap_etc_path}`
810AC_DEFINE_UNQUOTED(SCLDAP_ETC_PATH, "$scldap_etc_path", [etc path for libscldap])
811scldap_conf_path=`eval echo ${scldap_etc_path}/scldap.conf`
812AC_DEFINE_UNQUOTED(SCLDAP_CONF_PATH, "$scldap_conf_path", [default config file for libscldap])
813
814opensc_etc_path=`eval echo ${sysconfdir}` ; opensc_etc_path=`eval echo ${opensc_etc_path}`
815AC_DEFINE_UNQUOTED(OPENSC_ETC_PATH, "$opensc_etc_path", [etc path for libopensc])
816opensc_conf_path=`eval echo ${opensc_etc_path}/opensc.conf`
817AC_DEFINE_UNQUOTED(OPENSC_CONF_PATH, "$opensc_conf_path", [default config file for libopensc])
818
819AC_SUBST(LIBSCCONF)
820LIBSCCONF="\${top_builddir}/src/scconf/libscconf.la"
821AC_SUBST(LIBSCLDAP)
822if test "x$LDAP_MSG" = "xyes" ; then
823  LIBSCLDAP="\${top_builddir}/src/scldap/libscldap.la"
824fi
825AC_SUBST(LIBOPENSC)
826LIBOPENSC="\${top_builddir}/src/libopensc/libopensc.la"
827
828# Pass information about installed OpenSC requirements, so that
829# a proper opensc-config file will be build.
830OPENSC_LIBS="-L${libdir} -lopensc"
831OPENSC_CFLAGS=""
832AC_SUBST(OPENSC_LIBS)
833AC_SUBST(OPENSC_CFLAGS)
834
835pkgdata=`eval echo ${datadir}/${PACKAGE}` ; pkgdata=`eval echo ${pkgdata}`
836AC_SUBST(pkgdata)
837
838AC_OUTPUT([
839Makefile
840aclocal/Makefile
841docs/Makefile
842docs/pkcs15-profile.5
843etc/Makefile
844macos/Makefile
845src/Makefile
846src/common/Makefile
847src/include/Makefile
848src/include/opensc/Makefile
849src/include/opensc/rsaref/Makefile
850src/libopensc/Makefile
851src/libopensc/opensc-config
852src/libopensc/libopensc.pc
853src/openscd/Makefile
854src/openssh/Makefile
855src/pam/Makefile
856src/pkcs11/Makefile
857src/pkcs11/rsaref/Makefile
858src/pkcs15init/Makefile
859src/scam/Makefile
860src/scconf/Makefile
861src/scdl/Makefile
862src/scldap/Makefile
863src/scrandom/Makefile
864src/sia/Makefile
865src/signer/Makefile
866src/signer/npinclude/Makefile
867src/sslengines/Makefile
868src/tests/Makefile
869src/tests/regression/Makefile
870src/tools/Makefile
871src/usbtoken/Makefile
872win32/Makefile
873])
874
875if test ! -z "$RANDOM_POOL" ; then
876        RAND_MSG="device ($RANDOM_POOL)"
877else
878        if test ! -z "$PRNGD_PORT" ; then
879                RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
880        elif test ! -z "$PRNGD_SOCKET" ; then
881                RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
882        else
883                RAND_MSG="Builtin kluge"
884                BUILTIN_RNG=1
885        fi
886fi
887
888dnl Someone please show me a better way :)
889A=`eval echo ${prefix}` ; A=`eval echo ${A}`
890B=`eval echo ${bindir}` ; B=`eval echo ${B}`
891C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
892
893echo ""
894echo "OpenSC has been configured with the following options"
895
896echo ""
897echo "User binaries:       ${B}"
898echo "Configuration files: ${C}"
899
900echo ""
901echo "Host:                ${host}"
902echo "Compiler:            ${CC}"
903echo "Compiler flags:      ${CFLAGS}"
904echo "Preprocessor flags:  ${CPPFLAGS}"
905echo "Linker flags:        ${LDFLAGS}"
906echo "Libraries:           ${LIBS}"
907
908echo ""
909echo "Random number collection: ${RAND_MSG}"
910echo "OpenSSL support:          ${SSL_MSG}"
911echo "        with engine:      ${ENGINE_MSG}"
912echo "PC/SC support:            ${PCSC_MSG}"
913echo "USBToken support:         ${USBTOKEN_MSG}"
914echo "OpenCT support:           ${OPENCT_MSG}"
915echo "Assuan support:           ${ASSUAN_MSG}"
916echo "LDAP support:             ${LDAP_MSG}"
917echo "PAM support:              ${PAM_MSG}"
918case "$host" in
919*-*-osf*)
920        echo "SIA support:              ${SIA_MSG}"
921        ;;
922esac
923echo ""
924
925if test "x$ENGINE_MSG" = "xno" -a "x$SSL_MSG" = "xyes"; then
926  echo "OpenSSL was found. But to use the engine you will need"
927  echo "version 0.9.7a or later."
928fi
929
930if test ! -z "$BUILTIN_RNG"; then
931  echo "WARNING: you are using the builtin random number service."
932  echo "The random number service is very simple and is only"
933  echo "intended for testing purposes. Please request your OS"
934  echo "vendor to include /dev/random in future versions of"
935  echo "their OS. Or use PRNGD/EGD instead, your choice."
936fi
Note: See TracBrowser for help on using the browser.