summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 113a2850ade9b52d403050dae84a7abda78ec76f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
AC_PREREQ([2.60])

m4_define([CAC_MAJOR], 0)
m4_define([CAC_MINOR], 1)
m4_define([CAC_MICRO], 0)

AC_INIT(libcacard, [CAC_MAJOR.CAC_MINOR.CAC_MICRO], [], libcacard)

AC_CONFIG_MACRO_DIR([m4])
AM_CONFIG_HEADER([config.h])
AC_CONFIG_AUX_DIR(.)

AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE

AS_IF([test "$CFLAGS" = ""], [], [_cflags_is_set=yes])
AC_PROG_CC
AC_PROG_INSTALL
AC_CANONICAL_HOST
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
AC_C_BIGENDIAN
AC_PATH_PROGS(PYTHON, python2 python)

CAC_LT_VERSION=m4_format("%d:%d:%d", 1, 0, 2)
AC_SUBST(CAC_LT_VERSION)

dnl =========================================================================
dnl Check deps

CAC_CARD_NONPKGCONFIG_LIBS+=" -pthread"

CAC_CARD_REQUIRES=""

PKG_CHECK_MODULES(NSS, nss)
AC_SUBST(NSS_CFLAGS)
AC_SUBST(NSS_LIBS)
CAC_CARD_REQUIRES+=" nss"


AS_IF([test "$_cflags_is_set" = "yes"], [], [
    CFLAGS="-g -O2 -Wall -Werror"
])


AS_IF([test "$_cxxflags_is_set" = "yes"], [], [
    CXXFLAGS="-g -O2 -Wall -Werror"
])

dnl Use lots of warning flags with with gcc and compatible compilers

dnl Note: if you change the following variable, the cache is automatically
dnl skipped and all flags rechecked.  So there's no need to do anything
dnl else.  If for any reason you need to force a recheck, just change
dnl MAYBE_WARN in an ignorable way (like adding whitespace)

dnl MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations"

MAYBE_WARN="-Wall -Wno-sign-compare -Wno-deprecated-declarations"

AC_ARG_ENABLE(werror,
AC_HELP_STRING([--enable-werror], [Use -Werror (if supported)]),
set_werror="$enableval",[
if test -f $srcdir/GITVERSION; then
	is_git_version=true
	set_werror=yes
else
	set_werror=no
fi
])

dnl handle the passthru option. passthru allows you to access the cards directly
AC_ARG_ENABLE(passthru,
AC_HELP_STRING([--enable-passthru], [allow passthru mode]),
set_passthru="$enableval",)

if test "${set_passthru}" = "yes" ; then
PKG_CHECK_MODULES(PCSC,libpcsclite)
AC_SUBST(PCSC_CFLAGS)
AC_SUBST(PCSC_LIBS)
CAC_CARD_REQUIRES+=" pcsc-lite"
USE_PASSTHRU=-DUSE_PASSTHRU
AC_SUBST(USE_PASSTHRU)
fi

AC_SUBST(CAC_COMMON_SRCDIR)
AC_SUBST(CAC_CARD_REQUIRES)
AC_SUBST(CAC_NONPKGCONFIG_CFLAGS)
AC_SUBST(CAC_CARD_NONPKGCONFIG_LIBS)

AC_OUTPUT([
Makefile
libcacard.pc
])

dnl ==========================================================================
echo "

        libcacard $VERSION
        ==============

        prefix:                   ${prefix}
        c compiler:               ${CC}

        Now type 'make' to build $PACKAGE
"