summaryrefslogtreecommitdiff
path: root/configure.in
blob: 43338101e5106ef133a45d180233c75de1010393 (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
# $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=-Ic:/zlib
	ZLIB_LIBS=c:/zlib/zlib.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"
	;;
*-*-darwin*)
  	AC_MSG_RESULT([MAC])
	MAC=1 
	SCARD_LIB_NAME="PCSC.Framework/PCSC"
	PCSC_MSG=yes
	PCSC_CFLAGS=""
	PCSC_LIBS="-Wl,-framework,PCSC"
	;;
*)
  	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"

AC_ARG_WITH(pcsclite,
  [  --with-pcsclite         Use pcsc-lite (default=yes)])
if test "$with_pcsclite" = "no" -o "$with_pcsclite" = "false"
then
  with_pcsclite=no
else
      PKG_CHECK_MODULES(PCSC, libpcsclite, [ with_pcsclite=yes ],
        [ if test -f /usr/local/lib/pkgconfig/libpcsclite.pc ; then
                AC_MSG_ERROR([use PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure])
          else
                AC_MSG_WARN([pcsc-lite not found])
                with_pcsclite=no
        fi
      ])
fi
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)

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
])
AC_OUTPUT