summaryrefslogtreecommitdiff
path: root/configure.in
blob: 92524af89097605a7c8fd126897bca416485e59d (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# $Id$
#
# BEGIN COPYRIGHT BLOCK
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation version
# 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
# END COPYRIGHT BLOCK

# Require autoconf 2.52
AC_PREREQ(2.52)

# Process this file with autoconf to produce a configure script.
AC_INIT(coolkey,"1.1.0")
AC_CONFIG_SRCDIR([src/coolkey/coolkey.cpp])
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE(coolkey, "1.1.0")
AC_CONFIG_HEADERS([config.h])

AM_MAINTAINER_MODE

# Add argument for debuging
AC_ARG_ENABLE(debug, 
  [  --enable-debug          add debugging code (default=yes)])
if test "$enable_debug" = "no" -o "$enable_debug" = "false"
then
  AC_MSG_WARN([Debugging support is completely disabled!])
else
  AC_DEFINE(DEBUG, 1, [Define to 1 if you want to include debugging code.])
fi


#
# ./config does a poor job of dealing with native OS stuff other than
# unix, detect Windows and mac and do something a little more OS
# friendly
WINDOWS=0
MAC=0
UNIX=0
AC_MSG_CHECKING([platform type: ])
case "$host" in
*-*-win*|*-*-cygwin*)
  	AC_MSG_RESULT([Windows])
	WINDOWS=1
	ZLIB_CFLAGS=-I${ZLIB_INCLUDE}
	ZLIB_LIBS=${ZLIB_LIB}/zdll.dll
	#OS_FLAGS=`echo $INCLUDE | tr '[[:upper:]]' '[[:lower:]]' | sed -e 's;\\\\;/;g' -e 's;.:;/cygdrive/&/;g' -e 's;:;;g' -e 's;//;/;g' -e 's/;/\" -I\"/g' -e 's;^;-I\";' -e 's;$;\";'`
	CPPFLAGS="$CPPFLAGS $OS_FLAGS -DWIN32"
	LDFLAGS="$LDFLAGS"
	AC_MSG_WARN([changing CPPFLAGS = $CPPFLAGS ] );
	SCARD_LIB_NAME="winscard.dll"
	# override config defaults for windows
	CC=cl
	CXX=cl 
	CXXFLAGS="$CXXFLAGS /EHsc"
	#
	# Sigh, prevents us from overriding it with --libdir= in the config 
	* line, but we can still override it in the make line.
	#
	libdir=`cygpath ${WINDIR}/system32`
	;;
*-*-darwin*)
  	AC_MSG_RESULT([MAC])
	MAC=1 
	SCARD_LIB_NAME="PCSC.Framework/PCSC"
	PCSC_MSG=yes
	PCSC_CFLAGS="-I/System/Library/Frameworks/PCSC.framework/Versions/Current/Headers"
	PCSC_LIBS="-Wl,-framework,PCSC"
	CFLAGS="-DMAC  -I/System/Library/Frameworks/Security.framework/Versions/Current/Headers -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
	LDFLAGS="-L/System/Library/Frameworks/Security.framework/Versions/Current/Security -arch ppc -arch i386"
	CXXFLAGS="-DMAC  -I/System/Library/Frameworks/Security.framework/Versions/Current/Headers -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
	;;
*)
  	AC_MSG_RESULT([UNIX/LINUX])
	UNIX=1
        # should look it up on the local system
	SCARD_LIB_NAME="libpcsclite.so.1"
	;;
esac


# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_LN_S

# Checks for libraries.
if test $WINDOWS -ne 1; then
AC_CHECK_LIB(z, uncompress, , AC_MSG_ERROR(could not locate libz compression library))
AC_CHECK_LIB(dl, dlopen, , AC_MSG_ERROR(could not locate dynamic library services library))
fi

# add our compiled static libraries
AC_SUBST(LIBCKYAPPLET)
LIBCKYAPPLET="\${top_builddir}/src/libckyapplet/libckyapplet.la"

PKG_CHECK_MODULES(PCSC, libpcsclite, true,
        [ if $UNIX -eq 1 ; then
                AC_MSG_ERROR([could not find pcsc-lite libraries])
          else
                AC_MSG_WARN([pcsc-lite not found])
        fi
      ])

# Add argument for pk11install
AC_ARG_ENABLE(pk11install, 
  [  --enable-pk11install          build an installer for legacy user apps(default=no)])
if test "$enable_pk11install" = "yes" -o "$enable_pk11install" = "true"
then
if test $WINDOWS -ne 1; then
  PKG_CHECK_MODULES(NSS, nss, true, [ AC_MSG_ERROR(could not find NSS Crypto libraries) ])
fi
  enable_pk11install="yes"
else
  enable_pk11install="no"
  AC_MSG_WARN([skipping pk11install])
fi

AC_SUBST(NSS_CFLAGS)
AC_SUBST(ZLIB_CFLAGS)
AC_SUBST(ZLIB_LIBS)
AC_SUBST(PCSC_CFLAGS)
AC_SUBST(PCSC_LIBS)
AC_SUBST(SCARD_LIB_NAME)
AM_CONDITIONAL(HAVE_PCSC, test x$with_pcsclite = xyes)
AM_CONDITIONAL(BUILD_PK11INSTALL, test x$enable_pk11install = xyes)
AM_CONDITIONAL(IS_WINDOWS, test $WINDOWS -eq 1)

AC_DEFINE(DEBUG, 1, [Define to 1 if you want to include debugging code.])
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([string.h syslog.h fcntl.h unistd.h])
AC_CHECK_HEADERS([zlib.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([memset strdup strerror])


AC_CONFIG_FILES([ 
Makefile
src/libckyapplet/Makefile
src/libckyapplet/libckyapplet.pc
src/coolkey/Makefile
src/install/Makefile
])
AC_OUTPUT