fp@1724: #------------------------------------------------------------------------------ fp@1724: # $Id$ fp@1724: #------------------------------------------------------------------------------ fp@1724: fp@1731: AC_PREREQ(2.59) fp@1740: AC_INIT([ethercat],[1.2.0],[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@1732: # 8139too Kernel fp@1732: #------------------------------------------------------------------------------ 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@1732: AC_MSG_CHECKING([for kernel for 8139too driver]) fp@1732: fp@1732: kernels=`ls -1 devices/ | grep -oE "^8139too-.*-" | cut -d "-" -f 2 | uniq` fp@1732: found=0 fp@1732: for k in $kernels; do fp@1732: if test "$kernel8139too" = "$k"; then fp@1732: found=1 fp@1732: fi fp@1732: done fp@1732: if test $found -ne 1; then fp@1732: AC_MSG_ERROR([kernel $kernel8139too not available for 8139too driver!]) fp@1732: fi fp@1732: fp@1732: AC_MSG_RESULT([$kernel8139too]) fp@1732: 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@1732: AC_SUBST(RTAI_DIR,[$rtaidir]) fp@1732: fi 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@1732: AC_SUBST(MSR_DIR,[$msrdir]) fp@1725: fi fp@1724: fp@1724: #------------------------------------------------------------------------------ fp@1731: # Debug interface fp@1731: #------------------------------------------------------------------------------ fp@1724: fp@1732: AC_ARG_ENABLE([dbg-if], fp@1732: AS_HELP_STRING([--enable-dbg-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: AC_DEFINE([EC_DBG_IF], [1], [Debug interfaces enabled]) fp@1732: ;; fp@1732: no) dbg=0 fp@1732: ;; fp@1732: *) AC_MSG_ERROR([Invalid value for --enable-dbg-if]) fp@1732: ;; fp@1732: esac fp@1732: ], fp@1732: [dbg=0] fp@1732: ) fp@1732: fp@1731: AM_CONDITIONAL(EC_DBG_IF, test "x$dbg" = x1) fp@1731: AC_SUBST([EC_DBG_IF],${dbg}) fp@1731: fp@1731: #------------------------------------------------------------------------------ fp@1731: fp@1732: # Create config.kbuild fp@1732: fp@1732: echo configure: creating config.kbuild... fp@1732: fp@1732: cat > config.kbuild <