fp@365: #------------------------------------------------------------------------------
fp@365: # $Id$
fp@365: #------------------------------------------------------------------------------
fp@365:
fp@392: AC_PREREQ(2.59)
fp@777: AC_INIT([ethercat],[1.4.0-pre],[fp@igh-essen.com])
fp@387: AC_CONFIG_AUX_DIR([autoconf])
fp@479: AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2])
fp@387: AC_PREFIX_DEFAULT([/opt/etherlab])
fp@392: AC_CONFIG_HEADERS([config.h])
fp@392: AC_CONFIG_SRCDIR([config.h.in])
fp@365:
fp@365: #------------------------------------------------------------------------------
fp@444: # Global
fp@444: #------------------------------------------------------------------------------
fp@444:
fp@444: branch=trunk
fp@444:
fp@444: AC_DEFINE_UNQUOTED(BRANCH, ["$branch"], [Subversion branch])
fp@444: AC_SUBST(BRANCH, [$branch])
fp@444:
fp@922: AC_PROG_CXX
fp@922:
fp@444: #------------------------------------------------------------------------------
fp@365: # Linux sources
fp@365: #------------------------------------------------------------------------------
fp@365:
fp@440: AC_ARG_WITH([linux-dir],
fp@365: AC_HELP_STRING(
fp@440: [--with-linux-dir=
],
fp@440: [Linux kernel sources @<:@running kernel@:>@]
fp@367: ),
fp@440: [
fp@440: sourcedir=[$withval]
fp@440: ],
fp@440: [
fp@440: version=[`uname -r`]
fp@440: modulesdir=/lib/modules/${version}
fp@440: if test \! -d ${modulesdir} || test \! -d ${modulesdir}/build; then
fp@440: echo
fp@477: AC_MSG_ERROR([Failed to find Linux sources. Use --with-linux-dir!])
fp@440: fi
fp@440: sourcedir=`cd ${modulesdir}/build && pwd -P`
fp@440: ]
fp@367: )
fp@365:
fp@440: AC_MSG_CHECKING([for Linux kernel sources])
fp@440:
fp@440: if test \! -r ${sourcedir}/.config; then
fp@477: echo
fp@477: AC_MSG_ERROR([No configured Linux kernel sources in $sourcedir])
fp@365: fi
fp@365:
fp@477: # Try to get kernel release string
fp@537: if test -r ${sourcedir}/include/config/kernel.release; then
fp@537: kernelrelease=`cat $sourcedir/include/config/kernel.release`
fp@537: elif test -r ${sourcedir}/.kernelrelease; then
fp@477: kernelrelease=`cat $sourcedir/.kernelrelease`
fp@507: elif test -r ${sourcedir}/include/linux/utsrelease.h; then
fp@507: hdr=${sourcedir}/include/linux/utsrelease.h
fp@507: kernelrelease=`grep UTS_RELEASE $hdr | cut -d " " -f 3- | tr -d \"`
fp@477: elif test -r ${sourcedir}/include/linux/version.h; then
fp@507: hdr=${sourcedir}/include/linux/version.h
fp@477: kernelrelease=`grep UTS_RELEASE $hdr | cut -d " " -f 3- | tr -d \"`
fp@477: fi
fp@477:
fp@477: if test -z "$kernelrelease"; then
fp@477: echo
fp@477: AC_MSG_ERROR([Failed to extract Linux kernel version!])
fp@477: fi
fp@477:
fp@477: # Extract three numbers from kernel release string
fp@537: linuxversion=`echo $kernelrelease | grep -oE "^[[0-9]]+\.[[0-9]]+\.[[0-9]]+"`
fp@477:
fp@367: AC_SUBST(LINUX_SOURCE_DIR,[$sourcedir])
fp@477: AC_SUBST(LINUX_KERNEL_RELEASE,[$kernelrelease])
fp@477: AC_SUBST(LINUX_KERNEL_VERSION,[$linuxversion])
fp@477: AC_SUBST(LINUX_MOD_PATH,[/lib/modules/$kernelrelease/ethercat])
fp@477: AC_MSG_RESULT([$LINUX_SOURCE_DIR (Kernel $LINUX_KERNEL_RELEASE)])
fp@367:
fp@367: #------------------------------------------------------------------------------
fp@582: # 8139too driver
fp@582: #------------------------------------------------------------------------------
fp@582:
fp@582: AC_ARG_ENABLE([8139too],
fp@582: AS_HELP_STRING([--enable-8139too],
fp@582: [Enable 8139too driver]),
fp@582: [
fp@582: case "${enableval}" in
fp@582: yes) enable8139too=1
fp@582: ;;
fp@582: no) enable8139too=0
fp@582: ;;
fp@582: *) AC_MSG_ERROR([Invalid value for --enable-8139too])
fp@582: ;;
fp@582: esac
fp@582: ],
fp@582: [enable8139too=1]
fp@582: )
fp@582:
fp@582: AM_CONDITIONAL(ENABLE_8139TOO, test "x$enable8139too" = "x1")
fp@732: AC_SUBST(ENABLE_8139TOO,[$enable8139too])
fp@485:
fp@485: AC_ARG_WITH([8139too-kernel],
fp@485: AC_HELP_STRING(
fp@485: [--with-8139too-kernel=],
fp@485: [8139too kernel (only if differing)]
fp@485: ),
fp@485: [
fp@485: kernel8139too=[$withval]
fp@485: ],
fp@485: [
fp@485: kernel8139too=$linuxversion
fp@485: ]
fp@485: )
fp@485:
fp@582: if test "x${enable8139too}" = "x1"; then
fp@582: AC_MSG_CHECKING([for kernel for 8139too driver])
fp@582:
fp@945: kernels=`ls -1 ${srcdir}/devices/ | grep -oE "^8139too-.*-" | cut -d "-" -f 2 | uniq`
fp@582: found=0
fp@582: for k in $kernels; do
fp@582: if test "$kernel8139too" = "$k"; then
fp@582: found=1
fp@582: fi
fp@582: done
fp@582: if test $found -ne 1; then
fp@582: AC_MSG_ERROR([kernel $kernel8139too not available for 8139too driver!])
fp@582: fi
fp@582:
fp@582: AC_MSG_RESULT([$kernel8139too])
fp@582: fi
fp@582:
fp@732: AC_SUBST(KERNEL_8139TOO,[$kernel8139too])
fp@732:
fp@582: #------------------------------------------------------------------------------
fp@582: # e100 driver
fp@569: #------------------------------------------------------------------------------
fp@569:
fp@569: AC_ARG_ENABLE([e100],
fp@569: AS_HELP_STRING([--enable-e100],
fp@569: [Enable e100 driver]),
fp@569: [
fp@569: case "${enableval}" in
fp@569: yes) enablee100=1
fp@569: ;;
fp@569: no) enablee100=0
fp@569: ;;
fp@569: *) AC_MSG_ERROR([Invalid value for --enable-e100])
fp@569: ;;
fp@569: esac
fp@569: ],
fp@582: [enablee100=0] # disabled by default
fp@582: )
fp@582:
fp@582: AM_CONDITIONAL(ENABLE_E100, test "x$enablee100" = "x1")
fp@732: AC_SUBST(ENABLE_E100,[$enablee100])
fp@568:
fp@568: AC_ARG_WITH([e100-kernel],
fp@568: AC_HELP_STRING(
fp@568: [--with-e100-kernel=],
fp@568: [e100 kernel (only if differing)]
fp@568: ),
fp@568: [
fp@568: kernele100=[$withval]
fp@568: ],
fp@568: [
fp@568: kernele100=$linuxversion
fp@568: ]
fp@568: )
fp@568:
fp@582: if test "x${enablee100}" = "x1"; then
fp@569: AC_MSG_CHECKING([for kernel for e100 driver])
fp@569:
fp@945: kernels=`ls -1 ${srcdir}/devices/ | grep -oE "^e100-.*-" | cut -d "-" -f 2 | uniq`
fp@569: found=0
fp@569: for k in $kernels; do
fp@569: if test "$kernele100" = "$k"; then
fp@569: found=1
fp@569: fi
fp@569: done
fp@569: if test $found -ne 1; then
fp@569: AC_MSG_ERROR([kernel $kernele100 not available for e100 driver!])
fp@569: fi
fp@569:
fp@569: AC_MSG_RESULT([$kernele100])
fp@569: fi
fp@568:
fp@732: AC_SUBST(KERNEL_E100,[$kernele100])
fp@732:
fp@568: #------------------------------------------------------------------------------
fp@582: # forcedeth driver
fp@581: #------------------------------------------------------------------------------
fp@581:
fp@581: AC_ARG_ENABLE([forcedeth],
fp@581: AS_HELP_STRING([--enable-forcedeth],
fp@581: [Enable forcedeth driver]),
fp@581: [
fp@581: case "${enableval}" in
fp@581: yes) enableforcedeth=1
fp@581: ;;
fp@581: no) enableforcedeth=0
fp@581: ;;
fp@581: *) AC_MSG_ERROR([Invalid value for --enable-forcedeth])
fp@581: ;;
fp@581: esac
fp@581: ],
fp@582: [enableforcedeth=0] # disabled by default!
fp@582: )
fp@582:
fp@582: AM_CONDITIONAL(ENABLE_FORCEDETH, test "x$enableforcedeth" = "x1")
fp@732: AC_SUBST(ENABLE_FORCEDETH,[$enableforcedeth])
fp@581:
fp@581: AC_ARG_WITH([forcedeth-kernel],
fp@581: AC_HELP_STRING(
fp@581: [--with-forcedeth-kernel=],
fp@581: [forcedeth kernel (only if differing)]
fp@581: ),
fp@581: [
fp@581: kernelforcedeth=[$withval]
fp@581: ],
fp@581: [
fp@581: kernelforcedeth=$linuxversion
fp@581: ]
fp@581: )
fp@581:
fp@582: if test "x${enableforcedeth}" = "x1"; then
fp@581: AC_MSG_CHECKING([for kernel for forcedeth driver])
fp@581:
fp@945: kernels=`ls -1 ${srcdir}/devices/ | grep -oE "^forcedeth-.*-" | cut -d "-" -f 2 | uniq`
fp@581: found=0
fp@581: for k in $kernels; do
fp@581: if test "$kernelforcedeth" = "$k"; then
fp@581: found=1
fp@581: fi
fp@581: done
fp@581: if test $found -ne 1; then
fp@581: AC_MSG_ERROR([kernel $kernelforcedeth not available for forcedeth driver!])
fp@581: fi
fp@581:
fp@581: AC_MSG_RESULT([$kernelforcedeth])
fp@581: fi
fp@581:
fp@732: AC_SUBST(KERNEL_FORCEDETH,[$kernelforcedeth])
fp@732:
fp@581: #------------------------------------------------------------------------------
fp@667: # e1000 driver
fp@667: #------------------------------------------------------------------------------
fp@667:
fp@667: AC_ARG_ENABLE([e1000],
fp@667: AS_HELP_STRING([--enable-e1000],
fp@667: [Enable e1000 driver]),
fp@667: [
fp@667: case "${enableval}" in
fp@667: yes) enablee1000=1
fp@667: ;;
fp@667: no) enablee1000=0
fp@667: ;;
fp@667: *) AC_MSG_ERROR([Invalid value for --enable-e1000])
fp@667: ;;
fp@667: esac
fp@667: ],
fp@667: [enablee1000=0] # disabled by default
fp@667: )
fp@667:
fp@667: AM_CONDITIONAL(ENABLE_E1000, test "x$enablee1000" = "x1")
fp@732: AC_SUBST(ENABLE_E1000,[$enablee1000])
fp@667:
fp@667: AC_ARG_WITH([e1000-kernel],
fp@667: AC_HELP_STRING(
fp@667: [--with-e1000-kernel=],
fp@667: [e1000 kernel (only if differing)]
fp@667: ),
fp@667: [
fp@667: kernele1000=[$withval]
fp@667: ],
fp@667: [
fp@667: kernele1000=$linuxversion
fp@667: ]
fp@667: )
fp@667:
fp@667: if test "x${enablee1000}" = "x1"; then
fp@667: AC_MSG_CHECKING([for kernel for e1000 driver])
fp@667:
fp@945: kernels=`ls -1 ${srcdir}/devices/e1000/ | grep -oE "^e1000_main-.*" | cut -d "-" -f 2 | uniq`
fp@667: found=0
fp@667: for k in $kernels; do
fp@667: if test "$kernele1000" = "$k"; then
fp@667: found=1
fp@667: fi
fp@667: done
fp@667: if test $found -ne 1; then
fp@667: AC_MSG_ERROR([kernel $kernele1000 not available for e1000 driver!])
fp@667: fi
fp@667:
fp@667: AC_MSG_RESULT([$kernele1000])
fp@667: fi
fp@667:
fp@732: AC_SUBST(KERNEL_E1000,[$kernele1000])
fp@732:
fp@667: #------------------------------------------------------------------------------
fp@897: # r8169 driver
fp@897: #------------------------------------------------------------------------------
fp@897:
fp@897: AC_ARG_ENABLE([r8169],
fp@897: AS_HELP_STRING([--enable-r8169],
fp@897: [Enable r8169 driver]),
fp@897: [
fp@897: case "${enableval}" in
fp@897: yes) enabler8169=1
fp@897: ;;
fp@897: no) enabler8169=0
fp@897: ;;
fp@897: *) AC_MSG_ERROR([Invalid value for --enable-r8169])
fp@897: ;;
fp@897: esac
fp@897: ],
fp@897: [enabler8169=0] # disabled by default
fp@897: )
fp@897:
fp@897: AM_CONDITIONAL(ENABLE_R8169, test "x$enabler8169" = "x1")
fp@897: AC_SUBST(ENABLE_R8169,[$enabler8169])
fp@897:
fp@897: AC_ARG_WITH([r8169-kernel],
fp@897: AC_HELP_STRING(
fp@897: [--with-r8169-kernel=],
fp@897: [r8169 kernel (only if differing)]
fp@897: ),
fp@897: [
fp@897: kernelr8169=[$withval]
fp@897: ],
fp@897: [
fp@897: kernelr8169=$linuxversion
fp@897: ]
fp@897: )
fp@897:
fp@897: if test "x${enabler8169}" = "x1"; then
fp@897: AC_MSG_CHECKING([for kernel for r8169 driver])
fp@897:
fp@945: kernels=`ls -1 ${srcdir}/devices/ | grep -oE "^r8169-.*-" | cut -d "-" -f 2 | uniq`
fp@897: found=0
fp@897: for k in $kernels; do
fp@897: if test "$kernelr8169" = "$k"; then
fp@897: found=1
fp@897: fi
fp@897: done
fp@897: if test $found -ne 1; then
fp@897: AC_MSG_ERROR([kernel $kernelr8169 not available for r8169 driver!])
fp@897: fi
fp@897:
fp@897: AC_MSG_RESULT([$kernelr8169])
fp@897: fi
fp@897:
fp@897: AC_SUBST(KERNEL_R8169,[$kernelr8169])
fp@897:
fp@897: #------------------------------------------------------------------------------
fp@485: # RTAI path (optional)
fp@485: #------------------------------------------------------------------------------
fp@485:
fp@485: AC_ARG_WITH([rtai-dir],
fp@485: AC_HELP_STRING(
fp@485: [--with-rtai-dir=],
fp@485: [RTAI path (only for RTAI examples)]
fp@485: ),
fp@485: [
fp@485: rtaidir=[$withval]
fp@485: ],
fp@485: [
fp@485: rtaidir=""
fp@485: ]
fp@485: )
fp@485:
fp@485: AC_MSG_CHECKING([for RTAI path])
fp@485:
fp@485: if test -z "${rtaidir}"; then
fp@485: AC_MSG_RESULT([not specified.])
fp@485: else
fp@485: if test \! -r ${rtaidir}/include/rtai.h; then
fp@485: AC_MSG_ERROR([no RTAI installation found in ${rtaidir}!])
fp@485: fi
fp@485: AC_MSG_RESULT([$rtaidir])
fp@732: fi
fp@732:
fp@732: AC_SUBST(RTAI_DIR,[$rtaidir])
fp@485:
fp@485: #------------------------------------------------------------------------------
fp@392: # Debug interface
fp@392: #------------------------------------------------------------------------------
fp@392:
fp@679: AC_ARG_ENABLE([debug-if],
fp@679: AS_HELP_STRING([--enable-debug-if],
fp@440: [Create a debug interface for each master @<:@NO@:>@]),
fp@440: [
fp@440: case "${enableval}" in
fp@440: yes) dbg=1
fp@440: ;;
fp@440: no) dbg=0
fp@440: ;;
fp@679: *) AC_MSG_ERROR([Invalid value for --enable-debug-if])
fp@440: ;;
fp@440: esac
fp@440: ],
fp@440: [dbg=0]
fp@392: )
fp@440:
fp@679: if test "x${dbg}" = "x1"; then
fp@679: AC_DEFINE([EC_DEBUG_IF], [1], [Debug interfaces enabled])
fp@679: fi
fp@679: AM_CONDITIONAL(ENABLE_DEBUG_IF, test "x$dbg" = "x1")
fp@732: AC_SUBST(ENABLE_DEBUG_IF,[$dbg])
fp@679:
fp@679: #------------------------------------------------------------------------------
fp@692: # Debug ring
fp@692: #------------------------------------------------------------------------------
fp@692:
fp@692: AC_ARG_ENABLE([debug-ring],
fp@692: AS_HELP_STRING([--enable-debug-ring],
fp@692: [Create a debug ring to record frames @<:@NO@:>@]),
fp@692: [
fp@692: case "${enableval}" in
fp@692: yes) debugring=1
fp@692: ;;
fp@692: no) debugring=0
fp@692: ;;
fp@692: *) AC_MSG_ERROR([Invalid value for --enable-debug-ring])
fp@692: ;;
fp@692: esac
fp@692: ],
fp@692: [debugring=0]
fp@692: )
fp@692:
fp@692: if test "x${debugring}" = "x1"; then
fp@692: AC_DEFINE([EC_DEBUG_RING], [1], [Debug ring enabled])
fp@692: fi
fp@692:
fp@692: #------------------------------------------------------------------------------
fp@715: # Ethernet-over-EtherCAT support
fp@715: #------------------------------------------------------------------------------
fp@715:
fp@715: AC_ARG_ENABLE([eoe],
fp@715: AS_HELP_STRING([--enable-eoe],
fp@715: [Enable EoE support (default: yes)]),
fp@715: [
fp@715: case "${enableval}" in
fp@715: yes) eoe=1
fp@715: ;;
fp@715: no) eoe=0
fp@715: ;;
fp@715: *) AC_MSG_ERROR([Invalid value for --enable-eoe])
fp@715: ;;
fp@715: esac
fp@715: ],
fp@715: [eoe=1]
fp@715: )
fp@715:
fp@715: if test "x${eoe}" = "x1"; then
fp@715: AC_DEFINE([EC_EOE], [1], [EoE support enabled])
fp@715: fi
fp@715: AM_CONDITIONAL(ENABLE_EOE, test "x$eoe" = "x1")
fp@732: AC_SUBST(ENABLE_EOE,[$eoe])
fp@485:
fp@485: #------------------------------------------------------------------------------
fp@1040: # CPU timestamp counter support
fp@1040: #------------------------------------------------------------------------------
fp@1040:
fp@1040: AC_ARG_ENABLE([cycles],
fp@1040: AS_HELP_STRING([--enable-cycles],
fp@1040: [Use CPU timestamp counter (default: no)]),
fp@1040: [
fp@1040: case "${enableval}" in
fp@1040: yes) cycles=1
fp@1040: ;;
fp@1040: no) cycles=0
fp@1040: ;;
fp@1040: *) AC_MSG_ERROR([Invalid value for --enable-cycles])
fp@1040: ;;
fp@1040: esac
fp@1040: ],
fp@1040: [cycles=0]
fp@1040: )
fp@1040:
fp@1040: if test "x${cycles}" = "x1"; then
fp@1040: AC_DEFINE([EC_HAVE_CYCLES], [1], [Use CPU timestamp counter])
fp@1040: fi
fp@1040:
fp@1040: #------------------------------------------------------------------------------
fp@485:
ha@385: AC_CONFIG_FILES([
fp@757: Doxyfile
fp@732: Kbuild
fp@392: Makefile
fp@882: devices/Kbuild
fp@882: devices/Makefile
fp@882: devices/e1000/Kbuild
fp@882: devices/e1000/Makefile
fp@882: examples/Makefile
fp@882: examples/mini/Kbuild
fp@882: examples/mini/Makefile
fp@882: examples/rtai/Kbuild
fp@882: examples/rtai/Makefile
fp@882: include/Makefile
fp@732: master/Kbuild
fp@392: master/Makefile
ha@385: script/Makefile
fp@563: script/init.d/Makefile
fp@1185: script/init.d/ethercat
fp@563: script/sysconfig/Makefile
fp@1120: tool/Makefile
ha@385: ])
fp@365: AC_OUTPUT
fp@365:
fp@365: #------------------------------------------------------------------------------