415 lines
11 KiB
Plaintext
415 lines
11 KiB
Plaintext
dnl -*- mode: m4; -*-
|
|
dnl Process this file with autoconf to produce a configure script.
|
|
|
|
# Require autoconf 2.52
|
|
AC_PREREQ(2.52)
|
|
|
|
AC_INIT(opensc, WIP)
|
|
AM_INIT_AUTOMAKE
|
|
AM_CONFIG_HEADER(config.h)
|
|
|
|
AC_CONFIG_SRCDIR(src/libopensc/sc.c)
|
|
|
|
# LT Version numbers, remember to change them just *before* a release.
|
|
# (Code changed: REVISION++)
|
|
# (Interfaces added/removed/changed: CURRENT++, REVISION=0)
|
|
# (Interfaces added: AGE++)
|
|
# (Interfaces removed: AGE=0)
|
|
OPENSC_LT_CURRENT=1
|
|
OPENSC_LT_REVISION=0
|
|
OPENSC_LT_AGE=0
|
|
|
|
AC_SUBST(OPENSC_LT_CURRENT)
|
|
AC_SUBST(OPENSC_LT_REVISION)
|
|
AC_SUBST(OPENSC_LT_AGE)
|
|
|
|
AC_CANONICAL_HOST
|
|
AC_PROG_CC
|
|
AC_C_BIGENDIAN
|
|
|
|
dnl Check for some target-specific stuff
|
|
case "$host" in
|
|
*-*-hpux*)
|
|
CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED"
|
|
;;
|
|
*-*-solaris*)
|
|
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
|
LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
|
|
need_dash_r=1
|
|
;;
|
|
*-*-sunos4*)
|
|
CPPFLAGS="$CPPFLAGS -DSUNOS4"
|
|
;;
|
|
*-*-aix*)
|
|
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
|
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
|
if (test "$LD" != "gcc" && test -z "$blibpath"); then
|
|
blibpath="/usr/lib:/lib:/usr/local/lib"
|
|
fi
|
|
;;
|
|
*-*-osf*)
|
|
CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET"
|
|
;;
|
|
*-*-darwin*)
|
|
LIBS="$LIBS -Wl,-framework,CoreFoundation"
|
|
if test "$GCC" = "yes"; then
|
|
CFLAGS="$CFLAGS -no-cpp-precomp"
|
|
fi
|
|
with_bundles=yes
|
|
;;
|
|
esac
|
|
|
|
dnl Options
|
|
AM_MAINTAINER_MODE
|
|
|
|
dnl Checks for programs.
|
|
AC_PROG_CPP
|
|
AC_PROG_INSTALL
|
|
AC_PROG_LN_S
|
|
AC_PROG_MAKE_SET
|
|
AM_PROG_LEX
|
|
AC_PATH_PROG(TEST_MINUS_S_SH, bash)
|
|
AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
|
|
AC_PATH_PROG(TEST_MINUS_S_SH, sh)
|
|
|
|
dnl Add libtool support.
|
|
AM_PROG_LIBTOOL
|
|
|
|
dnl C Compiler features
|
|
AC_C_INLINE
|
|
if test "$GCC" = "yes"; then
|
|
CFLAGS="-Wall -fno-strict-aliasing $CFLAGS"
|
|
fi
|
|
|
|
dnl Checks for header files.
|
|
AC_HEADER_STDC
|
|
AC_HEADER_SYS_WAIT
|
|
AC_CHECK_HEADERS([errno.h fcntl.h malloc.h stdlib.h inttypes.h string.h strings.h sys/time.h unistd.h locale.h getopt.h dlfcn.h utmp.h])
|
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
AC_C_CONST
|
|
AC_TYPE_UID_T
|
|
AC_TYPE_SIZE_T
|
|
AC_HEADER_TIME
|
|
|
|
dnl Checks for library functions.
|
|
AC_FUNC_ERROR_AT_LINE
|
|
AC_FUNC_STAT
|
|
AC_FUNC_VPRINTF
|
|
AC_CHECK_FUNCS([getpass gettimeofday memset mkdir strdup strerror setutent vsyslog setlocale])
|
|
|
|
AC_CHECK_HEADERS([zlib.h],[LIBS="$LIBS -lz"])
|
|
|
|
dnl Special check for pthread support.
|
|
ACX_PTHREAD(
|
|
[
|
|
AC_DEFINE(HAVE_PTHREAD,1,
|
|
[Define if you have POSIX threads libraries and header files.])
|
|
], [
|
|
AC_MSG_ERROR([POSIX thread support required])
|
|
])
|
|
LIBS="$PTHREAD_LIBS $LIBS"
|
|
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
|
CC="$PTHREAD_CC"
|
|
|
|
dnl See if socket() is found from libsocket
|
|
AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket" ac_cv_func_socket_in_lsocket=yes], ac_cv_func_socket_in_lsocket=no)
|
|
|
|
ac_cv_func_res_query_in_lresolv=no
|
|
if test x$ac_cv_func_socket_in_lsocket = xyes; then
|
|
AC_CHECK_LIB(resolv, res_query, [LIBS="$LIBS -lresolv" ac_cv_func_res_query_in_lresolv=yes])
|
|
fi
|
|
|
|
AC_SUBST(GETOPTSRC)
|
|
AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define if you have the `getopt_long' function.]),
|
|
[GETOPTSRC="$GETOPTSRC \$(top_srcdir)/src/common/getopt.c \$(top_srcdir)/src/common/getopt1.c"
|
|
CPPFLAGS="-I\$(top_srcdir)/src/common $CPPFLAGS"
|
|
AC_DEFINE(HAVE_GETOPT_H, 1, [Define if you have the <getopt.h> header file.])])
|
|
|
|
AC_CHECK_HEADERS([readline/readline.h])
|
|
AC_SUBST(LIBREADLINE)
|
|
saved_LIBS="$LIBS"
|
|
# libreadline will also need libtermcap on some OSes
|
|
for add in "" "-ltermcap"; do
|
|
if test "x$add" != x; then
|
|
AC_MSG_CHECKING([for readline with])
|
|
AC_MSG_RESULT($add)
|
|
fi
|
|
LIBS="$saved_LIBS $add"
|
|
unset ac_cv_lib_readline_readline
|
|
AC_CHECK_LIB(readline, readline, [
|
|
LIBREADLINE="-lreadline $add"
|
|
ac_cv_func_readline_lreadline=yes
|
|
], ac_cv_func_readline_lreadline=no)
|
|
test "x$ac_cv_func_readline_lreadline" = xyes && break
|
|
done
|
|
LIBS="$LIBS $LIBREADLINE"
|
|
AC_CHECK_FUNCS(readline)
|
|
LIBS="$saved_LIBS"
|
|
|
|
AC_ARG_WITH(flex-dir,
|
|
AC_HELP_STRING([--with-flex-dir=PATH],[Specify path to flex installation]),
|
|
[
|
|
if test "x$withval" != "xno" ; then
|
|
tryflexdir=$withval
|
|
fi
|
|
]
|
|
)
|
|
|
|
saved_LDFLAGS="$LDFLAGS"
|
|
saved_CPPFLAGS="$CPPFLAGS"
|
|
AC_SUBST(LIBFL)
|
|
AC_CACHE_CHECK([for flex directory], ac_cv_flexdir, [
|
|
for flexdir in $tryflexdir "" /usr/local/flex /usr/lib/flex /usr/local/flex /usr/lib/flex /usr/local /usr/pkg /opt /opt/flex ; do
|
|
# Skip directories if they don't exist
|
|
if test ! -z "$flexdir" -a ! -d "$flexdir/" ; then
|
|
continue;
|
|
fi
|
|
|
|
LIBFL="-lfl"
|
|
CPPFLAGS="$saved_CPPFLAGS"
|
|
LDFLAGS="$saved_LDFLAGS"
|
|
if test ! -z "$flexdir" -a "x$flexdir" != "x/usr"; then
|
|
LDFLAGS="-L$flexdir/lib $saved_LDFLAGS"
|
|
if test ! -z "$need_dash_r" ; then
|
|
LDFLAGS="-R$flexdir/lib $LDFLAGS"
|
|
fi
|
|
CPPFLAGS="-I$flexdir/include $saved_CPPFLAGS"
|
|
fi
|
|
break;
|
|
done
|
|
|
|
if test -z "$flexdir" ; then
|
|
flexdir="(system)"
|
|
fi
|
|
ac_cv_flexdir=$flexdir
|
|
])
|
|
|
|
dnl use ltdl
|
|
AC_CHECK_LIB(ltdl, lt_dlopen,, [AC_MSG_ERROR([libltdl not found])])
|
|
|
|
PKG_CHECK_MODULES(OPENCT, [openct], [
|
|
OPENCT_MSG=yes
|
|
AC_DEFINE(HAVE_OPENCT, 1, [Have OpenCT libraries and header files])
|
|
], [
|
|
OPENCT_MSG=no
|
|
])
|
|
AC_SUBST(OPENCT_CFLAGS)
|
|
AC_SUBST(OPENCT_LIBS)
|
|
|
|
AM_CONDITIONAL(HAVE_OPENCT, test "x$OPENCT_MSG" = "xyes")
|
|
|
|
PKG_CHECK_MODULES(OPENSSL, [openssl], [
|
|
OPENSSL_MSG=yes
|
|
AC_DEFINE(HAVE_OPENSSL, 1, [Have OpenSSL libraries and header files])
|
|
], [
|
|
OPENSSL_MSG=no
|
|
])
|
|
AC_SUBST(OPENSSL_CFLAGS)
|
|
AC_SUBST(OPENSSL_LIBS)
|
|
|
|
AM_CONDITIONAL(HAVE_OPENSSL, test "x$OPENSSL_MSG" = "xyes")
|
|
|
|
case "$host" in
|
|
*-*-darwin*)
|
|
if test -n "$PCSC_LIBS" -a -n "$PCSC_LIBS"
|
|
then
|
|
PCSC_MSG=yes
|
|
PCSC_CFLAGS=""
|
|
PCSC_LIBS="-Wl,-framework,PCSC"
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
PKG_CHECK_MODULES(PCSC, [libpcsclite], [
|
|
PCSC_MSG=yes
|
|
AC_DEFINE(HAVE_PCSC, 1, [Have PC/SC implementation])
|
|
], [
|
|
PCSC_MSG=no
|
|
])
|
|
AC_SUBST(PCSC_CFLAGS)
|
|
AC_SUBST(PCSC_LIBS)
|
|
|
|
AM_CONDITIONAL(HAVE_PCSC, test "x$PCSC_MSG" = "xyes")
|
|
|
|
saved_LIBS="$LIBS"
|
|
if test "x$PCSC_MSG" = "xyes"; then
|
|
CPPFLAGS="${PCSC_CFLAGS} $saved_CPPFLAGS"
|
|
CFLAGS="$PCSC_CFLAGS $saved_CFLAGS"
|
|
LIBS="$PCSC_LIBS $saved_LIBS"
|
|
AC_TRY_LINK([
|
|
#include <stdlib.h>
|
|
#ifdef __APPLE__
|
|
#include <PCSC/wintypes.h>
|
|
#include <PCSC/winscard.h>
|
|
#else
|
|
#include <winscard.h>
|
|
#endif
|
|
], [
|
|
SCardControl(NULL, NULL, 0, NULL, NULL);
|
|
], [
|
|
AC_DEFINE(HAVE_PCSC_OLD, 1, [old version of pc/sc-lite])
|
|
])
|
|
CPPFLAGS="$saved_CPPFLAGS"
|
|
CFLAGS="$saved_CFLAGS"
|
|
LIBS="$saved_LIBS"
|
|
fi
|
|
|
|
# check for reader.h
|
|
saved_CFLAGS="$CFLAGS"
|
|
CFLAGS="$CFLAGS $PCSC_CFLAGS"
|
|
AC_CHECK_HEADER(reader.h,
|
|
[AC_DEFINE([HAVE_READER_H], 1, [Define if pcsc-lite with reader.h exists])],
|
|
[AC_MSG_WARN([reader.h not found, install pcsc-lite 1.2.9-beta8 or later, or use CFLAGS=... ./configure])],
|
|
[ #include <reader.h>])
|
|
CFLAGS="$saved_CFLAGS"
|
|
|
|
dnl AM_PATH_LIBASSUAN([MINIMUM-VERSION,
|
|
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
|
|
dnl Test for libassuan and define LIBASSUAN_CFLAGS and LIBASSUAN_LIBS
|
|
AM_PATH_LIBASSUAN( , [
|
|
AM_CONDITIONAL(HAVE_ASSUAN, true)
|
|
],
|
|
[
|
|
])
|
|
AC_SUBST(ASSUAN_CFLAGS)
|
|
AC_SUBST(ASSUAN_LIBS)
|
|
|
|
dnl enable/disable logging of sensitive apdu data
|
|
AC_ARG_ENABLE(sensitive-logging,
|
|
AC_HELP_STRING([--disable-sensitive-logging], [disable logging of sensitive APDU data [default=no]]),
|
|
AC_DEFINE(OPENSC_DONT_LOG_SENSITIVE,1,[Disable logging of sensitive APDU data]))
|
|
|
|
|
|
PLUGINDIR="/usr/lib/mozilla/plugins"
|
|
AC_ARG_WITH(plugin-dir,
|
|
AC_HELP_STRING([--with-plugin-dir=PATH], [install Mozilla plugin to PATH [[/usr/lib/mozilla/plugins]]]),
|
|
[
|
|
PLUGINDIR="$withval"
|
|
]
|
|
)
|
|
AC_SUBST(PLUGINDIR)
|
|
|
|
BUNDLEDIR="${libdir}"
|
|
AC_ARG_WITH(bundle-dir,
|
|
AC_HELP_STRING([--with-bundle-dir=PATH], [install MacOS X bundles to PATH [[EPREFIX/lib]]]),
|
|
[
|
|
BUNDLEDIR="$withval"
|
|
]
|
|
)
|
|
AC_SUBST(BUNDLEDIR)
|
|
|
|
# Check for PIN entry program used by OpenSC Signer
|
|
PIN_ENTRY="/usr/local/bin/gpinentry"
|
|
AC_ARG_WITH(pin-entry,
|
|
AC_HELP_STRING([--with-pin-entry=PROG],[Run PROG as PIN-entry for OpenSC Signer]),
|
|
[
|
|
if test ! -z "$withval" -a "x$withval" != "xno" ; then
|
|
PIN_ENTRY="$withval"
|
|
fi
|
|
]
|
|
)
|
|
AC_DEFINE_UNQUOTED(PIN_ENTRY, "$PIN_ENTRY", [PIN-entry program for OpenSC Signer])
|
|
|
|
if test "x$prefix" = xNONE; then
|
|
prefix=$ac_default_prefix
|
|
fi
|
|
if test "x$exec_prefix" = xNONE; then
|
|
exec_prefix='${prefix}'
|
|
fi
|
|
|
|
dnl Enable/disable debugging messages.
|
|
AC_ARG_ENABLE(debug,
|
|
AC_HELP_STRING([--enable-debug], [enable debug messages. [[default=no]]]),
|
|
AC_DEFINE(DEBUG, 1, [Enable debug messages.]))
|
|
|
|
CPPFLAGS="-I\${top_builddir}/src/include $CPPFLAGS"
|
|
AM_CONDITIONAL(HAVE_BUNDLES, test "x$with_bundles" = "xyes")
|
|
|
|
opensc_etc_path=`eval echo ${sysconfdir}` ; opensc_etc_path=`eval echo ${opensc_etc_path}`
|
|
AC_DEFINE_UNQUOTED(OPENSC_ETC_PATH, "$opensc_etc_path", [etc path for libopensc])
|
|
opensc_conf_path=`eval echo ${opensc_etc_path}/opensc.conf`
|
|
AC_DEFINE_UNQUOTED(OPENSC_CONF_PATH, "$opensc_conf_path", [default config file for libopensc])
|
|
|
|
AC_SUBST(LIBSCCONF)
|
|
LIBSCCONF="\${top_builddir}/src/scconf/libscconf.la"
|
|
AC_SUBST(LIBOPENSC)
|
|
LIBOPENSC="\${top_builddir}/src/libopensc/libopensc.la"
|
|
|
|
# Pass information about installed OpenSC requirements, so that
|
|
# a proper opensc-config file will be build.
|
|
OPENSC_LIBS="-L${libdir} -lopensc"
|
|
OPENSC_CFLAGS=""
|
|
AC_SUBST(OPENSC_LIBS)
|
|
AC_SUBST(OPENSC_CFLAGS)
|
|
|
|
pkgdata=`eval echo ${datadir}/${PACKAGE}` ; pkgdata=`eval echo ${pkgdata}`
|
|
AC_SUBST(pkgdata)
|
|
|
|
AC_OUTPUT([
|
|
Makefile
|
|
aclocal/Makefile
|
|
doc/Makefile
|
|
doc/old/Makefile
|
|
doc/src/Makefile
|
|
etc/Makefile
|
|
macos/Makefile
|
|
man/Makefile
|
|
man/pkcs15-profile.5
|
|
src/Makefile
|
|
src/common/Makefile
|
|
src/include/Makefile
|
|
src/include/opensc/Makefile
|
|
src/include/opensc/rsaref/Makefile
|
|
src/libopensc/Makefile
|
|
src/libopensc/opensc-config
|
|
src/libopensc/libopensc.pc
|
|
src/libopensc/libpkcs15init.pc
|
|
src/libopensc/libscconf.pc
|
|
src/openssh/Makefile
|
|
src/pkcs11/Makefile
|
|
src/pkcs11/rsaref/Makefile
|
|
src/pkcs15init/Makefile
|
|
src/scconf/Makefile
|
|
src/signer/Makefile
|
|
src/signer/npinclude/Makefile
|
|
src/tests/Makefile
|
|
src/tests/regression/Makefile
|
|
src/tools/Makefile
|
|
win32/Makefile
|
|
])
|
|
|
|
A=`eval echo ${prefix}` ; A=`eval echo ${A}`
|
|
B=`eval echo ${bindir}` ; B=`eval echo ${B}`
|
|
C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
|
|
|
|
echo ""
|
|
echo "OpenSC has been configured with the following options"
|
|
|
|
echo ""
|
|
echo "Version: ${PACKAGE_VERSION}"
|
|
echo "User binaries: ${B}"
|
|
echo "Configuration files: ${C}"
|
|
|
|
echo ""
|
|
echo "Host: ${host}"
|
|
echo "Compiler: ${CC}"
|
|
echo "Compiler flags: ${CFLAGS}"
|
|
echo "Preprocessor flags: ${CPPFLAGS}"
|
|
echo "Linker flags: ${LDFLAGS}"
|
|
echo "Libraries: ${LIBS}"
|
|
|
|
echo ""
|
|
echo "OpenSSL support: ${SSL_MSG}"
|
|
echo " with engine: ${ENGINE_MSG}"
|
|
echo " with sslhack: ${SSLHACK_MSG}"
|
|
echo "PC/SC support: ${PCSC_MSG}"
|
|
echo "OpenCT support: ${OPENCT_MSG}"
|
|
echo "Assuan support: ${ASSUAN_MSG}"
|
|
echo ""
|
|
|
|
if test "x$ENGINE_MSG" = "xno" -a "x$SSL_MSG" = "xyes"; then
|
|
echo "OpenSSL was found. But to use the engine you will need"
|
|
echo "version 0.9.7a or later."
|
|
fi
|