source: trunk/configure.ac @ 1182

Revision 1182, 12.0 KB checked in by aj, 2 years ago (diff)

trunk is now post 0.6.20 release.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1dnl -*- mode: m4; -*-
2
3AC_PREREQ(2.60)
4
5define([PACKAGE_VERSION_MAJOR], [0])
6define([PACKAGE_VERSION_MINOR], [6])
7define([PACKAGE_VERSION_FIX], [21])
8define([PACKAGE_SUFFIX], [-svn])
9
10AC_INIT([openct],[PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX[]PACKAGE_SUFFIX])
11AC_CONFIG_AUX_DIR([.])
12AC_CONFIG_HEADERS([config.h])
13AC_CONFIG_MACRO_DIR([m4])
14AM_INIT_AUTOMAKE([${PACKAGE_NAME}], [${PACKAGE_VERSION}])
15
16OPENCT_VERSION_MAJOR="PACKAGE_VERSION_MAJOR"
17OPENCT_VERSION_MINOR="PACKAGE_VERSION_MINOR"
18OPENCT_VERSION_FIX="PACKAGE_VERSION_FIX"
19
20# LT Version numbers, remember to change them just *before* a release.
21#   (Code changed:                      REVISION++)
22#   (Oldest interface removed:          OLDEST++)
23#   (Interfaces added:                  CURRENT++, REVISION=0)
24OPENCT_LT_CURRENT="1"
25OPENCT_LT_OLDEST="1"
26OPENCT_LT_REVISION="0"
27OPENCT_LT_AGE="$((${OPENCT_LT_CURRENT}-${OPENCT_LT_OLDEST}))"
28
29AC_CONFIG_SRCDIR(src/ifd/ifdhandler.c)
30
31AC_CANONICAL_HOST
32
33# ct_socket_getcreds::SO_PEERCRED
34AC_GNU_SOURCE   
35
36AC_PROG_CC
37PKG_PROG_PKG_CONFIG
38AC_C_BIGENDIAN
39
40AC_MSG_CHECKING([svn checkout])
41if test -e "${srcdir}/packaged"; then
42        svn_checkout="no"
43else
44        svn_checkout="yes"
45fi
46AC_MSG_RESULT([${svn_checkout}])
47
48dnl Check for some target-specific stuff
49case "${host}" in
50        *-*-hpux*)
51                CPPFLAGS="${CPPFLAGS} -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED"
52        ;;
53        *-*-solaris*)
54                CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
55                LDFLAGS="${LDFLAGS} -L/usr/local/lib -R/usr/local/lib"
56                need_dash_r="1"
57        ;;
58        *-*-sunos4*)
59                CPPFLAGS="${CPPFLAGS} -DSUNOS4"
60        ;;
61        *-*-aix*)
62                CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
63                LDFLAGS="${LDFLAGS} -L/usr/local/lib"
64                if test "${LD}" != "gcc" -a -z "${blibpath}"; then
65                        blibpath="/usr/lib:/lib:/usr/local/lib"
66                fi
67        ;;
68        *-*-osf*)
69                CPPFLAGS="${CPPFLAGS} -D_POSIX_PII_SOCKET"
70        ;;
71        *-*-darwin*)
72                LIBS="${LIBS} -Wl,-framework,CoreFoundation"
73                if test "${GCC}" = "yes"; then
74                        CFLAGS="${CFLAGS} -no-cpp-precomp"
75                fi
76        ;;
77esac
78
79AC_ARG_ENABLE(
80        [strict],
81        [AS_HELP_STRING([--enable-strict],[enable strict compile mode @<:@disabled@:>@])],
82        ,
83        [enable_strict="no"]
84)
85
86AC_ARG_ENABLE(
87        [pedantic],
88        [AS_HELP_STRING([--enable-pedantic],[enable pedantic compile mode @<:@disabled@:>@])],
89        ,
90        [enable_pedantic="no"]
91)
92
93AC_ARG_ENABLE(
94        [doc],
95        [AS_HELP_STRING([--enable-doc],[enable installation of documents @<:@disabled@:>@])],
96        ,
97        [enable_doc="no"]
98)
99
100AC_ARG_ENABLE(
101        [api-doc],
102        [AS_HELP_STRING([--enable-api-doc],[enable generation and installation of api documents @<:@disabled@:>@])],
103        ,
104        [enable_api_doc="no"]
105)
106
107AC_ARG_ENABLE(
108        [pcsc],
109        [AS_HELP_STRING([--enable-pcsc],[enable pcsc support @<:@disabled@:>@])],
110        ,
111        [enable_pcsc="no"]
112)
113
114AC_ARG_ENABLE(
115        [usb],
116        [AS_HELP_STRING([--enable-usb],[enable usb support @<:@disabled@:>@])],
117        ,
118        [enable_usb="no"]
119)
120
121AC_ARG_ENABLE(
122        [debug],
123        [AS_HELP_STRING([--enable-debug],[enable debug messages @<:@disabled@:>@])],
124        [test "${enableval}" = "yes" && AC_DEFINE([DEBUG], [1], [Enable debug messages.])]
125)
126
127AC_ARG_ENABLE(
128        [sunray],
129        [AS_HELP_STRING([--enable-sunray],[enable sunray support @<:@disabled@:>@])],
130        [test "${enableval}" = "yes" && AC_DEFINE([sunray], [1], [Enable sunray support.])]
131)
132
133AC_ARG_ENABLE(
134        [sunrayclient],
135        [AS_HELP_STRING([--enable-sunrayclient],[enable sunray client support @<:@disabled@:>@])],
136        [test "${enableval}" = "yes" && AC_DEFINE(sunrayclient, 1, [Enable sunray client support.])]
137)
138
139AC_ARG_ENABLE(
140        [non-privileged],
141        [AS_HELP_STRING([--enable-non-privileged],[enable non privileged mode @<:@disabled@:>@])],
142        [test "${enableval}" = "no" && ENABLE_NON_PRIVILEGED="#"],
143        [ENABLE_NON_PRIVILEGED="#"]
144)
145
146AC_ARG_WITH(
147        [bundle],
148        [AS_HELP_STRING([--with-bundle=PATH],[install bundle file for pcsc-lite to PATH @<:@not installed@:>@])],
149        [
150                if test "${withval}" = "yes"; then
151                        bundledir="\$(libdir)"
152                else
153                        bundledir="${withval}"
154                fi
155        ],
156        [bundledir=""]
157)
158
159AC_ARG_WITH(
160        [udev],
161        [AS_HELP_STRING([--with-udev=PATH],[install udev files into PATH @<:@not installed@:>@])],
162        [
163                if test "${withval}" = "yes"; then
164                        udevdir="\$(libdir)/udev"
165                else
166                        udevdir="${withval}"
167                fi
168        ],
169        [udevdir=""]
170)
171
172AC_ARG_WITH(
173        [hotplug],
174        [AS_HELP_STRING([--with-hotplug=PATH],[install hotplug files into PATH @<:@not installed@:>@])],
175        [
176                if test "${withval}" = "yes"; then
177                        hotplugdir="\$(sysconfdir)/hotplug/usb"
178                else
179                        hotplugdir="${withval}"
180                fi
181        ],
182        [hotplugdir=""]
183)
184
185AC_ARG_WITH(
186        [ifddir],
187        [AS_HELP_STRING([--with-ifddir],[ifd directory @<:@/usr/lib/ifd@:>@])],
188        [ifddir="${withval}"],
189        [ifddir="\${libdir}/ifd"]
190)
191
192AC_ARG_WITH(
193        [apidocdir],
194        [AS_HELP_STRING([--with-apidocdir],[put API documents at this directory @<:@HTMLDIR/api@:>@])],
195        [apidocdir="${with_apidocdir}"],
196        [apidocdir="\$(htmldir)/api"]
197)
198
199AC_ARG_WITH(
200        [daemon-user],
201        [AS_HELP_STRING([--with-daemon-user=USER],[use this user for daemon @<:@openctd@:>@])],
202        [daemon_user="${withval}"],
203        [daemon_user="openctd"]
204)
205
206AC_ARG_WITH(
207        [daemon-groups],
208        [AS_HELP_STRING([--with-daemon-groups=GROUPS],[use these comma separated group list for daemon @<:@usb@:>@])],
209        [daemon_groups="${withval}"],
210        [daemon_groups="usb"]
211)
212
213dnl Checks for programs.
214AC_PROG_CPP
215AC_PROG_INSTALL
216AC_PROG_LN_S
217AC_PROG_MKDIR_P
218AC_PROG_SED
219AC_PROG_MAKE_SET
220
221AM_PROG_CC_C_O
222
223dnl Add libtool support.
224ifdef(
225        [LT_INIT],
226        [
227                LT_INIT
228        ],
229        [
230                AC_PROG_LIBTOOL
231        ]
232)
233
234dnl These required for svn checkout
235AC_ARG_VAR([XSLTPROC], [xsltproc utility])
236AC_ARG_VAR([SVN], [subversion utility])
237AC_ARG_VAR([WGET], [wget utility])
238AC_ARG_VAR([WGET_OPTS], [wget options])
239AC_ARG_VAR([TR], [tr utility])
240AC_ARG_VAR([DOXYGEN], [tr utility])
241AC_CHECK_PROGS([XSLTPROC],[xsltproc])
242AC_CHECK_PROGS([SVN],[svn])
243AC_CHECK_PROGS([WGET],[wget])
244AC_CHECK_PROGS([TR],[tr])
245AC_CHECK_PROGS([DOXYGEN],[doxygen])
246
247test -z "${WGET_OPTS}" && WGET_OPTS="-nv"
248
249dnl svn checkout dependencies
250if test "${svn_checkout}" = "yes"; then
251        AC_MSG_CHECKING([XSLTPROC requirement])
252        if test -n "${XSLTPROC}"; then
253                AC_MSG_RESULT([ok])
254        else
255                if test "${enable_doc}" = "yes"; then
256                        AC_MSG_ERROR([Missing XSLTPROC svn build with doc])
257                else
258                        AC_MSG_WARN(["make dist" will not work])
259                fi
260        fi
261
262        AC_MSG_CHECKING([DOXYGEN requirement])
263        if test -n "${DOXYGEN}"; then
264                AC_MSG_RESULT([ok])
265        else
266                if test "${enable_api_doc}" = "yes"; then
267                        AC_MSG_ERROR([Missing DOXYGEN svn build with api doc])
268                else
269                        AC_MSG_WARN(["make dist" will not work])
270                fi
271        fi
272
273        AC_MSG_CHECKING([svn doc build dependencies])
274        if test -n "${SVN}" -a -n "${TR}" -a -n "${WGET}"; then
275                AC_MSG_RESULT([ok])
276        else
277                if test "${enable_doc}" = "yes"; then
278                        AC_MSG_ERROR([Missing SVN, TR or WGET for svn doc build])
279                else
280                        AC_MSG_WARN(["make dist" will not work])
281                fi
282        fi
283fi
284
285dnl Checks for header files.
286AC_HEADER_STDC
287AC_HEADER_SYS_WAIT
288AC_CHECK_HEADERS([ \
289        errno.h fcntl.h malloc.h stdlib.h string.h \
290        strings.h sys/time.h unistd.h getopt.h \
291        dlfcn.h sys/poll.h
292])
293
294dnl Checks for typedefs, structures, and compiler characteristics.
295AC_C_CONST
296AC_TYPE_UID_T
297AC_TYPE_SIZE_T
298AC_HEADER_TIME
299
300dnl Checks for library functions.
301AC_FUNC_ERROR_AT_LINE
302AC_FUNC_STAT
303AC_FUNC_VPRINTF
304AC_CHECK_FUNCS([gettimeofday daemon])
305
306dnl C Compiler features
307AC_C_INLINE
308
309dnl See if socket() is found from libsocket
310AC_CHECK_LIB(
311        [socket],
312        [socket],
313        [
314                LIBS="${LIBS} -lsocket"
315                AC_CHECK_LIB(
316                        [resolv],
317                        [res_query],
318                        [LIBS="${LIBS} -lresolv"]
319                )
320        ]
321)
322
323AC_ARG_VAR([LTLIB_CFLAGS], [C compiler flags for libltdl])
324AC_ARG_VAR([LTLIB_LIBS], [linker flags for libltdl])
325if test -z "${LTLIB_LIBS}"; then
326        AC_CHECK_LIB(
327                [ltdl],
328                [lt_dlopen],
329                [LTLIB_LIBS="-lltdl"],
330                [AC_MSG_ERROR([ltdl not found, please install libltdl and/or libtool])]
331        )
332fi
333saved_CFLAGS="${CFLAGS}"
334CFLAGS="${CFLAGS} ${LTLIB_CFLAGS}"
335AC_CHECK_HEADER(
336        [ltdl.h],
337        ,
338        [AC_MSG_ERROR([ltdl.h not found, please install libltdl and/or libtool])]
339)
340CFLAGS="${saved_CFLAGS}"
341
342AC_MSG_CHECKING([struct sockaddr_storage::ss_family])
343AC_COMPILE_IFELSE(
344        [AC_LANG_PROGRAM(
345                [[
346#include <sys/types.h>
347#include <sys/socket.h>
348                ]],
349                [[
350struct sockaddr_storage s;
351s.ss_family = 1;
352                ]]
353        )],
354        [AC_MSG_RESULT([ok])],
355        [AC_TRY_COMPILE(
356                [
357#include <sys/types.h>
358#include <sys/socket.h>
359                ],
360                [
361struct sockaddr_storage s;
362s.__ss_family = 1;
363                ],
364                [
365                        AC_MSG_RESULT([hack])
366                        AC_DEFINE_UNQUOTED([ss_family], [__ss_family], [sockaddr_storage.ss_family wrapper])
367                ],
368                [AC_MSG_ERROR([Invalid struct sockaddr_storage])]
369        )]
370)
371
372dnl see if poll() is found from libpoll
373AC_CHECK_LIB([poll], [poll], [LIBS="$LIBS -lpoll"])
374
375if test "${enable_usb}" = "yes"; then
376        PKG_CHECK_MODULES(
377                [LIBUSB],
378                [libusb],
379                [AC_DEFINE([ENABLE_LIBUSB], [1], [Have libusb libraries and header files])],
380                [AC_MSG_ERROR([Cannot detect libusb])]
381        )
382fi
383
384if test "${enable_pcsc}" = "yes"; then
385        case "$host" in
386                *-*-darwin*)
387                        if test -z "$PCSC_LIBS" -a -z "$PCSC_LIBS"; then
388                                PCSC_MSG=yes
389                                PCSC_CFLAGS=""
390                                PCSC_LIBS="-Wl,-framework,PCSC"
391                        fi
392                ;;
393                *)
394                        PKG_CHECK_MODULES(
395                                [PCSC],
396                                [libpcsclite],
397                                ,
398                                [AC_MSG_ERROR([Cannot locate pcsc-lite])]
399                        )
400                ;;
401        esac
402fi
403
404if test "${enable_usb}" = "yes"; then
405        OPTIONAL_LIBUSB_CFLAGS="${LIBUSB_CFLAGS}"
406        OPTIONAL_LIBUSB_LIBS="${LIBUSB_LIBS}"
407fi
408
409OPENCT_SOCKET_PATH='${localstatedir}/run/openct'
410CPPFLAGS_OPENCT_SOCKET_PATH='-DOPENCT_SOCKET_PATH="\"$(OPENCT_SOCKET_PATH)\""'
411CPPFLAGS_OPENCT_CONF_PATH='-DOPENCT_CONF_PATH="\"$(sysconfdir)/openct.conf\""'
412CPPFLAGS_OPENCT_MODULES_PATH='-DOPENCT_MODULES_PATH="\"$(ifddir)\""'
413CPPFLAGS_OPENCT_IFDHANDLER_PATH='-DOPENCT_IFDHANDLER_PATH="\"$(sbindir)/ifdhandler\""'
414CPPFLAGS="${CPPFLAGS} \
415        ${CPPFLAGS_OPENCT_CONF_PATH} \
416        ${CPPFLAGS_OPENCT_SOCKET_PATH} \
417        ${CPPFLAGS_OPENCT_MODULES_PATH} \
418        ${CPPFLAGS_OPENCT_IFDHANDLER_PATH}"
419
420AC_CREATE_STDINT_H([src/include/openct/types.h])
421
422if test "${enable_pedantic}" = "yes"; then
423        enable_strict="yes";
424        CFLAGS="${CFLAGS} -pedantic"
425fi
426if test "${enable_strict}" = "yes"; then
427        CFLAGS="${CFLAGS} -Wall -Wextra"
428fi
429
430pkgconfigdir="\$(libdir)/pkgconfig"
431openctincludedir="\$(includedir)/openct"
432
433AC_SUBST([pkgconfigdir])
434AC_SUBST([openctincludedir])
435AC_SUBST([apidocdir])
436AC_SUBST([bundledir])
437AC_SUBST([ifddir])
438AC_SUBST([udevdir])
439AC_SUBST([hotplugdir])
440AC_SUBST([daemon_user])
441AC_SUBST([daemon_groups])
442AC_SUBST([OPENCT_VERSION_MAJOR])
443AC_SUBST([OPENCT_VERSION_MINOR])
444AC_SUBST([OPENCT_VERSION_FIX])
445AC_SUBST([OPENCT_LT_CURRENT])
446AC_SUBST([OPENCT_LT_REVISION])
447AC_SUBST([OPENCT_LT_AGE])
448AC_SUBST([OPENCT_LT_OLDEST])
449AC_SUBST([OPTIONAL_LIBUSB_CFLAGS])
450AC_SUBST([OPTIONAL_LIBUSB_LIBS])
451AC_SUBST([OPENCT_SOCKET_PATH])
452AC_SUBST([ENABLE_NON_PRIVILEGED])
453
454AM_CONDITIONAL([SVN_CHECKOUT], [test "${svn_checkout}" = "yes"])
455AM_CONDITIONAL([ENABLE_DOC], [test "${enable_doc}" = "yes"])
456AM_CONDITIONAL([ENABLE_API_DOC], [test "${enable_api_doc}" = "yes"])
457AM_CONDITIONAL([ENABLE_BUNDLES], [test -n "${bundledir}"])
458AM_CONDITIONAL([ENABLE_UDEV], [test -n "${udevdir}"])
459AM_CONDITIONAL([ENABLE_HOTPLUG], [test -n "${hotplugdir}"])
460AM_CONDITIONAL([ENABLE_PCSC], [test "${enable_pcsc}" = "yes"])
461
462AC_CONFIG_FILES([
463        Makefile
464        doc/Makefile
465        doc/doxygen.conf
466        doc/nonpersistent/Makefile
467        etc/Makefile
468        macos/Makefile
469        src/Makefile
470        src/ct/Makefile
471        src/ct/libopenct.pc
472        src/ctapi/Makefile
473        src/ifd/Makefile
474        src/include/Makefile
475        src/include/openct/Makefile
476        src/pcsc/Makefile
477        src/tools/Makefile
478        src/tools/openct-tool.1
479])
480AC_OUTPUT
481
482cat <<EOF
483
484OpenCT has been configured with the following options:
485
486
487Version:                 ${PACKAGE_VERSION}
488Libraries:               $(eval eval eval echo "${libdir}")
489
490doc support:             ${enable_doc}
491api doc support:         ${enable_api_doc}
492usb support:             ${enable_usb}
493pcsc support:            ${enable_pcsc}
494non-privileged support:  ${ENABLE_NON_PRIVILEGED}
495
496Host:                    ${host}
497Compiler:                ${CC}
498Preprocessor flags:      ${CPPFLAGS}
499Compiler flags:          ${CFLAGS}
500Linker flags:            ${LDFLAGS}
501Libraries:               ${LIBS}
502
503LIBUSB_CFLAGS:           ${LIBUSB_CFLAGS}
504LIBUSB_LIBS:             ${LIBUSB_LIBS}
505PCSC_CFLAGS:             ${PCSC_CFLAGS}
506PCSC_LIBS:               ${PCSC_LIBS}
507
508bundledir:               ${bundledir}
509ifddir:                  ${ifddir}
510udevdir:                 ${udevdir}
511hotplugdir:              ${hotplugdir}
512
513daemon user:             ${daemon_user}
514daemon groups:           ${daemon_groups}
515
516EOF
Note: See TracBrowser for help on using the repository browser.