2009-11-04 15:55:24 +01:00
# General init
2010-03-31 16:07:13 +02:00
AC_INIT(libnfc, 1.3.4, info@libnfc.org)
2009-05-04 10:00:08 +02:00
2009-12-20 20:14:41 +01:00
AC_CONFIG_MACRO_DIR([m4])
2009-05-04 10:00:08 +02:00
AC_CONFIG_HEADER(config.h)
2009-11-20 14:43:18 +01:00
# SVN revison
define([svn_revision], esyscmd([sh -c "svnversion -n"]))
SVN_REVISION=svn_revision
AC_DEFINE_UNQUOTED([SVN_REVISION], ["$SVN_REVISION"], [SVN revision])
2009-05-04 10:00:08 +02:00
AM_INIT_AUTOMAKE
2009-12-17 00:16:21 +01:00
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
2009-05-04 10:00:08 +02:00
AC_LANG_C
AC_PROG_CC
AC_PROG_MAKE_SET
2009-08-26 10:54:39 +02:00
# Libtool
2009-05-04 10:00:08 +02:00
AC_PROG_LIBTOOL
2009-08-26 10:54:39 +02:00
case "$host" in
*-pc-linux-gnu)
AC_MSG_RESULT([Fixing libtool for -rpath problems.])
sed -i -r 's/(hardcode_into_libs)=.*$/\1=no/' libtool
;;
esac
2010-02-08 20:43:25 +01:00
AC_PATH_PROG(PKG_CONFIG, pkg-config, [AC_MSG_ERROR([pkg-config not found.])])
2009-05-04 10:00:08 +02:00
# Checks for header files.
AC_HEADER_STDC
2009-05-27 16:05:07 +02:00
AC_HEADER_STDBOOL
2009-11-04 15:55:24 +01:00
AC_CHECK_HEADERS([stdio.h stdlib.h stdint.h stddef.h stdbool.h])
2010-02-20 14:01:43 +01:00
AC_CHECK_FUNCS([strdup, usleep], [AC_DEFINE([_XOPEN_SOURCE], [600], [Enable POSIX extensions if present])])
2010-02-17 15:12:38 +01:00
2010-02-10 14:46:12 +01:00
AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
2010-02-17 15:12:38 +01:00
AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
2009-05-04 10:00:08 +02:00
2009-05-27 16:05:07 +02:00
# Checks for types
AC_TYPE_SIZE_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_INT32_T
2009-05-04 10:00:08 +02:00
2010-04-07 16:37:19 +02:00
LIBNFC_CFLAGS='-I$(top_srcdir)/libnfc -I$(top_builddir)/include -I$(top_srcdir)/include'
2009-12-01 15:23:00 +01:00
AC_SUBST(LIBNFC_CFLAGS)
2009-11-20 14:43:18 +01:00
2009-09-10 12:39:25 +02:00
# Debug support (default:no)
AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Enable debug output]),[enable_debug=$enableval],[enable_debug="no"])
2009-05-27 16:05:07 +02:00
AC_MSG_CHECKING(for debug flag)
AC_MSG_RESULT($enable_debug)
2009-06-11 10:30:49 +02:00
if test x"$enable_debug" = "xyes"
2009-05-27 16:05:07 +02:00
then
2010-04-10 01:41:35 +02:00
CFLAGS="$CFLAGS -g -Wall -DDEBUG -pedantic -O0 -ggdb"
2009-05-27 16:05:07 +02:00
fi
2010-04-15 16:41:13 +02:00
# Handle --with-drivers option
LIBNFC_ARG_WITH_DRIVERS
2010-01-18 12:23:07 +01:00
# Serial autoprobing support (default:no)
AC_ARG_ENABLE([serial-autoprobe],AS_HELP_STRING([--enable-serial-autoprobe],[Allow serial ports to be probed (can seriously disturb connected serial devices)]),[enable_serial_autoprobe=$enableval],[enable_serial_autoprobe="no"])
2009-09-04 15:24:34 +02:00
AC_MSG_CHECKING(for serial autoprobe flag)
AC_MSG_RESULT($enable_serial_autoprobe)
2010-01-18 12:23:07 +01:00
if test x"$enable_serial_autoprobe" = "xyes"
2009-09-04 15:24:34 +02:00
then
2010-01-18 12:23:07 +01:00
CFLAGS="$CFLAGS -DSERIAL_AUTOPROBE_ENABLED"
2009-09-04 15:24:34 +02:00
fi
2009-10-13 14:43:52 +02:00
# Documentation (default: no)
AC_ARG_ENABLE([doc],AS_HELP_STRING([--enable-doc],[Enable documentation generation.]),[enable_doc=$enableval],[enable_doc="no"])
AC_MSG_CHECKING(for documentation request)
AC_MSG_RESULT($enable_doc)
if test x"$enable_doc" = "xyes"
then
AC_PATH_PROG([DOXYGEN], [doxygen])
if test x$DOXYGEN = x
then
AC_MSG_ERROR([doxygen is mandatory.])
fi
fi
AM_CONDITIONAL(DOC_ENABLED, [test x"$enable_doc" = xyes])
2009-09-10 15:18:51 +02:00
# Dependencies
PKG_CONFIG_REQUIRES=""
2010-01-28 14:56:04 +01:00
2010-04-15 16:41:13 +02:00
LIBNFC_CHECK_LIBUSB
LIBNFC_CHECK_PCSC
2009-05-04 10:00:08 +02:00
2009-09-10 15:18:51 +02:00
AC_SUBST(PKG_CONFIG_REQUIRES)
2010-04-15 16:41:13 +02:00
AM_CONDITIONAL(LIBUSB_ENABLED, [test "$HAVE_LIBUSB" = "1"])
AM_CONDITIONAL(PCSC_ENABLED, [test "$HAVE_PCSC" = "1"])
2010-01-12 18:58:13 +01:00
# Defines and C flags
CFLAGS="$CFLAGS -std=c99"
2009-11-24 13:55:34 +01:00
2010-01-12 18:58:13 +01:00
# Workarounds for libusb in c99
CFLAGS="$CFLAGS -Du_int8_t=uint8_t -Du_int16_t=uint16_t"
2009-05-27 10:54:50 +02:00
2009-05-04 10:00:08 +02:00
AC_CONFIG_FILES([
Makefile
2010-04-07 16:37:19 +02:00
include/Makefile
include/nfc/Makefile
libnfc/chips/Makefile
libnfc/buses/Makefile
libnfc/drivers/Makefile
libnfc/Makefile
examples/Makefile
2010-01-29 16:33:34 +01:00
cmake_modules/Makefile
2009-05-04 10:00:08 +02:00
libnfc.pc
2009-10-20 12:19:31 +02:00
Doxyfile
2009-05-04 10:00:08 +02:00
])
AC_OUTPUT