/[pcsclite]/trunk/Drivers/ccid/configure.in
ViewVC logotype

Diff of /trunk/Drivers/ccid/configure.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1405 by rousseau, Thu Mar 17 10:13:02 2005 UTC revision 2799 by rousseau, Wed Feb 6 14:26:30 2008 UTC
# Line 1  Line 1 
1  dnl Process this file with autoconf to produce a configure script.  # Process this file with autoconf to produce a configure script.
2  dnl You may need to use autoconf 2.56 or newer  # You may need to use autoconf 2.56 or newer
3    
4  dnl $Id$  # $Id$
5    
6  dnl Require autoconf 2.52  # Require autoconf 2.61
7  AC_PREREQ(2.52)  AC_PREREQ(2.61)
8    
9  AC_INIT(ccid, 0.9.3)  AC_INIT(ccid, 1.3.3)
10  AC_CONFIG_SRCDIR(src/ifdhandler.c)  AC_CONFIG_SRCDIR(src/ifdhandler.c)
11  AC_CONFIG_AUX_DIR(build)  AC_CONFIG_AUX_DIR(build)
12  AM_INIT_AUTOMAKE  AM_INIT_AUTOMAKE
13    
14  dnl Default install dir  # Default install dir
15  AC_PREFIX_DEFAULT(/usr/local)  AC_PREFIX_DEFAULT(/usr/local)
16    
17  dnl Automake boilerplate.  # Automake boilerplate.
18  AC_CANONICAL_HOST  AC_CANONICAL_HOST
19    
20  dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)  # create a config.h file (Automake will add -DHAVE_CONFIG_H)
21  AM_CONFIG_HEADER(config.h)  AM_CONFIG_HEADER(config.h)
22    
23  dnl Options  # Options
24  AM_MAINTAINER_MODE  AM_MAINTAINER_MODE
25    
26  dnl Checks for programs.  # Checks for programs.
27  AC_PROG_CC  AC_PROG_CC
28    AM_PROG_CC_C_O
29  AC_PROG_CPP  AC_PROG_CPP
30  AC_PROG_INSTALL  AC_PROG_INSTALL
31  AC_PROG_MAKE_SET  AC_PROG_MAKE_SET
32  AC_PROG_LN_S  AC_PROG_LN_S
33  AM_PROG_LEX  AM_PROG_LEX
34    PKG_PROG_PKG_CONFIG
35    
36  dnl check pcsc-lite version  # check pcsc-lite version
37  PKG_CHECK_MODULES(PCSC, libpcsclite >= 1.2.9-beta5, [],  PCSC_NEEDED_VERSION="1.3.3"
38          [ if test -f /usr/local/lib/pkgconfig/libpcsclite.pc ; then  PKG_CHECK_MODULES(PCSC, libpcsclite >= $PCSC_NEEDED_VERSION, [],
39            [ AC_MSG_RESULT([no])
40            if test -f /usr/local/lib/pkgconfig/libpcsclite.pc -a "x$PKG_CONFIG" != x ; then
41                  AC_MSG_ERROR([use PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure])                  AC_MSG_ERROR([use PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure])
42            else            else
43                  AC_MSG_WARN([install pcsc-lite 1.2.9-beta5 or later])                  AC_MSG_WARN([install pcsc-lite $PCSC_NEEDED_VERSION or later])
44            fi            fi
45          ])          ])
46    
47  OLD_CFLAGS="$CFLAGS"  saved_CPPFLAGS="$CPPFLAGS"
48  CFLAGS="$CFLAGS $PCSC_CFLAGS"  CPPFLAGS="$CPPFLAGS $PCSC_CFLAGS"
49  AC_CHECK_HEADER(ifdhandler.h,,  AC_CHECK_HEADER(ifdhandler.h,,
50          [AC_MSG_ERROR([ifdhandler.h not found, install pcsc-lite 1.2.9-beta5 or later, or use CFLAGS=... ./configure])],          [AC_MSG_ERROR([ifdhandler.h not found, install pcsc-lite $PCSC_NEEDED_VERSION or later, or use ./configure PCSC_CFLAGS=...])])
51          [ #include <ifdhandler.h> ])  AC_CHECK_DECL(IFD_NO_SUCH_DEVICE,, [AC_MSG_ERROR([install pcsc-lite $PCSC_NEEDED_VERSION or later])], [#include <ifdhandler.h>])
52  CFLAGS="$OLD_CFLAGS"  AC_CHECK_DECLS(TAG_IFD_POLLING_THREAD,,, [#include <ifdhandler.h>])
53    AC_CHECK_HEADER(reader.h,,
54            [AC_MSG_ERROR([reader.h not found, install pcsc-lite $PCSC_NEEDED_VERSION or later, or use ./configure PCSC_CFLAGS=...])])
55    CPPFLAGS="$saved_CPPFLAGS"
56    
57  dnl Add libtool support.  # Add libtool support.
58  AM_PROG_LIBTOOL  AM_PROG_LIBTOOL
59    
60  dnl Automatically update the libtool script if it becomes out-of-date.  # Automatically update the libtool script if it becomes out-of-date.
61  AC_SUBST(LIBTOOL_DEPS)  AC_SUBST(LIBTOOL_DEPS)
62    
63  dnl Checks for header files.  # Checks for header files.
64  AC_HEADER_STDC  AC_HEADER_STDC
65  AC_CHECK_HEADERS(errno.h fcntl.h stdlib.h unistd.h termios.h string.h errno.h sys/time.h sys/types.h stdarg.h,,  AC_CHECK_HEADERS(errno.h fcntl.h stdlib.h unistd.h termios.h string.h errno.h sys/time.h sys/types.h stdarg.h arpa/inet.h,,
66          [AC_MSG_WARN([some header files not found])])          [AC_MSG_ERROR([some header files not found])])
67    
68  dnl Checks for typedefs, structures, and compiler characteristics.  # Checks for typedefs, structures, and compiler characteristics.
69  AC_C_CONST  AC_C_CONST
70  AC_TYPE_SIZE_T  AC_TYPE_SIZE_T
71  AC_HEADER_TIME  AC_HEADER_TIME
72    
73  dnl Checks for library functions.  # Checks for library functions.
74  AC_CHECK_FUNCS(select strerror strncpy memcpy)  AC_CHECK_FUNCS(select strerror strncpy memcpy strlcpy)
75    
76  dnl Select OS specific versions of source files.  # Select OS specific versions of source files.
77  AC_SUBST(BUNDLE_HOST)  AC_SUBST(BUNDLE_HOST)
78  AC_SUBST(DYN_LIB_EXT)  AC_SUBST(DYN_LIB_EXT)
79  case "$host" in  case "$host" in
80  *-*-darwin*)  *-*-darwin*)
81          BUNDLE_HOST="MacOS"          BUNDLE_HOST="MacOS"
82          DYN_LIB_EXT="dylib"          DYN_LIB_EXT="dylib"
         AM_CONDITIONAL(NEED_PARSER, true)  
83    
84          AC_SUBST(COREFOUNDATION)          AC_SUBST(COREFOUNDATION)
85          COREFOUNDATION="-Wl,-framework,CoreFoundation"          COREFOUNDATION="-Wl,-framework,CoreFoundation"
# Line 84  case "$host" in Line 90  case "$host" in
90                  CFLAGS="$CFLAGS -no-cpp-precomp"                  CFLAGS="$CFLAGS -no-cpp-precomp"
91          fi          fi
92          ;;          ;;
93    *-*-freebsd*)
94            BUNDLE_HOST="FreeBSD"
95            DYN_LIB_EXT="so"
96            ;;
97    *-*-openbsd*)
98            BUNDLE_HOST="OpenBSD"
99            DYN_LIB_EXT="so.0.0"
100            ;;
101    *-*-solaris*)
102            BUNDLE_HOST="Solaris"
103            DYN_LIB_EXT="so"
104            ;;
105  *)  *)
106          BUNDLE_HOST="Linux"          BUNDLE_HOST="Linux"
107          DYN_LIB_EXT="so"          DYN_LIB_EXT="so"
         AM_CONDITIONAL(NEED_PARSER, false)  
108  esac  esac
109    
110  CFLAGS="$CFLAGS -Wall"  # --disable-libusb
   
 dnl --enable-libusb=PATH  
111  AC_ARG_ENABLE(libusb,  AC_ARG_ENABLE(libusb,
112          AC_HELP_STRING([--enable-libusb=PATH],[libusb path (default /usr)]),          AC_HELP_STRING([--disable-libusb],[do not use libusb]),
113          [          [ use_libusb="${enableval}" ], [ use_libusb=yes ] )
114                  case ${enableval} in  
115                          "" | "yes" | "YES")  # check if libusb is used
116                                  ;;  if test "x$use_libusb" != xno ; then
117                          "no" | "NO")          PKG_CHECK_MODULES(LIBUSB, libusb, [],
118                                  use_libusb=false                  [
119                                  ;;                          AC_MSG_RESULT([no])
120                          *)                          AC_CHECK_PROG([LIBUSBCONFIG], [libusb-config], [yes])
121                                  CPPFLAGS="$CPPFLAGS -I${enableval}/include"  
122                                  LDFLAGS="$LDFLAGS -L${enableval}/lib"                          if test "$LIBUSBCONFIG" = "yes" ; then
123                                  ;;                                  LIBUSB_CFLAGS="$LIBUSB_CFLAGS `libusb-config --cflags`"
124                  esac                                  LIBUSB_LIBS="$LIBUSB_LIBS `libusb-config --libs`"
125          ]                          else
126  )                                  AC_MSG_WARN([libusb-config not found.])
127                            fi
128  dnl check if libusb is available                  ])
129  if test "${use_libusb}" != false ; then  
130          AC_SUBST(LIBUSB)          saved_CPPFLAGS="$CPPFLAGS"
131            saved_LIBS="$LIBS"
132    
133            CPPFLAGS="$CPPFLAGS $LIBUSB_CFLAGS"
134            LIBS="$LDFLAGS $LIBUSB_LIBS"
135    
136          AC_CHECK_HEADERS(usb.h, [],          AC_CHECK_HEADERS(usb.h, [],
137                  [ AC_MSG_ERROR([usb.h not found, use --enable-libusb=PATH]) ])                  [ AC_MSG_ERROR([usb.h not found, use ./configure LIBUSB_CFLAGS=...]) ])
138    
         ac_save_LIBS="$LIBS"  
139          LIBS="$LIBS $COREFOUNDATION $IOKIT"          LIBS="$LIBS $COREFOUNDATION $IOKIT"
         AC_CHECK_LIB(usb, usb_init, [LIBUSB="$LIBUSB -lusb"],  
                 [ AC_MSG_ERROR([libusb not found]) ])  
         LIBS="$ac_save_LIBS"  
140    
141          ac_save_LIBS="$LIBS"          AC_MSG_CHECKING([for usb_init])
142          LIBS="$LIBS $COREFOUNDATION $IOKIT"          AC_TRY_LINK_FUNC(usb_init, [ AC_MSG_RESULT([yes]) ],
143          AC_CHECK_LIB(usb, usb_get_string_simple, [LIBUSB="$LIBUSB -lusb"],                  [ AC_MSG_ERROR([libusb not found, use ./configure LIBUSB_LIBS=...]) ])
144    
145            AC_MSG_CHECKING([for usb_get_string_simple])
146            AC_TRY_LINK_FUNC(usb_get_string_simple, [ AC_MSG_RESULT([yes]) ],
147                  [ AC_MSG_ERROR([your libusb is too old. install version 0.1.7 or above]) ])                  [ AC_MSG_ERROR([your libusb is too old. install version 0.1.7 or above]) ])
148          LIBS="$ac_save_LIBS"  
149            AC_CHECK_FUNC(usb_detach_kernel_driver_np,
150                    [ AC_DEFINE(HAVE_USB_DETACH_KERNEL_DRIVER_NP, 1, [Define if usb_detach_kernel_driver_np() is available]) ])
151    
152            CPPFLAGS="$saved_CPPFLAGS"
153            LIBS="$saved_LIBS"
154    
155            use_libusb=yes
156  fi  fi
157    AC_SUBST(LIBUSB_CFLAGS)
158    AC_SUBST(LIBUSB_LIBS)
159    
160  dnl check what to use for dlopen  # check if the compiler support -fvisibility=hidden (GCC >= 4)
161  AC_SUBST(LIBDL)  saved_CFLAGS="$CFLAGS"
162  AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no)  CFLAGS="$CFLAGS -fvisibility=hidden"
163    AC_MSG_CHECKING([for -fvisibility=hidden])
164    AC_COMPILE_IFELSE([char foo;],
165        [   AC_MSG_RESULT([yes])
166            SYMBOL_VISIBILITY="-fvisibility=hidden" ],
167        AC_MSG_RESULT([no]))
168    CFLAGS="$saved_CFLAGS"
169    AC_SUBST(SYMBOL_VISIBILITY)
170    
171  dnl --enable-multi-thread  # --disable-multi-thread
172  AC_ARG_ENABLE(multi-thread,  AC_ARG_ENABLE(multi-thread,
173          AC_HELP_STRING([--enable-multi-thread],[enable multi threading          AC_HELP_STRING([--disable-multi-thread],[disable multi threading]),
         (default=yes)]),  
174          [ multithread="${enableval}" ], [ multithread=yes ] )          [ multithread="${enableval}" ], [ multithread=yes ] )
175    
176  if test "${multithread}" != no ; then  if test "${multithread}" != no ; then
# Line 144  if test "${multithread}" != no ; then Line 178  if test "${multithread}" != no ; then
178                  [ AC_DEFINE(HAVE_PTHREAD, 1,                  [ AC_DEFINE(HAVE_PTHREAD, 1,
179                          [Define if you have POSIX threads libraries and header files.])                          [Define if you have POSIX threads libraries and header files.])
180                  ], [ AC_MSG_ERROR([POSIX thread support required]) ])                  ], [ AC_MSG_ERROR([POSIX thread support required]) ])
181    
182            multithread=yes
183  fi  fi
 AC_MSG_RESULT([multi threading         : $multithread])  
184    
185  dnl --enable-bundle=NAME  # --enable-bundle=NAME
186  AC_ARG_ENABLE(bundle,  AC_ARG_ENABLE(bundle,
187          AC_HELP_STRING([--enable-bundle=NAME],[bundle directory name          AC_HELP_STRING([--enable-bundle=NAME],[bundle directory name
188          (default ifd-ccid.bundle)]),          (default ifd-ccid.bundle)]),
# Line 155  AC_ARG_ENABLE(bundle, Line 190  AC_ARG_ENABLE(bundle,
190  if test "${bundle}" = false ; then  if test "${bundle}" = false ; then
191          bundle="ifd-ccid.bundle"          bundle="ifd-ccid.bundle"
192  fi  fi
 AC_MSG_RESULT([bundle directory name   : $bundle])  
193  AC_DEFINE_UNQUOTED(BUNDLE, "$bundle", [bundle directory name])  AC_DEFINE_UNQUOTED(BUNDLE, "$bundle", [bundle directory name])
194    
195  dnl --enable-usbdropdir=DIR  # --enable-usbdropdir=DIR
196  AC_ARG_ENABLE(usbdropdir,  AC_ARG_ENABLE(usbdropdir,
197          AC_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB          AC_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB
198          drivers (default to pcscd config or $(prefix)/pcsc/drivers)]),          drivers (default to pcscd config or $(prefix)/pcsc/drivers)]),
# Line 166  AC_ARG_ENABLE(usbdropdir, Line 200  AC_ARG_ENABLE(usbdropdir,
200  if test "${usbdropdir}" = false ; then  if test "${usbdropdir}" = false ; then
201          usbdropdir=`pkg-config libpcsclite --variable=usbdropdir`          usbdropdir=`pkg-config libpcsclite --variable=usbdropdir`
202  fi  fi
 AC_MSG_RESULT([USB drop directory      : $usbdropdir])  
203  AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers])  AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers])
204  if test "${usbdropdir}" = "" ; then  if test "${usbdropdir}" = "" ; then
205          AC_MSG_ERROR([use --enable-usbdropdir=DIR])          AC_MSG_ERROR([use --enable-usbdropdir=DIR])
206  fi  fi
207    
208  dnl --enable-ccidtwindir=DIR  # --enable-twinserial
209    AC_ARG_ENABLE(twinserial,
210            AC_HELP_STRING([--enable-twinserial],[also compile and install the serial Twin driver]),
211            [twinserial="${enableval}"], [twinserial=no])
212    AM_CONDITIONAL(WITH_TWIN_SERIAL, test "${twinserial}" != "no")
213    
214    # --enable-ccidtwindir=DIR
215  AC_ARG_ENABLE(ccidtwindir,  AC_ARG_ENABLE(ccidtwindir,
216          AC_HELP_STRING([--enable-ccidtwindir=DIR],[directory to install the          AC_HELP_STRING([--enable-ccidtwindir=DIR],[directory to install the
217          serial Twin driver (default to pcscd config or $(prefix)/pcsc/drivers/serial)]),          serial Twin driver (default to pcscd config or $(prefix)/pcsc/drivers/serial)]),
# Line 180  AC_ARG_ENABLE(ccidtwindir, Line 219  AC_ARG_ENABLE(ccidtwindir,
219  if test "${ccidtwindir}" = false ; then  if test "${ccidtwindir}" = false ; then
220          ccidtwindir=`pkg-config libpcsclite --variable=usbdropdir`/serial          ccidtwindir=`pkg-config libpcsclite --variable=usbdropdir`/serial
221  fi  fi
 AC_MSG_RESULT([serial twin install dir : $ccidtwindir])  
 AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$ccidtwindir", [directory containing USB drivers])  
222    
223  dnl --enable-pcsclite  # --disable-pcsclite
224  AC_ARG_ENABLE(pcsclite,  AC_ARG_ENABLE(pcsclite,
225          AC_HELP_STRING([--enable-pcsclite],[compile for pcsc-lite (default=yes)]),          AC_HELP_STRING([--disable-pcsclite],[do not use pcsc-lite debug support]),
226          [ pcsclite=no ], [ pcsclite=yes ] )          [ pcsclite="${enableval}" ], [ pcsclite=yes ] )
227    
228  if test "${pcsclite}" = no ; then  if test "${pcsclite}" != no ; then
229          AM_CONDITIONAL(WITHOUT_PCSC, true)          # check that pcsc-lite is installed
         AM_CONDITIONAL(NEED_PARSER, true)  
 else  
         dnl check that pcsc-lite is installed  
         OLD_LDLIBS="$LDLIBS"  
230          OLD_LIBS="$LIBS"          OLD_LIBS="$LIBS"
231          LDLIBS="$LDLIBS $PCSC_LIBS"          LIBS="$LIBS $PCSC_LIBS"
232          AC_CHECK_LIB(pcsclite, SCardEstablishContext, [],          AC_MSG_CHECKING([for SCardEstablishContext])
233                  [AC_MSG_ERROR([SCardEstablishContext() not found, install pcsc-lite 1.2.9-beta5 or later,or use LDLIBS=... ./configure])])          AC_TRY_LINK_FUNC(SCardEstablishContext,
234          LDLIBS="$OLD_LDLIBS"              [ AC_MSG_RESULT([yes]) ],
235                    [ AC_MSG_ERROR([SCardEstablishContext() not found, install pcsc-lite 1.2.9-beta9 or later,or use PCSC_LIBS=...  ./configure]) ])
236          LIBS="$OLD_LIBS"          LIBS="$OLD_LIBS"
237    
238          AM_CONDITIONAL(WITHOUT_PCSC, false)          pcsclite=yes
239  fi  fi
240  AC_MSG_RESULT([compiled for pcsc-lite  : $pcsclite])  AM_CONDITIONAL(WITHOUT_PCSC, test "${pcsclite}" != "yes")
241    
242    # --enable-udev
243    AC_ARG_ENABLE(udev,
244            AC_HELP_STRING([--enable-udev],[udev support for pcscd hotplug]),
245            [udev="${enableval}"], [udev=no])
246    AM_CONDITIONAL(UDEV, test "${udev}" != "no")
247    
248  dnl Setup dist stuff  
249    # Setup dist stuff
250  AC_SUBST(ac_aux_dir)  AC_SUBST(ac_aux_dir)
251  AC_SUBST(bundle)  AC_SUBST(bundle)
252  AC_SUBST(usbdropdir)  AC_SUBST(usbdropdir)
253  AC_SUBST(ccidtwindir)  AC_SUBST(ccidtwindir)
254    
255  dnl Write Makefiles.  cat << EOF
256    
257    libccid has been configured with following options:
258    
259    Version:             ${PACKAGE_VERSION}
260    User binaries:       $(eval eval eval echo "${bindir}")
261    Configuration files: $(eval eval eval echo "${sysconfdir}")
262    
263    
264    Host:                ${host}
265    Compiler:            ${CC}
266    Preprocessor flags:  ${CPPFLAGS}
267    Compiler flags:      ${CFLAGS}
268    Preprocessor flags:  ${CPPFLAGS}
269    Linker flags:        ${LDFLAGS}
270    Libraries:           ${LIBS}
271    
272    PTHREAD_CFLAGS:      ${PTHREAD_CFLAGS}
273    PTHREAD_LIBS:        ${PTHREAD_LIBS}
274    BUNDLE_HOST:         ${BUNDLE_HOST}
275    DYN_LIB_EXT:         ${DYN_LIB_EXT}
276    LIBUSB_CFLAGS:       ${LIBUSB_CFLAGS}
277    LIBUSB_LIBS:         ${LIBUSB_LIBS}
278    SYMBOL_VISIBILITY:   ${SYMBOL_VISIBILITY}
279    
280    libusb support:          ${use_libusb}
281    multi threading:         ${multithread}
282    bundle directory name:   ${bundle}
283    USB drop directory:      ${usbdropdir}
284    serial Twin support:     ${twinserial}
285    serial twin install dir: ${ccidtwindir}
286    compiled for pcsc-lite:  ${pcsclite}
287    udev support:            ${udev}
288    
289    EOF
290    
291    # Write Makefiles.
292  AC_CONFIG_FILES(Makefile  AC_CONFIG_FILES(Makefile
293          aclocal/Makefile          aclocal/Makefile
294          src/Makefile          src/Makefile
295          readers/Makefile          readers/Makefile
296            contrib/Makefile
297            contrib/Kobil_mIDentity_switch/Makefile
298            contrib/RSA_SecurID/Makefile
299          examples/Makefile)          examples/Makefile)
300    
301  AC_OUTPUT  AC_OUTPUT

Legend:
Removed from v.1405  
changed lines
  Added in v.2799

  ViewVC Help
Powered by ViewVC 1.1.5