/[pcsclite]/tags/ccid/rel-1.3.3/configure.in
ViewVC logotype

Diff of /tags/ccid/rel-1.3.3/configure.in

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

revision 1251 by rousseau, Wed Sep 29 07:04:55 2004 UTC revision 2210 by rousseau, Wed Nov 15 14:52:54 2006 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.52
7  AC_PREREQ(2.52)  AC_PREREQ(2.52)
8    
9  AC_INIT(ccid, 0.9.2)  AC_INIT(ccid, 1.1.0)
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  AC_PROG_CPP  AC_PROG_CPP
29  AC_PROG_INSTALL  AC_PROG_INSTALL
30  AC_PROG_MAKE_SET  AC_PROG_MAKE_SET
31  AC_PROG_LN_S  AC_PROG_LN_S
32  AM_PROG_LEX  AM_PROG_LEX
 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [yes])  
33    
34  dnl pcsc-lite install .pc files in /usr/local/lib/pkgconfig by default  # check pcsc-lite version
35  PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"  PCSC_NEEDED_VERSION="1.3.3"
36  export PKG_CONFIG_PATH  PKG_CHECK_MODULES(PCSC, libpcsclite >= $PCSC_NEEDED_VERSION, [],
37  if test "$PKGCONFIG" = "yes"; then          [ AC_MSG_RESULT([no])
38          if ! `PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --print-errors --atleast-version=1.2.9-beta5 libpcsclite`          if test -f /usr/local/lib/pkgconfig/libpcsclite.pc -a "x$PKG_CONFIG" != x ; then
39          then                  AC_MSG_ERROR([use PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure])
40                  AC_MSG_ERROR([install pcsc-lite 1.2.9-beta5 or later])            else
41          fi                  AC_MSG_WARN([install pcsc-lite $PCSC_NEEDED_VERSION or later])
42  fi            fi
43            ])
44    
45    saved_CPPFLAGS="$CPPFLAGS"
46    CPPFLAGS="$CPPFLAGS $PCSC_CFLAGS"
47    AC_CHECK_HEADER(ifdhandler.h,,
48            [AC_MSG_ERROR([ifdhandler.h not found, install pcsc-lite $PCSC_NEEDED_VERSION or later, or use ./configure PCSC_CFLAGS=...])])
49    AC_CHECK_HEADER(reader.h,,
50            [AC_MSG_ERROR([reader.h not found, install pcsc-lite $PCSC_NEEDED_VERSION or later, or use ./configure PCSC_CFLAGS=...])])
51    CPPFLAGS="$saved_CPPFLAGS"
52    
53  dnl Add libtool support.  # Add libtool support.
54  AM_PROG_LIBTOOL  AM_PROG_LIBTOOL
55    
56  dnl Automatically update the libtool script if it becomes out-of-date.  # Automatically update the libtool script if it becomes out-of-date.
57  AC_SUBST(LIBTOOL_DEPS)  AC_SUBST(LIBTOOL_DEPS)
58    
59  dnl Checks for header files.  # Checks for header files.
60  AC_HEADER_STDC  AC_HEADER_STDC
61  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,,
62          [AC_MSG_WARN([some header files not found])])          [AC_MSG_ERROR([some header files not found])])
63    
64  OLD_CFLAGS="$CFLAGS"  # Checks for typedefs, structures, and compiler characteristics.
 CFLAGS=`pkg-config libpcsclite --cflags`  
 CFLAGS="$OLD_CFLAGS $CFLAGS"  
 AC_CHECK_HEADER(ifdhandler.h,,  
         [AC_MSG_ERROR([ifdhandler.h not found, install pcsc-lite 1.2.9-beta5 or later])],  
         [ #include <pcsclite.h> ])  
 CFLAGS="$OLD_CFLAGS"  
   
 dnl Checks for typedefs, structures, and compiler characteristics.  
65  AC_C_CONST  AC_C_CONST
66  AC_TYPE_SIZE_T  AC_TYPE_SIZE_T
67  AC_HEADER_TIME  AC_HEADER_TIME
68    
69  dnl Checks for library functions.  # Checks for library functions.
70  AC_CHECK_FUNCS(select strerror strncpy memcpy)  AC_CHECK_FUNCS(select strerror strncpy memcpy)
71    
72  dnl Select OS specific versions of source files.  # Select OS specific versions of source files.
73  AC_SUBST(BUNDLE_HOST)  AC_SUBST(BUNDLE_HOST)
74  AC_SUBST(DYN_LIB_EXT)  AC_SUBST(DYN_LIB_EXT)
75  case "$host" in  case "$host" in
76  *-*-darwin*)  *-*-darwin*)
77          BUNDLE_HOST="MacOS"          BUNDLE_HOST="MacOS"
78          DYN_LIB_EXT="dylib"          DYN_LIB_EXT="dylib"
         AM_CONDITIONAL(NEED_PARSER, true)  
79    
80          AC_SUBST(COREFOUNDATION)          AC_SUBST(COREFOUNDATION)
81          COREFOUNDATION="-Wl,-framework,CoreFoundation"          COREFOUNDATION="-Wl,-framework,CoreFoundation"
# Line 87  case "$host" in Line 86  case "$host" in
86                  CFLAGS="$CFLAGS -no-cpp-precomp"                  CFLAGS="$CFLAGS -no-cpp-precomp"
87          fi          fi
88          ;;          ;;
89    *-*-freebsd*)
90            BUNDLE_HOST="FreeBSD"
91            DYN_LIB_EXT="so"
92            ;;
93    *-*-openbsd*)
94            BUNDLE_HOST="OpenBSD"
95            DYN_LIB_EXT="so.0.0"
96            ;;
97    *-*-solaris*)
98            BUNDLE_HOST="Solaris"
99            DYN_LIB_EXT="so"
100            ;;
101  *)  *)
102          BUNDLE_HOST="Linux"          BUNDLE_HOST="Linux"
103          DYN_LIB_EXT="so"          DYN_LIB_EXT="so"
         AM_CONDITIONAL(NEED_PARSER, false)  
104  esac  esac
105    
106  CFLAGS="$CFLAGS -Wall"  # --disable-libusb
   
 dnl --enable-libusb=PATH  
107  AC_ARG_ENABLE(libusb,  AC_ARG_ENABLE(libusb,
108          AC_HELP_STRING([--enable-libusb=PATH],[libusb path (default /usr)]),          AC_HELP_STRING([--disable-libusb],[do not use libusb]),
109          [          [ use_libusb="${enableval}" ], [ use_libusb=yes ] )
110                  case ${enableval} in  
111                          "" | "yes" | "YES")  # check if libusb is used
112                                  ;;  if test "x$use_libusb" != xno ; then
113                          "no" | "NO")          PKG_CHECK_MODULES(LIBUSB, libusb, [],
114                                  use_libusb=false                  [
115                                  ;;                          AC_MSG_RESULT([no])
116                          *)                          AC_CHECK_PROG([LIBUSBCONFIG], [libusb-config], [yes])
117                                  CPPFLAGS="$CPPFLAGS -I${enableval}/include"  
118                                  LDFLAGS="$LDFLAGS -L${enableval}/lib"                          if test "$LIBUSBCONFIG" = "yes" ; then
119                                  ;;                                  LIBUSB_CFLAGS="$LIBUSB_CFLAGS `libusb-config --cflags`"
120                  esac                                  LIBUSB_LIBS="$LIBUSB_LIBS `libusb-config --libs`"
121          ]                          else
122  )                                  AC_MSG_WARN([libusb-config not found.])
123                            fi
124  dnl check if libusb is available                  ])
125  if test "${use_libusb}" != false ; then  
126          AC_SUBST(LIBUSB)          saved_CPPFLAGS="$CPPFLAGS"
127            saved_LIBS="$LIBS"
128    
129            CPPFLAGS="$CPPFLAGS $LIBUSB_CFLAGS"
130            LIBS="$LDFLAGS $LIBUSB_LIBS"
131    
132          AC_CHECK_HEADERS(usb.h, [],          AC_CHECK_HEADERS(usb.h, [],
133                  [ AC_MSG_ERROR([usb.h not found, use --enable-libusb=PATH]) ])                  [ AC_MSG_ERROR([usb.h not found, use ./configure LIBUSB_CFLAGS=...]) ])
134    
         ac_save_LIBS="$LIBS"  
135          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"  
136    
137          ac_save_LIBS="$LIBS"          AC_MSG_CHECKING([for usb_init])
138          LIBS="$LIBS $COREFOUNDATION $IOKIT"          AC_TRY_LINK_FUNC(usb_init, [ AC_MSG_RESULT([yes]) ],
139          AC_CHECK_LIB(usb, usb_get_string_simple, [LIBUSB="$LIBUSB -lusb"],                  [ AC_MSG_ERROR([libusb not found, use ./configure LIBUSB_LIBS=...]) ])
140    
141            AC_MSG_CHECKING([for usb_get_string_simple])
142            AC_TRY_LINK_FUNC(usb_get_string_simple, [ AC_MSG_RESULT([yes]) ],
143                  [ 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]) ])
144          LIBS="$ac_save_LIBS"  
145            CPPFLAGS="$saved_CPPFLAGS"
146            LIBS="$saved_LIBS"
147    
148            use_libusb=yes
149  fi  fi
150    AC_SUBST(LIBUSB_CFLAGS)
151    AC_SUBST(LIBUSB_LIBS)
152    
153  dnl check shat to use for dlopen  AC_MSG_RESULT([use libusb              : $use_libusb])
 AC_SUBST(LIBDL)  
 AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no)  
154    
155  dnl --enable-multi-thread  # check if the compiler support -fvisibility=hidden (GCC >= 4)
156    saved_CFLAGS="$CFLAGS"
157    CFLAGS="$CFLAGS -fvisibility=hidden"
158    AC_MSG_CHECKING([for -fvisibility=hidden])
159    AC_COMPILE_IFELSE([char foo;],
160        [   AC_MSG_RESULT([yes])
161            SYMBOL_VISIBILITY="-fvisibility=hidden" ],
162        AC_MSG_RESULT([no]))
163    CFLAGS="$saved_CFLAGS"
164    AC_SUBST(SYMBOL_VISIBILITY)
165    
166    # --disable-multi-thread
167  AC_ARG_ENABLE(multi-thread,  AC_ARG_ENABLE(multi-thread,
168          AC_HELP_STRING([--enable-multi-thread],[enable multi threading          AC_HELP_STRING([--disable-multi-thread],[disable multi threading]),
         (default=yes)]),  
169          [ multithread="${enableval}" ], [ multithread=yes ] )          [ multithread="${enableval}" ], [ multithread=yes ] )
170    
171  if test "${multithread}" != no ; then  if test "${multithread}" != no ; then
# Line 147  if test "${multithread}" != no ; then Line 173  if test "${multithread}" != no ; then
173                  [ AC_DEFINE(HAVE_PTHREAD, 1,                  [ AC_DEFINE(HAVE_PTHREAD, 1,
174                          [Define if you have POSIX threads libraries and header files.])                          [Define if you have POSIX threads libraries and header files.])
175                  ], [ AC_MSG_ERROR([POSIX thread support required]) ])                  ], [ AC_MSG_ERROR([POSIX thread support required]) ])
176    
177            multithread=yes
178  fi  fi
179  AC_MSG_RESULT([multi threading         : $multithread])  AC_MSG_RESULT([multi threading         : $multithread])
180    
181  dnl --enable-bundle=NAME  # --enable-bundle=NAME
182  AC_ARG_ENABLE(bundle,  AC_ARG_ENABLE(bundle,
183          AC_HELP_STRING([--enable-bundle=NAME],[bundle directory name          AC_HELP_STRING([--enable-bundle=NAME],[bundle directory name
184          (default ifd-ccid.bundle)]),          (default ifd-ccid.bundle)]),
# Line 161  fi Line 189  fi
189  AC_MSG_RESULT([bundle directory name   : $bundle])  AC_MSG_RESULT([bundle directory name   : $bundle])
190  AC_DEFINE_UNQUOTED(BUNDLE, "$bundle", [bundle directory name])  AC_DEFINE_UNQUOTED(BUNDLE, "$bundle", [bundle directory name])
191    
192  dnl --enable-usbdropdir=DIR  # --enable-usbdropdir=DIR
193  AC_ARG_ENABLE(usbdropdir,  AC_ARG_ENABLE(usbdropdir,
194          AC_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB          AC_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB
195          drivers (default to pcscd config or $(prefix)/pcsc/drivers)]),          drivers (default to pcscd config or $(prefix)/pcsc/drivers)]),
196          [usbdropdir="${enableval}"], [usbdropdir=false])          [usbdropdir="${enableval}"], [usbdropdir=false])
197  if test "${usbdropdir}" = false ; then  if test "${usbdropdir}" = false ; then
198          if test "$PKGCONFIG" = yes ; then          usbdropdir=`pkg-config libpcsclite --variable=usbdropdir`
                 usbdropdir=`pkg-config libpcsclite --variable=usbdropdir`  
         else  
                 usbdropdir=""  
         fi  
         if test -z "$usbdropdir" ; then  
                 if test "$prefix" = NONE ; then  
                         usbdropdir="$ac_default_prefix/pcsc/drivers"  
                 else  
                         usbdropdir="$prefix/pcsc/drivers"  
                 fi  
         fi  
199  fi  fi
200  AC_MSG_RESULT([USB drop directory      : $usbdropdir])  AC_MSG_RESULT([USB drop directory      : $usbdropdir])
201  AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers])  AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers])
202    if test "${usbdropdir}" = "" ; then
203            AC_MSG_ERROR([use --enable-usbdropdir=DIR])
204    fi
205    
206    # --enable-twinserial
207    AC_ARG_ENABLE(twinserial,
208            AC_HELP_STRING([--enable-twinserial],[also compile and install the serial Twin driver]),
209            [twinserial="${enableval}"], [twinserial=false])
210    AC_MSG_RESULT([build and install serial Twin driver : $twinserial])
211    if test "${twinserial}" = false ; then
212            AM_CONDITIONAL(WITH_TWIN_SERIAL, false)
213    else
214            AM_CONDITIONAL(WITH_TWIN_SERIAL, true)
215    fi
216    
217  dnl --enable-ccidtwindir=DIR  # --enable-ccidtwindir=DIR
218  AC_ARG_ENABLE(ccidtwindir,  AC_ARG_ENABLE(ccidtwindir,
219          AC_HELP_STRING([--enable-ccidtwindir=DIR],[directory to install the          AC_HELP_STRING([--enable-ccidtwindir=DIR],[directory to install the
220          serial Twin driver (default to pcscd config or $(prefix)/pcsc/drivers/serial)]),          serial Twin driver (default to pcscd config or $(prefix)/pcsc/drivers/serial)]),
221          [ccidtwindir="${enableval}"], [ccidtwindir=false])          [ccidtwindir="${enableval}"], [ccidtwindir=false])
222  if test "${ccidtwindir}" = false ; then  if test "${ccidtwindir}" = false ; then
223          if test "$PKGCONFIG" = yes ; then          ccidtwindir=`pkg-config libpcsclite --variable=usbdropdir`/serial
                 ccidtwindir=`pkg-config libpcsclite --variable=usbdropdir`  
         else  
                 AC_MSG_RESULT([You should install pkg-config to get this configured automatically from pcsc-lite installation])  
                 ccidtwindir=""  
         fi  
         if test -z "$ccidtwindir" ; then  
                 if test "$prefix" = NONE ; then  
                         ccidtwindir="$ac_default_prefix/pcsc/drivers"  
                 else  
                         ccidtwindir="$prefix/pcsc/drivers"  
                 fi  
         fi  
         ccidtwindir="$ccidtwindir/serial"  
224  fi  fi
225  AC_MSG_RESULT([serial twin install dir : $ccidtwindir])  AC_MSG_RESULT([serial twin install dir : $ccidtwindir])
 AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$ccidtwindir", [directory containing USB drivers])  
226    
227  dnl --enable-pcsclite  # --disable-pcsclite
228  AC_ARG_ENABLE(pcsclite,  AC_ARG_ENABLE(pcsclite,
229          AC_HELP_STRING([--enable-pcsclite],[compile for pcsc-lite (default=yes)]),          AC_HELP_STRING([--disable-pcsclite],[do not use pcsc-lite debug support]),
230          [ pcsclite=no ], [ pcsclite=yes ] )          [ pcsclite="${enableval}" ], [ pcsclite=yes ] )
231    
232  if test "${pcsclite}" = no ; then  if test "${pcsclite}" = no ; then
233          AM_CONDITIONAL(NEED_PARSER, true)          AM_CONDITIONAL(WITHOUT_PCSC, true)
234    else
235            # check that pcsc-lite is installed
236            OLD_LIBS="$LIBS"
237            LIBS="$LIBS $PCSC_LIBS"
238            AC_CHECK_LIB(pcsclite, SCardEstablishContext, [],
239                    [AC_MSG_ERROR([SCardEstablishContext() not found, install pcsc-lite 1.2.9-beta9 or later, or use PCSC_LIBS=... ./configure])])
240            LIBS="$OLD_LIBS"
241    
242            AM_CONDITIONAL(WITHOUT_PCSC, false)
243    
244            pcsclite=yes
245  fi  fi
246  AC_MSG_RESULT([compiled for pcsc-lite  : $pcsclite])  AC_MSG_RESULT([compiled for pcsc-lite  : $pcsclite])
247    
248    
249  dnl Setup dist stuff  # 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.  # Write Makefiles.
256  AC_CONFIG_FILES(Makefile  AC_CONFIG_FILES(Makefile
257          aclocal/Makefile          aclocal/Makefile
258          src/Makefile          src/Makefile

Legend:
Removed from v.1251  
changed lines
  Added in v.2210

  ViewVC Help
Powered by ViewVC 1.1.5