fp@1724: #------------------------------------------------------------------------------ fp@1724: # $Id$ fp@1724: #------------------------------------------------------------------------------ fp@1724: fp@1731: AC_PREREQ(2.59) fp@1746: AC_INIT([ethercat],[1.3.2],[fp@igh-essen.com]) fp@1731: AC_CONFIG_AUX_DIR([autoconf]) fp@1732: AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2]) fp@1724: AC_PREFIX_DEFAULT([/opt/etherlab]) fp@1731: AC_CONFIG_HEADERS([config.h]) fp@1731: AC_CONFIG_SRCDIR([config.h.in]) fp@1724: fp@1724: #------------------------------------------------------------------------------ fp@1732: # Global fp@1732: #------------------------------------------------------------------------------ fp@1732: fp@1732: branch=stable fp@1732: fp@1732: AC_DEFINE_UNQUOTED(BRANCH, ["$branch"], [Subversion branch]) fp@1732: AC_SUBST(BRANCH, [$branch]) fp@1732: fp@1732: #------------------------------------------------------------------------------ fp@1724: # Linux sources fp@1724: #------------------------------------------------------------------------------ fp@1724: fp@1732: AC_ARG_WITH([linux-dir], fp@1732: AC_HELP_STRING( fp@1732: [--with-linux-dir=], fp@1732: [Linux kernel sources @<:@running kernel@:>@] fp@1732: ), fp@1732: [ fp@1732: sourcedir=[$withval] fp@1732: ], fp@1732: [ fp@1732: version=[`uname -r`] fp@1732: modulesdir=/lib/modules/${version} fp@1732: if test \! -d ${modulesdir} || test \! -d ${modulesdir}/build; then fp@1732: echo fp@1732: AC_MSG_ERROR([Failed to find Linux sources. Use --with-linux-dir!]) fp@1732: fi fp@1732: sourcedir=`cd ${modulesdir}/build && pwd -P` fp@1732: ] fp@1732: ) fp@1732: fp@1732: AC_MSG_CHECKING([for Linux kernel sources]) fp@1732: fp@1732: if test \! -r ${sourcedir}/.config; then fp@1732: echo fp@1732: AC_MSG_ERROR([No configured Linux kernel sources in $sourcedir]) fp@1732: fi fp@1732: fp@1732: # Try to get kernel release string fp@1739: if test -r ${sourcedir}/include/config/kernel.release; then fp@1739: kernelrelease=`cat $sourcedir/include/config/kernel.release` fp@1739: elif test -r ${sourcedir}/.kernelrelease; then fp@1732: kernelrelease=`cat $sourcedir/.kernelrelease` fp@1739: elif test -r ${sourcedir}/include/linux/utsrelease.h; then fp@1739: hdr=${sourcedir}/include/linux/utsrelease.h fp@1739: kernelrelease=`grep UTS_RELEASE $hdr | cut -d " " -f 3- | tr -d \"` fp@1732: elif test -r ${sourcedir}/include/linux/version.h; then fp@1739: hdr=${sourcedir}/include/linux/version.h fp@1732: kernelrelease=`grep UTS_RELEASE $hdr | cut -d " " -f 3- | tr -d \"` fp@1732: fi fp@1732: fp@1732: if test -z "$kernelrelease"; then fp@1732: echo fp@1732: AC_MSG_ERROR([Failed to extract Linux kernel version!]) fp@1732: fi fp@1732: fp@1732: # Extract three numbers from kernel release string fp@1739: linuxversion=`echo $kernelrelease | grep -oE "^[[0-9]]+\.[[0-9]]+\.[[0-9]]+"` fp@1732: fp@1725: AC_SUBST(LINUX_SOURCE_DIR,[$sourcedir]) fp@1732: AC_SUBST(LINUX_KERNEL_RELEASE,[$kernelrelease]) fp@1732: AC_SUBST(LINUX_KERNEL_VERSION,[$linuxversion]) fp@1732: AC_SUBST(LINUX_MOD_PATH,[/lib/modules/$kernelrelease/ethercat]) fp@1732: AC_MSG_RESULT([$LINUX_SOURCE_DIR (Kernel $LINUX_KERNEL_RELEASE)]) fp@1732: fp@1732: #------------------------------------------------------------------------------ fp@1744: # 8139too driver fp@1744: #------------------------------------------------------------------------------ fp@1744: fp@1744: AC_ARG_ENABLE([8139too], fp@1744: AS_HELP_STRING([--enable-8139too], fp@1744: [Enable 8139too driver]), fp@1744: [ fp@1744: case "${enableval}" in fp@1744: yes) enable8139too=1 fp@1744: ;; fp@1744: no) enable8139too=0 fp@1744: ;; fp@1744: *) AC_MSG_ERROR([Invalid value for --enable-8139too]) fp@1744: ;; fp@1744: esac fp@1744: ], fp@1744: [enable8139too=1] fp@1744: ) fp@1744: fp@1744: AM_CONDITIONAL(ENABLE_8139TOO, test "x$enable8139too" = "x1") fp@1746: AC_SUBST(ENABLE_8139TOO,[$enable8139too]) fp@1732: fp@1732: AC_ARG_WITH([8139too-kernel], fp@1732: AC_HELP_STRING( fp@1732: [--with-8139too-kernel=], fp@1732: [8139too kernel (only if differing)] fp@1732: ), fp@1732: [ fp@1732: kernel8139too=[$withval] fp@1732: ], fp@1732: [ fp@1732: kernel8139too=$linuxversion fp@1732: ] fp@1732: ) fp@1732: fp@1744: if test "x${enable8139too}" = "x1"; then fp@1744: AC_MSG_CHECKING([for kernel for 8139too driver]) fp@1744: fp@1744: kernels=`ls -1 devices/ | grep -oE "^8139too-.*-" | cut -d "-" -f 2 | uniq` fp@1744: found=0 fp@1744: for k in $kernels; do fp@1744: if test "$kernel8139too" = "$k"; then fp@1744: found=1 fp@1744: fi fp@1744: done fp@1744: if test $found -ne 1; then fp@1744: AC_MSG_ERROR([kernel $kernel8139too not available for 8139too driver!]) fp@1744: fi fp@1744: fp@1744: AC_MSG_RESULT([$kernel8139too]) fp@1744: fi fp@1744: fp@1746: AC_SUBST(KERNEL_8139TOO,[$kernel8139too]) fp@1746: fp@1744: #------------------------------------------------------------------------------ fp@1744: # e100 driver fp@1744: #------------------------------------------------------------------------------ fp@1744: fp@1744: AC_ARG_ENABLE([e100], fp@1744: AS_HELP_STRING([--enable-e100], fp@1744: [Enable e100 driver]), fp@1744: [ fp@1744: case "${enableval}" in fp@1744: yes) enablee100=1 fp@1744: ;; fp@1744: no) enablee100=0 fp@1744: ;; fp@1744: *) AC_MSG_ERROR([Invalid value for --enable-e100]) fp@1744: ;; fp@1744: esac fp@1744: ], fp@1744: [enablee100=0] # disabled by default fp@1744: ) fp@1744: fp@1744: AM_CONDITIONAL(ENABLE_E100, test "x$enablee100" = "x1") fp@1746: AC_SUBST(ENABLE_E100,[$enablee100]) fp@1744: fp@1744: AC_ARG_WITH([e100-kernel], fp@1744: AC_HELP_STRING( fp@1744: [--with-e100-kernel=], fp@1744: [e100 kernel (only if differing)] fp@1744: ), fp@1744: [ fp@1744: kernele100=[$withval] fp@1744: ], fp@1744: [ fp@1744: kernele100=$linuxversion fp@1744: ] fp@1744: ) fp@1744: fp@1744: if test "x${enablee100}" = "x1"; then fp@1744: AC_MSG_CHECKING([for kernel for e100 driver]) fp@1744: fp@1744: kernels=`ls -1 devices/ | grep -oE "^e100-.*-" | cut -d "-" -f 2 | uniq` fp@1744: found=0 fp@1744: for k in $kernels; do fp@1744: if test "$kernele100" = "$k"; then fp@1744: found=1 fp@1744: fi fp@1744: done fp@1744: if test $found -ne 1; then fp@1744: AC_MSG_ERROR([kernel $kernele100 not available for e100 driver!]) fp@1744: fi fp@1744: fp@1744: AC_MSG_RESULT([$kernele100]) fp@1744: fi fp@1744: fp@1746: AC_SUBST(KERNEL_E100,[$kernele100]) fp@1746: fp@1744: #------------------------------------------------------------------------------ fp@1744: # forcedeth driver fp@1744: #------------------------------------------------------------------------------ fp@1744: fp@1744: AC_ARG_ENABLE([forcedeth], fp@1744: AS_HELP_STRING([--enable-forcedeth], fp@1744: [Enable forcedeth driver]), fp@1744: [ fp@1744: case "${enableval}" in fp@1744: yes) enableforcedeth=1 fp@1744: ;; fp@1744: no) enableforcedeth=0 fp@1744: ;; fp@1744: *) AC_MSG_ERROR([Invalid value for --enable-forcedeth]) fp@1744: ;; fp@1744: esac fp@1744: ], fp@1744: [enableforcedeth=0] # disabled by default! fp@1744: ) fp@1744: fp@1744: AM_CONDITIONAL(ENABLE_FORCEDETH, test "x$enableforcedeth" = "x1") fp@1746: AC_SUBST(ENABLE_FORCEDETH,[$enableforcedeth]) fp@1744: fp@1744: AC_ARG_WITH([forcedeth-kernel], fp@1744: AC_HELP_STRING( fp@1744: [--with-forcedeth-kernel=], fp@1744: [forcedeth kernel (only if differing)] fp@1744: ), fp@1744: [ fp@1744: kernelforcedeth=[$withval] fp@1744: ], fp@1744: [ fp@1744: kernelforcedeth=$linuxversion fp@1744: ] fp@1744: ) fp@1744: fp@1744: if test "x${enableforcedeth}" = "x1"; then fp@1744: AC_MSG_CHECKING([for kernel for forcedeth driver]) fp@1744: fp@1744: kernels=`ls -1 devices/ | grep -oE "^forcedeth-.*-" | cut -d "-" -f 2 | uniq` fp@1744: found=0 fp@1744: for k in $kernels; do fp@1744: if test "$kernelforcedeth" = "$k"; then fp@1744: found=1 fp@1744: fi fp@1744: done fp@1744: if test $found -ne 1; then fp@1744: AC_MSG_ERROR([kernel $kernelforcedeth not available for forcedeth driver!]) fp@1744: fi fp@1744: fp@1744: AC_MSG_RESULT([$kernelforcedeth]) fp@1744: fi fp@1744: fp@1746: AC_SUBST(KERNEL_FORCEDETH,[$kernelforcedeth]) fp@1746: fp@1744: #------------------------------------------------------------------------------ fp@1744: # e1000 driver fp@1744: #------------------------------------------------------------------------------ fp@1744: fp@1744: AC_ARG_ENABLE([e1000], fp@1744: AS_HELP_STRING([--enable-e1000], fp@1744: [Enable e1000 driver]), fp@1744: [ fp@1744: case "${enableval}" in fp@1744: yes) enablee1000=1 fp@1744: ;; fp@1744: no) enablee1000=0 fp@1744: ;; fp@1744: *) AC_MSG_ERROR([Invalid value for --enable-e1000]) fp@1744: ;; fp@1744: esac fp@1744: ], fp@1744: [enablee1000=0] # disabled by default fp@1744: ) fp@1744: fp@1744: AM_CONDITIONAL(ENABLE_E1000, test "x$enablee1000" = "x1") fp@1746: AC_SUBST(ENABLE_E1000,[$enablee1000]) fp@1744: fp@1744: AC_ARG_WITH([e1000-kernel], fp@1744: AC_HELP_STRING( fp@1744: [--with-e1000-kernel=], fp@1744: [e1000 kernel (only if differing)] fp@1744: ), fp@1744: [ fp@1744: kernele1000=[$withval] fp@1744: ], fp@1744: [ fp@1744: kernele1000=$linuxversion fp@1744: ] fp@1744: ) fp@1744: fp@1744: if test "x${enablee1000}" = "x1"; then fp@1744: AC_MSG_CHECKING([for kernel for e1000 driver]) fp@1744: fp@1744: kernels=`ls -1 devices/e1000/ | grep -oE "^e1000_main-.*" | cut -d "-" -f 2 | uniq` fp@1744: found=0 fp@1744: for k in $kernels; do fp@1744: if test "$kernele1000" = "$k"; then fp@1744: found=1 fp@1744: fi fp@1744: done fp@1744: if test $found -ne 1; then fp@1744: AC_MSG_ERROR([kernel $kernele1000 not available for e1000 driver!]) fp@1744: fi fp@1744: fp@1744: AC_MSG_RESULT([$kernele1000]) fp@1744: fi fp@1732: fp@1746: AC_SUBST(KERNEL_E1000,[$kernele1000]) fp@1746: fp@1732: #------------------------------------------------------------------------------ fp@1732: # RTAI path (optional) fp@1732: #------------------------------------------------------------------------------ fp@1732: fp@1732: AC_ARG_WITH([rtai-dir], fp@1732: AC_HELP_STRING( fp@1732: [--with-rtai-dir=], fp@1732: [RTAI path (only for RTAI examples)] fp@1732: ), fp@1732: [ fp@1732: rtaidir=[$withval] fp@1732: ], fp@1732: [ fp@1732: rtaidir="" fp@1732: ] fp@1732: ) fp@1732: fp@1732: AC_MSG_CHECKING([for RTAI path]) fp@1732: fp@1732: if test -z "${rtaidir}"; then fp@1732: AC_MSG_RESULT([not specified.]) fp@1732: else fp@1732: if test \! -r ${rtaidir}/include/rtai.h; then fp@1732: AC_MSG_ERROR([no RTAI installation found in ${rtaidir}!]) fp@1732: fi fp@1732: AC_MSG_RESULT([$rtaidir]) fp@1746: fi fp@1746: fp@1746: AC_SUBST(RTAI_DIR,[$rtaidir]) fp@1732: fp@1732: #------------------------------------------------------------------------------ fp@1732: # MSR path (optional) fp@1732: #------------------------------------------------------------------------------ fp@1732: fp@1732: AC_ARG_WITH([msr-dir], fp@1732: AC_HELP_STRING( fp@1732: [--with-msr-dir=], fp@1732: [MSR path (only for MSR example)] fp@1732: ), fp@1732: [ fp@1732: msrdir=[$withval] fp@1732: ], fp@1732: [ fp@1732: msrdir="" fp@1732: ] fp@1732: ) fp@1732: fp@1732: AC_MSG_CHECKING([for MSR path]) fp@1732: fp@1732: if test -z "${msrdir}"; then fp@1732: AC_MSG_RESULT([not specified.]) fp@1732: else fp@1732: if test \! -r ${msrdir}/include/msr.h; then fp@1732: AC_MSG_ERROR([no MSR installation found in ${msrdir}!]) fp@1732: fi fp@1732: AC_MSG_RESULT([$msrdir]) fp@1746: fi fp@1746: fp@1746: AC_SUBST(MSR_DIR,[$msrdir]) fp@1724: fp@1724: #------------------------------------------------------------------------------ fp@1731: # Debug interface fp@1731: #------------------------------------------------------------------------------ fp@1724: fp@1744: AC_ARG_ENABLE([debug-if], fp@1744: AS_HELP_STRING([--enable-debug-if], fp@1732: [Create a debug interface for each master @<:@NO@:>@]), fp@1732: [ fp@1732: case "${enableval}" in fp@1732: yes) dbg=1 fp@1732: ;; fp@1732: no) dbg=0 fp@1732: ;; fp@1744: *) AC_MSG_ERROR([Invalid value for --enable-debug-if]) fp@1732: ;; fp@1732: esac fp@1732: ], fp@1732: [dbg=0] fp@1732: ) fp@1732: fp@1744: if test "x${dbg}" = "x1"; then fp@1744: AC_DEFINE([EC_DEBUG_IF], [1], [Debug interfaces enabled]) fp@1744: fi fp@1744: AM_CONDITIONAL(ENABLE_DEBUG_IF, test "x$dbg" = "x1") fp@1746: AC_SUBST(ENABLE_DEBUG_IF,[$dbg]) fp@1744: fp@1744: #------------------------------------------------------------------------------ fp@1744: # Debug ring fp@1744: #------------------------------------------------------------------------------ fp@1744: fp@1744: AC_ARG_ENABLE([debug-ring], fp@1744: AS_HELP_STRING([--enable-debug-ring], fp@1744: [Create a debug ring to record frames @<:@NO@:>@]), fp@1744: [ fp@1744: case "${enableval}" in fp@1744: yes) debugring=1 fp@1744: ;; fp@1744: no) debugring=0 fp@1744: ;; fp@1744: *) AC_MSG_ERROR([Invalid value for --enable-debug-ring]) fp@1744: ;; fp@1744: esac fp@1744: ], fp@1744: [debugring=0] fp@1744: ) fp@1744: fp@1744: if test "x${debugring}" = "x1"; then fp@1744: AC_DEFINE([EC_DEBUG_RING], [1], [Debug ring enabled]) fp@1744: fi fp@1744: fp@1744: #------------------------------------------------------------------------------ fp@1744: # Dummy master module fp@1744: #------------------------------------------------------------------------------ fp@1744: fp@1744: AC_ARG_ENABLE([dummy], fp@1744: AS_HELP_STRING([--enable-dummy], fp@1744: [Build the dummy master module @<:@NO@:>@]), fp@1744: [ fp@1744: case "${enableval}" in fp@1744: yes) dummy=1 fp@1744: ;; fp@1744: no) dummy=0 fp@1744: ;; fp@1744: *) AC_MSG_ERROR([Invalid value for --enable-dummy]) fp@1744: ;; fp@1744: esac fp@1744: ], fp@1744: [dummy=0] fp@1744: ) fp@1744: fp@1744: AM_CONDITIONAL(ENABLE_DUMMY, test "x$dummy" = "x1") fp@1746: AC_SUBST(ENABLE_DUMMY,[$dummy]) fp@1731: fp@1731: #------------------------------------------------------------------------------ fp@1745: # Ethernet-over-EtherCAT support fp@1745: #------------------------------------------------------------------------------ fp@1745: fp@1745: AC_ARG_ENABLE([eoe], fp@1745: AS_HELP_STRING([--enable-eoe], fp@1745: [Enable EoE support (default: yes)]), fp@1745: [ fp@1745: case "${enableval}" in fp@1745: yes) eoe=1 fp@1745: ;; fp@1745: no) eoe=0 fp@1745: ;; fp@1745: *) AC_MSG_ERROR([Invalid value for --enable-eoe]) fp@1745: ;; fp@1745: esac fp@1745: ], fp@1745: [eoe=1] fp@1745: ) fp@1745: fp@1745: if test "x${eoe}" = "x1"; then fp@1745: AC_DEFINE([EC_EOE], [1], [EoE support enabled]) fp@1745: fi fp@1745: AM_CONDITIONAL(ENABLE_EOE, test "x$eoe" = "x1") fp@1746: AC_SUBST(ENABLE_EOE,[$eoe]) fp@1732: fp@1732: #------------------------------------------------------------------------------ fp@1732: fp@1731: AC_CONFIG_FILES([ fp@1746: Doxyfile fp@1746: Kbuild fp@1731: Makefile fp@1746: master/Kbuild fp@1731: master/Makefile fp@1746: devices/Kbuild fp@1731: devices/Makefile fp@1744: devices/e1000/Makefile fp@1746: devices/e1000/Kbuild fp@1731: script/Makefile fp@1740: script/init.d/Makefile fp@1740: script/sysconfig/Makefile fp@1731: include/Makefile fp@1731: examples/Makefile fp@1746: examples/mini/Kbuild fp@1731: examples/mini/Makefile fp@1746: examples/rtai/Kbuild fp@1731: examples/rtai/Makefile fp@1746: examples/msr/Kbuild fp@1731: examples/msr/Makefile fp@1746: dummy/Kbuild fp@1744: dummy/Makefile fp@1731: ]) fp@1724: AC_OUTPUT fp@1724: fp@1724: #------------------------------------------------------------------------------