fp@365: #------------------------------------------------------------------------------
fp@365: # $Id$
fp@365: #------------------------------------------------------------------------------
fp@365:
fp@392: AC_PREREQ(2.59)
fp@662: AC_INIT([ethercat],[1.3.0-rc1],[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@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@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@582: kernels=`ls -1 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@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@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@569: kernels=`ls -1 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@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@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@581: kernels=`ls -1 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@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@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@667: kernels=`ls -1 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@667: #------------------------------------------------------------------------------
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@485: AC_SUBST(RTAI_DIR,[$rtaidir])
fp@485: fi
fp@485:
fp@485: #------------------------------------------------------------------------------
fp@485: # MSR path (optional)
fp@485: #------------------------------------------------------------------------------
fp@485:
fp@485: AC_ARG_WITH([msr-dir],
fp@485: AC_HELP_STRING(
fp@485: [--with-msr-dir=],
fp@485: [MSR path (only for MSR example)]
fp@485: ),
fp@485: [
fp@485: msrdir=[$withval]
fp@485: ],
fp@485: [
fp@485: msrdir=""
fp@485: ]
fp@485: )
fp@485:
fp@485: AC_MSG_CHECKING([for MSR path])
fp@485:
fp@485: if test -z "${msrdir}"; then
fp@485: AC_MSG_RESULT([not specified.])
fp@485: else
fp@485: if test \! -r ${msrdir}/include/msr.h; then
fp@485: AC_MSG_ERROR([no MSR installation found in ${msrdir}!])
fp@485: fi
fp@485: AC_MSG_RESULT([$msrdir])
fp@485: AC_SUBST(MSR_DIR,[$msrdir])
fp@485: fi
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@679:
fp@679: #------------------------------------------------------------------------------
fp@679: # Dummy master module
fp@679: #------------------------------------------------------------------------------
fp@679:
fp@679: AC_ARG_ENABLE([dummy],
fp@679: AS_HELP_STRING([--enable-dummy],
fp@679: [Build the dummy master module @<:@NO@:>@]),
fp@679: [
fp@679: case "${enableval}" in
fp@679: yes) dummy=1
fp@679: ;;
fp@679: no) dummy=0
fp@679: ;;
fp@679: *) AC_MSG_ERROR([Invalid value for --enable-dummy])
fp@679: ;;
fp@679: esac
fp@679: ],
fp@679: [dummy=0]
fp@679: )
fp@679:
fp@679: AM_CONDITIONAL(ENABLE_DUMMY, test "x$dummy" = "x1")
fp@392:
fp@392: #------------------------------------------------------------------------------
fp@365:
fp@485: # Create config.kbuild
fp@485:
fp@485: echo configure: creating config.kbuild...
fp@485:
fp@485: cat > config.kbuild <