configure.ac
changeset 2589 2b9c78543663
parent 2414 f35c7c8e6591
child 2600 1a969896d52e
equal deleted inserted replaced
2415:af21f0bdc7c9 2589:2b9c78543663
     1 #------------------------------------------------------------------------------
     1 #------------------------------------------------------------------------------
     2 #
     2 #
     3 #  $Id$
     3 #  $Id$
     4 #
     4 #
     5 #  Copyright (C) 2006-2009  Florian Pose, Ingenieurgemeinschaft IgH
     5 #  Copyright (C) 2006-2012  Florian Pose, Ingenieurgemeinschaft IgH
     6 #
     6 #
     7 #  This file is part of the IgH EtherCAT Master.
     7 #  This file is part of the IgH EtherCAT Master.
     8 #
     8 #
     9 #  The IgH EtherCAT Master is free software; you can redistribute it and/or
     9 #  The IgH EtherCAT Master is free software; you can redistribute it and/or
    10 #  modify it under the terms of the GNU General Public License version 2, as
    10 #  modify it under the terms of the GNU General Public License version 2, as
    26 #  industrial property and similar rights of Beckhoff Automation GmbH.
    26 #  industrial property and similar rights of Beckhoff Automation GmbH.
    27 #
    27 #
    28 #------------------------------------------------------------------------------
    28 #------------------------------------------------------------------------------
    29 
    29 
    30 AC_PREREQ(2.59)
    30 AC_PREREQ(2.59)
    31 AC_INIT([ethercat],[devel],[fp@igh-essen.com])
    31 
       
    32 #
       
    33 # Release procedure
       
    34 # - Update Ethernet drivers up to release kernel version
       
    35 # - Write NEWS entry with changes since last release
       
    36 # - Check for complete Doxygen comments
       
    37 # - Update version number in documentation
       
    38 # - Update the ChangeLog -> hg log -bstable-1.5 --style=changelog > ChangeLog
       
    39 # - Update version number below
       
    40 # - make dist-bzip2
       
    41 #
       
    42 AC_INIT([ethercat],[1.5.2],[fp@igh-essen.com])
    32 AC_CONFIG_AUX_DIR([autoconf])
    43 AC_CONFIG_AUX_DIR([autoconf])
    33 AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2])
    44 AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2 subdir-objects])
    34 AC_PREFIX_DEFAULT([/opt/etherlab])
    45 AC_PREFIX_DEFAULT([/opt/etherlab])
    35 AC_CONFIG_HEADERS([config.h])
    46 AC_CONFIG_HEADERS([config.h])
    36 AC_CONFIG_SRCDIR([config.h.in])
    47 AC_CONFIG_SRCDIR([config.h.in])
    37 AC_CONFIG_MACRO_DIR([m4])
    48 AC_CONFIG_MACRO_DIR([m4])
    38 
    49 
    39 #------------------------------------------------------------------------------
    50 #------------------------------------------------------------------------------
    40 # Global
    51 # Global
    41 #------------------------------------------------------------------------------
    52 #------------------------------------------------------------------------------
    42 
    53 
       
    54 AM_PROG_CC_C_O
       
    55 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
    43 AC_PROG_CXX
    56 AC_PROG_CXX
    44 AC_PROG_LIBTOOL
    57 AC_PROG_LIBTOOL
    45 AM_PROG_CC_C_O
    58 
       
    59 #------------------------------------------------------------------------------
       
    60 # Kernel modules
       
    61 #------------------------------------------------------------------------------
       
    62 
       
    63 AC_MSG_CHECKING([whether to build kernel modules])
       
    64 
       
    65 AC_ARG_ENABLE([kernel],
       
    66     AS_HELP_STRING([--enable-kernel],
       
    67                    [Enable building kernel modules]),
       
    68     [
       
    69         case "${enableval}" in
       
    70             yes) enablekernel=1
       
    71                 ;;
       
    72             no) enablekernel=0
       
    73                 ;;
       
    74             *) AC_MSG_ERROR([Invalid value for --enable-generic])
       
    75                 ;;
       
    76         esac
       
    77     ],
       
    78     [enablekernel=1]
       
    79 )
       
    80 
       
    81 if test "x$enablekernel" = "x1"; then
       
    82     AC_MSG_RESULT([yes])
       
    83 else
       
    84     AC_MSG_RESULT([no])
       
    85 fi
       
    86 
       
    87 AM_CONDITIONAL(ENABLE_KERNEL, test "x$enablekernel" = "x1")
       
    88 AC_SUBST(ENABLE_KERNEL,[$enablekernel])
    46 
    89 
    47 #------------------------------------------------------------------------------
    90 #------------------------------------------------------------------------------
    48 # Linux sources
    91 # Linux sources
    49 #------------------------------------------------------------------------------
    92 #------------------------------------------------------------------------------
       
    93 
       
    94 if test "x$enablekernel" = "x1"; then
    50 
    95 
    51 AC_ARG_WITH([linux-dir],
    96 AC_ARG_WITH([linux-dir],
    52     AC_HELP_STRING(
    97     AC_HELP_STRING(
    53         [--with-linux-dir=<DIR>],
    98         [--with-linux-dir=<DIR>],
    54         [Linux kernel sources @<:@running kernel@:>@]
    99         [Linux kernel sources @<:@running kernel@:>@]
   102 linuxversion=`echo $kernelrelease | grep -oE "$regex"`
   147 linuxversion=`echo $kernelrelease | grep -oE "$regex"`
   103 
   148 
   104 AC_SUBST(LINUX_SOURCE_DIR,[$sourcedir])
   149 AC_SUBST(LINUX_SOURCE_DIR,[$sourcedir])
   105 AC_MSG_RESULT([$LINUX_SOURCE_DIR (Kernel $linuxversion)])
   150 AC_MSG_RESULT([$LINUX_SOURCE_DIR (Kernel $linuxversion)])
   106 
   151 
       
   152 fi
       
   153 
   107 #------------------------------------------------------------------------------
   154 #------------------------------------------------------------------------------
   108 # Linux module installation subdirectory
   155 # Linux module installation subdirectory
   109 #------------------------------------------------------------------------------
   156 #------------------------------------------------------------------------------
   110 
   157 
   111 AC_ARG_WITH([module-dir],
   158 AC_ARG_WITH([module-dir],
   136                 ;;
   183                 ;;
   137             *) AC_MSG_ERROR([Invalid value for --enable-generic])
   184             *) AC_MSG_ERROR([Invalid value for --enable-generic])
   138                 ;;
   185                 ;;
   139         esac
   186         esac
   140     ],
   187     ],
   141     [enablegeneric=1]
   188     [enablegeneric=$enablekernel]
   142 )
   189 )
   143 
   190 
   144 AM_CONDITIONAL(ENABLE_GENERIC, test "x$enablegeneric" = "x1")
   191 AM_CONDITIONAL(ENABLE_GENERIC, test "x$enablegeneric" = "x1")
   145 AC_SUBST(ENABLE_GENERIC,[$enablegeneric])
   192 AC_SUBST(ENABLE_GENERIC,[$enablegeneric])
   146 
   193 
   159                 ;;
   206                 ;;
   160             *) AC_MSG_ERROR([Invalid value for --enable-8139too])
   207             *) AC_MSG_ERROR([Invalid value for --enable-8139too])
   161                 ;;
   208                 ;;
   162         esac
   209         esac
   163     ],
   210     ],
   164     [enable8139too=1]
   211     [enable8139too=$enablekernel]
   165 )
   212 )
   166 
   213 
   167 AM_CONDITIONAL(ENABLE_8139TOO, test "x$enable8139too" = "x1")
   214 AM_CONDITIONAL(ENABLE_8139TOO, test "x$enable8139too" = "x1")
   168 AC_SUBST(ENABLE_8139TOO,[$enable8139too])
   215 AC_SUBST(ENABLE_8139TOO,[$enable8139too])
   169 
   216 
   343     [
   390     [
   344         kernele1000e=$linuxversion
   391         kernele1000e=$linuxversion
   345     ]
   392     ]
   346 )
   393 )
   347 
   394 
       
   395 e1000elayout=0
       
   396 
   348 if test "x${enablee1000e}" = "x1"; then
   397 if test "x${enablee1000e}" = "x1"; then
   349     AC_MSG_CHECKING([for kernel for e1000e driver])
   398     AC_MSG_CHECKING([for kernel for e1000e driver])
   350 
   399 
   351     kernels=`ls -1 ${srcdir}/devices/e1000e/ | grep -oE "^netdev-.*" | cut -d "-" -f 2 | uniq`
   400     kernels=`ls -1 ${srcdir}/devices/e1000e/ | grep -oE "^netdev-.*" | cut -d "-" -f 2 | uniq`
   352     found=0
   401     found=0
   358     if test $found -ne 1; then
   407     if test $found -ne 1; then
   359         AC_MSG_ERROR([kernel $kernele1000e not available for e1000e driver!])
   408         AC_MSG_ERROR([kernel $kernele1000e not available for e1000e driver!])
   360     fi
   409     fi
   361 
   410 
   362     AC_MSG_RESULT([$kernele1000e])
   411     AC_MSG_RESULT([$kernele1000e])
       
   412 
       
   413     # check for e1000e file layout (changed in kernel 3.4 and 3.10)
       
   414     AC_MSG_CHECKING([for e1000e source layout])
       
   415 
       
   416     file34="${srcdir}/devices/e1000e/80003es2lan-$kernele1000e-ethercat.c"
       
   417     file310="${srcdir}/devices/e1000e/ptp-$kernele1000e-ethercat.c"
       
   418 
       
   419     if test -r "$file310"; then
       
   420         AC_MSG_RESULT([>= 3.10])
       
   421         e1000elayout=2
       
   422     elif test -r "$file34"; then
       
   423         AC_MSG_RESULT([>= 3.4])
       
   424         e1000elayout=1
       
   425     else
       
   426         AC_MSG_RESULT([before 3.4])
       
   427     fi
       
   428 
   363 fi
   429 fi
   364 
   430 
   365 AC_SUBST(KERNEL_E1000E,[$kernele1000e])
   431 AC_SUBST(KERNEL_E1000E,[$kernele1000e])
       
   432 AC_SUBST(E1000E_LAYOUT, [$e1000elayout])
   366 
   433 
   367 #------------------------------------------------------------------------------
   434 #------------------------------------------------------------------------------
   368 # r8169 driver
   435 # r8169 driver
   369 #------------------------------------------------------------------------------
   436 #------------------------------------------------------------------------------
   370 
   437 
   418 fi
   485 fi
   419 
   486 
   420 AC_SUBST(KERNEL_R8169,[$kernel_r8169])
   487 AC_SUBST(KERNEL_R8169,[$kernel_r8169])
   421 
   488 
   422 #------------------------------------------------------------------------------
   489 #------------------------------------------------------------------------------
       
   490 # CCAT driver
       
   491 #------------------------------------------------------------------------------
       
   492 
       
   493 AC_MSG_CHECKING([whether to build the CCAT driver])
       
   494 
       
   495 AC_ARG_ENABLE([ccat],
       
   496     AS_HELP_STRING([--enable-ccat],
       
   497                    [Enable CCAT driver]),
       
   498     [
       
   499         case "${enableval}" in
       
   500             yes) enableccat=1
       
   501                 ;;
       
   502             no) enableccat=0
       
   503                 ;;
       
   504             *) AC_MSG_ERROR([Invalid value for --enable-ccat])
       
   505                 ;;
       
   506         esac
       
   507     ],
       
   508     [enableccat=0] # disabled by default
       
   509 )
       
   510 
       
   511 if test "x${enableccat}" = "x1"; then
       
   512     AC_MSG_RESULT([yes])
       
   513 else
       
   514     AC_MSG_RESULT([no])
       
   515 fi
       
   516 
       
   517 AM_CONDITIONAL(ENABLE_CCAT, test "x$enableccat" = "x1")
       
   518 AC_SUBST(ENABLE_CCAT,[$enableccat])
       
   519 
       
   520 #------------------------------------------------------------------------------
   423 # RTAI path (optional)
   521 # RTAI path (optional)
   424 #------------------------------------------------------------------------------
   522 #------------------------------------------------------------------------------
   425 
   523 
   426 AC_ARG_WITH([rtai-dir],
   524 AC_ARG_WITH([rtai-dir],
   427     AC_HELP_STRING(
   525     AC_HELP_STRING(
   428         [--with-rtai-dir=<DIR>],
   526         [--with-rtai-dir=<DIR>],
   429         [RTAI path (only for RTDM Interface or RTAI examples)]
   527         [RTAI path, for RTDM interface and RTAI examples]
   430     ),
   528     ),
   431     [
   529     [
   432         rtaidir=[$withval]
   530         rtaidir=[$withval]
   433         rtai=1
   531         rtai=1
   434     ],
   532     ],
   445 else
   543 else
   446     if test \! -r ${rtaidir}/include/rtai.h; then
   544     if test \! -r ${rtaidir}/include/rtai.h; then
   447         AC_MSG_ERROR([no RTAI installation found in ${rtaidir}!])
   545         AC_MSG_ERROR([no RTAI installation found in ${rtaidir}!])
   448     fi
   546     fi
   449     AC_MSG_RESULT([$rtaidir])
   547     AC_MSG_RESULT([$rtaidir])
       
   548 
       
   549     rtai_lxrt_cflags=`$rtaidir/bin/rtai-config --lxrt-cflags`
       
   550     rtai_lxrt_ldflags=`$rtaidir/bin/rtai-config --lxrt-ldflags`
   450 fi
   551 fi
   451 
   552 
   452 AC_SUBST(RTAI_DIR,[$rtaidir])
   553 AC_SUBST(RTAI_DIR,[$rtaidir])
   453 AM_CONDITIONAL(ENABLE_RTAI, test "x$rtai" = "x1")
   554 AM_CONDITIONAL(ENABLE_RTAI, test "x$rtai" = "x1")
   454 AC_SUBST(ENABLE_RTAI,[$rtai])
   555 AC_SUBST(ENABLE_RTAI,[$rtai])
   455 
   556 
       
   557 AC_SUBST(RTAI_LXRT_CFLAGS,[$rtai_lxrt_cflags])
       
   558 AC_SUBST(RTAI_LXRT_LDFLAGS,[$rtai_lxrt_ldflags])
       
   559 
   456 #------------------------------------------------------------------------------
   560 #------------------------------------------------------------------------------
   457 # Xenomai path (optional)
   561 # Xenomai path (optional)
   458 #------------------------------------------------------------------------------
   562 #------------------------------------------------------------------------------
   459 
   563 
   460 AC_ARG_WITH([xenomai-dir],
   564 AC_ARG_WITH([xenomai-dir],
   461     AC_HELP_STRING(
   565     AC_HELP_STRING(
   462         [--with-xenomai-dir=<DIR>],
   566         [--with-xenomai-dir=<DIR>],
   463         [Xenomai path (only for RTDM Interface)]
   567         [Xenomai path, for RTDM interface and Xenomai examples]
   464     ),
   568     ),
   465     [
   569     [
   466         xenomaidir=[$withval]
   570         xenomaidir=[$withval]
   467         xeno=1
   571         xeno=1
   468     ],
   572     ],
   479 else
   583 else
   480     if test \! -r ${xenomaidir}/include/xeno_config.h; then
   584     if test \! -r ${xenomaidir}/include/xeno_config.h; then
   481         AC_MSG_ERROR([no Xenomai installation found in ${xenomaidir}!])
   585         AC_MSG_ERROR([no Xenomai installation found in ${xenomaidir}!])
   482     fi
   586     fi
   483     AC_MSG_RESULT([$xenomaidir])
   587     AC_MSG_RESULT([$xenomaidir])
       
   588 
       
   589     xeno_native_cflags=`$xenomaidir/bin/xeno-config --skin native --cflags`
       
   590     xeno_native_ldflags=`$xenomaidir/bin/xeno-config --skin native --ldflags`
       
   591     xeno_posix_cflags=`$xenomaidir/bin/xeno-config --skin posix --cflags`
       
   592     xeno_posix_ldflags=`$xenomaidir/bin/xeno-config --skin posix --ldflags`
       
   593     xeno_rtdm_cflags=`$xenomaidir/bin/xeno-config --skin rtdm --cflags`
       
   594     xeno_rtdm_ldflags=`$xenomaidir/bin/xeno-config --skin rtdm --ldflags`
   484 fi
   595 fi
   485 
   596 
   486 AC_SUBST(XENOMAI_DIR,[$xenomaidir])
   597 AC_SUBST(XENOMAI_DIR,[$xenomaidir])
   487 AM_CONDITIONAL(ENABLE_XENOMAI, test "x$xeno" = "x1")
   598 AM_CONDITIONAL(ENABLE_XENOMAI, test "x$xeno" = "x1")
   488 AC_SUBST(ENABLE_XENOMAI,[$xeno])
   599 AC_SUBST(ENABLE_XENOMAI,[$xeno])
   489 
   600 
   490 #------------------------------------------------------------------------------
   601 AC_SUBST(XENOMAI_NATIVE_CFLAGS,[$xeno_native_cflags])
   491 # RTDM Interface (optional)
   602 AC_SUBST(XENOMAI_NATIVE_LDFLAGS,[$xeno_native_ldflags])
       
   603 AC_SUBST(XENOMAI_POSIX_CFLAGS,[$xeno_posix_cflags])
       
   604 AC_SUBST(XENOMAI_POSIX_LDFLAGS,[$xeno_posix_ldflags])
       
   605 AC_SUBST(XENOMAI_RTDM_CFLAGS,[$xeno_rtdm_cflags])
       
   606 AC_SUBST(XENOMAI_RTDM_LDFLAGS,[$xeno_rtdm_ldflags])
       
   607 
       
   608 #------------------------------------------------------------------------------
       
   609 # RTDM interface (optional)
   492 #------------------------------------------------------------------------------
   610 #------------------------------------------------------------------------------
   493 
   611 
   494 AC_ARG_ENABLE([rtdm],
   612 AC_ARG_ENABLE([rtdm],
   495     AC_HELP_STRING(
   613     AC_HELP_STRING(
   496         [--enable-rtdm],
   614         [--enable-rtdm],
   497         [Enable RTDM Interface, depends on RTAI or Xenomai]
   615         [Enable RTDM interface, depends on RTAI or Xenomai]
   498     ),
   616     ),
   499     [
   617     [
   500         case "${enableval}" in
   618         case "${enableval}" in
   501             yes) rtdm=1
   619             yes) rtdm=1
   502                 ;;
   620                 ;;
   507         esac
   625         esac
   508     ],
   626     ],
   509     [rtdm=0]
   627     [rtdm=0]
   510 )
   628 )
   511 
   629 
       
   630 AC_MSG_CHECKING([whether to build RTDM interface])
       
   631 
   512 if test "x${rtdm}" = "x1"; then
   632 if test "x${rtdm}" = "x1"; then
   513     AC_DEFINE([EC_RTDM], [1], [RTDM interfaces enabled])
   633     AC_DEFINE([EC_RTDM], [1], [RTDM interface enabled])
   514 fi
   634     AC_MSG_RESULT([yes])
       
   635 else
       
   636     AC_MSG_RESULT([no])
       
   637 fi
       
   638 
   515 AM_CONDITIONAL(ENABLE_RTDM, test "x$rtdm" = "x1")
   639 AM_CONDITIONAL(ENABLE_RTDM, test "x$rtdm" = "x1")
   516 AC_SUBST(ENABLE_RTDM,[$rtdm])
   640 AC_SUBST(ENABLE_RTDM,[$rtdm])
   517 
   641 
   518 
       
   519 #------------------------------------------------------------------------------
   642 #------------------------------------------------------------------------------
   520 # Debug interface
   643 # Debug interface
   521 #------------------------------------------------------------------------------
   644 #------------------------------------------------------------------------------
       
   645 
       
   646 AC_MSG_CHECKING([whether to build the debug interface])
   522 
   647 
   523 AC_ARG_ENABLE([debug-if],
   648 AC_ARG_ENABLE([debug-if],
   524     AS_HELP_STRING([--enable-debug-if],
   649     AS_HELP_STRING([--enable-debug-if],
   525                    [Create a debug interface for each master @<:@NO@:>@]),
   650                    [Create a debug interface for each master @<:@NO@:>@]),
   526     [
   651     [
   536     [dbg=0]
   661     [dbg=0]
   537 )
   662 )
   538 
   663 
   539 if test "x${dbg}" = "x1"; then
   664 if test "x${dbg}" = "x1"; then
   540     AC_DEFINE([EC_DEBUG_IF], [1], [Debug interfaces enabled])
   665     AC_DEFINE([EC_DEBUG_IF], [1], [Debug interfaces enabled])
   541 fi
   666     AC_MSG_RESULT([yes])
       
   667 else
       
   668     AC_MSG_RESULT([no])
       
   669 fi
       
   670 
   542 AM_CONDITIONAL(ENABLE_DEBUG_IF, test "x$dbg" = "x1")
   671 AM_CONDITIONAL(ENABLE_DEBUG_IF, test "x$dbg" = "x1")
   543 AC_SUBST(ENABLE_DEBUG_IF,[$dbg])
   672 AC_SUBST(ENABLE_DEBUG_IF,[$dbg])
   544 
   673 
   545 #------------------------------------------------------------------------------
   674 #------------------------------------------------------------------------------
   546 # Debug ring
   675 # Debug ring
   547 #------------------------------------------------------------------------------
   676 #------------------------------------------------------------------------------
       
   677 
       
   678 AC_MSG_CHECKING([whether to build the debug ring])
   548 
   679 
   549 AC_ARG_ENABLE([debug-ring],
   680 AC_ARG_ENABLE([debug-ring],
   550     AS_HELP_STRING([--enable-debug-ring],
   681     AS_HELP_STRING([--enable-debug-ring],
   551                    [Create a debug ring to record frames @<:@NO@:>@]),
   682                    [Create a debug ring to record frames @<:@NO@:>@]),
   552     [
   683     [
   562     [debugring=0]
   693     [debugring=0]
   563 )
   694 )
   564 
   695 
   565 if test "x${debugring}" = "x1"; then
   696 if test "x${debugring}" = "x1"; then
   566     AC_DEFINE([EC_DEBUG_RING], [1], [Debug ring enabled])
   697     AC_DEFINE([EC_DEBUG_RING], [1], [Debug ring enabled])
       
   698     AC_MSG_RESULT([yes])
       
   699 else
       
   700     AC_MSG_RESULT([no])
   567 fi
   701 fi
   568 
   702 
   569 #------------------------------------------------------------------------------
   703 #------------------------------------------------------------------------------
   570 # Ethernet over EtherCAT support
   704 # Ethernet over EtherCAT support
   571 #------------------------------------------------------------------------------
   705 #------------------------------------------------------------------------------
       
   706 
       
   707 AC_MSG_CHECKING([whether to build with EoE support])
   572 
   708 
   573 AC_ARG_ENABLE([eoe],
   709 AC_ARG_ENABLE([eoe],
   574     AS_HELP_STRING([--enable-eoe],
   710     AS_HELP_STRING([--enable-eoe],
   575                    [Enable EoE support (default: yes)]),
   711                    [Enable EoE support (default: yes)]),
   576     [
   712     [
   586     [eoe=1]
   722     [eoe=1]
   587 )
   723 )
   588 
   724 
   589 if test "x${eoe}" = "x1"; then
   725 if test "x${eoe}" = "x1"; then
   590     AC_DEFINE([EC_EOE], [1], [EoE support enabled])
   726     AC_DEFINE([EC_EOE], [1], [EoE support enabled])
   591 fi
   727     AC_MSG_RESULT([yes])
       
   728 else
       
   729     AC_MSG_RESULT([no])
       
   730 fi
       
   731 
   592 AM_CONDITIONAL(ENABLE_EOE, test "x$eoe" = "x1")
   732 AM_CONDITIONAL(ENABLE_EOE, test "x$eoe" = "x1")
   593 AC_SUBST(ENABLE_EOE,[$eoe])
   733 AC_SUBST(ENABLE_EOE,[$eoe])
   594 
   734 
   595 #------------------------------------------------------------------------------
   735 #------------------------------------------------------------------------------
   596 # CPU timestamp counter support
   736 # CPU timestamp counter support
   597 #------------------------------------------------------------------------------
   737 #------------------------------------------------------------------------------
       
   738 
       
   739 AC_MSG_CHECKING([whether to use the CPU timestamp counter])
   598 
   740 
   599 AC_ARG_ENABLE([cycles],
   741 AC_ARG_ENABLE([cycles],
   600     AS_HELP_STRING([--enable-cycles],
   742     AS_HELP_STRING([--enable-cycles],
   601                    [Use CPU timestamp counter (default: no)]),
   743                    [Use CPU timestamp counter (default: no)]),
   602     [
   744     [
   612     [cycles=0]
   754     [cycles=0]
   613 )
   755 )
   614 
   756 
   615 if test "x${cycles}" = "x1"; then
   757 if test "x${cycles}" = "x1"; then
   616     AC_DEFINE([EC_HAVE_CYCLES], [1], [Use CPU timestamp counter])
   758     AC_DEFINE([EC_HAVE_CYCLES], [1], [Use CPU timestamp counter])
       
   759     AC_MSG_RESULT([yes])
       
   760 else
       
   761     AC_MSG_RESULT([no])
   617 fi
   762 fi
   618 
   763 
   619 #------------------------------------------------------------------------------
   764 #------------------------------------------------------------------------------
   620 # High-resolution timer support
   765 # High-resolution timer support
   621 #------------------------------------------------------------------------------
   766 #------------------------------------------------------------------------------
       
   767 
       
   768 AC_MSG_CHECKING([whether to use high-resolution timers for scheduling])
   622 
   769 
   623 AC_ARG_ENABLE([hrtimer],
   770 AC_ARG_ENABLE([hrtimer],
   624     AS_HELP_STRING([--enable-hrtimer],
   771     AS_HELP_STRING([--enable-hrtimer],
   625                    [Use high-resolution timer for scheduling (default: no)]),
   772                    [Use high-resolution timer for scheduling (default: no)]),
   626     [
   773     [
   636     [hrtimer=0]
   783     [hrtimer=0]
   637 )
   784 )
   638 
   785 
   639 if test "x${hrtimer}" = "x1"; then
   786 if test "x${hrtimer}" = "x1"; then
   640     AC_DEFINE([EC_USE_HRTIMER], [1], [Use hrtimer for scheduling])
   787     AC_DEFINE([EC_USE_HRTIMER], [1], [Use hrtimer for scheduling])
   641 fi
   788     AC_MSG_RESULT([yes])
   642 
   789 else
   643 #------------------------------------------------------------------------------
   790     AC_MSG_RESULT([no])
   644 # Use 2 datagrams (payload+last-byte) when sending to mailbox (reduces frame size)
   791 fi
   645 #------------------------------------------------------------------------------
       
   646 
       
   647 AC_ARG_ENABLE([mboxframesize],
       
   648     AS_HELP_STRING([--enable-mboxframesize],
       
   649                    [Reduced frame size when sending to mailbox, uses 2 datagrams (default: no)]),
       
   650     [
       
   651         case "${enableval}" in
       
   652             yes) mboxframesize=1
       
   653                 ;;
       
   654             no) mboxframesize=0
       
   655                 ;;
       
   656             *) AC_MSG_ERROR([Invalid value for --enable-mboxframesize])
       
   657                 ;;
       
   658         esac
       
   659     ],
       
   660     [mboxframesize=0]
       
   661 )
       
   662 
       
   663 if test "x${mboxframesize}" = "x1"; then
       
   664     AC_DEFINE([EC_REDUCE_MBOXFRAMESIZE], [1], [Reduced frame size when sending to mailbox])
       
   665 fi
       
   666 
       
   667 
   792 
   668 #------------------------------------------------------------------------------
   793 #------------------------------------------------------------------------------
   669 # Read alias address from register
   794 # Read alias address from register
   670 #------------------------------------------------------------------------------
   795 #------------------------------------------------------------------------------
       
   796 
       
   797 AC_MSG_CHECKING([whether to read alias addresses from registers])
   671 
   798 
   672 AC_ARG_ENABLE([regalias],
   799 AC_ARG_ENABLE([regalias],
   673     AS_HELP_STRING([--enable-regalias],
   800     AS_HELP_STRING([--enable-regalias],
   674                    [Read alias adresses from register (default: no)]),
   801                    [Read alias adresses from register (default: no)]),
   675     [
   802     [
   685     [regalias=0]
   812     [regalias=0]
   686 )
   813 )
   687 
   814 
   688 if test "x${regalias}" = "x1"; then
   815 if test "x${regalias}" = "x1"; then
   689     AC_DEFINE([EC_REGALIAS], [1], [Read alias adresses from register])
   816     AC_DEFINE([EC_REGALIAS], [1], [Read alias adresses from register])
   690 fi
   817     AC_MSG_RESULT([yes])
   691 
   818 else
       
   819     AC_MSG_RESULT([no])
       
   820 fi
   692 
   821 
   693 #------------------------------------------------------------------------------
   822 #------------------------------------------------------------------------------
   694 # Command-line tool
   823 # Command-line tool
   695 #-----------------------------------------------------------------------------
   824 #-----------------------------------------------------------------------------
       
   825 
       
   826 AC_MSG_CHECKING([whether to build the command-line tool])
   696 
   827 
   697 AC_ARG_ENABLE([tool],
   828 AC_ARG_ENABLE([tool],
   698     AS_HELP_STRING([--enable-tool],
   829     AS_HELP_STRING([--enable-tool],
   699                    [Build command-line tool (default: yes)]),
   830                    [Build command-line tool (default: yes)]),
   700     [
   831     [
   708         esac
   839         esac
   709     ],
   840     ],
   710     [tool=1]
   841     [tool=1]
   711 )
   842 )
   712 
   843 
       
   844 if test "x${tool}" = "x1"; then
       
   845     AC_MSG_RESULT([yes])
       
   846 else
       
   847     AC_MSG_RESULT([no])
       
   848 fi
       
   849 
   713 AM_CONDITIONAL(BUILD_TOOL, test "x$tool" = "x1")
   850 AM_CONDITIONAL(BUILD_TOOL, test "x$tool" = "x1")
   714 
   851 
   715 #------------------------------------------------------------------------------
   852 #------------------------------------------------------------------------------
   716 # Userspace library generation
   853 # Userspace library generation
   717 #------------------------------------------------------------------------------
   854 #------------------------------------------------------------------------------
       
   855 
       
   856 AC_MSG_CHECKING([whether to build the userspace library])
   718 
   857 
   719 AC_ARG_ENABLE([userlib],
   858 AC_ARG_ENABLE([userlib],
   720     AS_HELP_STRING([--enable-userlib],
   859     AS_HELP_STRING([--enable-userlib],
   721                    [Generation of the userspace library (default: yes)]),
   860                    [Generation of the userspace library (default: yes)]),
   722     [
   861     [
   730         esac
   869         esac
   731     ],
   870     ],
   732     [userlib=1]
   871     [userlib=1]
   733 )
   872 )
   734 
   873 
       
   874 if test "x${userlib}" = "x1"; then
       
   875     AC_MSG_RESULT([yes])
       
   876 else
       
   877     AC_MSG_RESULT([no])
       
   878 fi
       
   879 
   735 AM_CONDITIONAL(ENABLE_USERLIB, test "x$userlib" = "x1")
   880 AM_CONDITIONAL(ENABLE_USERLIB, test "x$userlib" = "x1")
   736 
   881 
   737 #------------------------------------------------------------------------------
   882 #------------------------------------------------------------------------------
   738 # TTY driver
   883 # TTY driver
   739 #------------------------------------------------------------------------------
   884 #------------------------------------------------------------------------------
       
   885 
       
   886 AC_MSG_CHECKING([whether to build the tty driver])
   740 
   887 
   741 AC_ARG_ENABLE([tty],
   888 AC_ARG_ENABLE([tty],
   742     AS_HELP_STRING([--enable-tty],
   889     AS_HELP_STRING([--enable-tty],
   743                    [Generation of the ec_tty module (default: no)]),
   890                    [Generation of the ec_tty module (default: no)]),
   744     [
   891     [
   752         esac
   899         esac
   753     ],
   900     ],
   754     [tty=0]
   901     [tty=0]
   755 )
   902 )
   756 
   903 
       
   904 if test "x${tty}" = "x1"; then
       
   905     AC_MSG_RESULT([yes])
       
   906 else
       
   907     AC_MSG_RESULT([no])
       
   908 fi
       
   909 
   757 AM_CONDITIONAL(ENABLE_TTY, test "x$tty" = "x1")
   910 AM_CONDITIONAL(ENABLE_TTY, test "x$tty" = "x1")
   758 AC_SUBST(ENABLE_TTY,[$tty])
   911 AC_SUBST(ENABLE_TTY,[$tty])
   759 
   912 
   760 #------------------------------------------------------------------------------
   913 #------------------------------------------------------------------------------
   761 # Slave identification wildcards
   914 # Slave identification wildcards
   762 #------------------------------------------------------------------------------
   915 #------------------------------------------------------------------------------
       
   916 
       
   917 AC_MSG_CHECKING([whether to allow identification wildcards])
   763 
   918 
   764 AC_ARG_ENABLE([wildcards],
   919 AC_ARG_ENABLE([wildcards],
   765     AS_HELP_STRING([--enable-wildcards],
   920     AS_HELP_STRING([--enable-wildcards],
   766                    [Enable vendor ID / product code wildcards (default: no)]),
   921                    [Enable vendor ID / product code wildcards (default: no)]),
   767     [
   922     [
   778 )
   933 )
   779 
   934 
   780 if test "x${wildcards}" = "x1"; then
   935 if test "x${wildcards}" = "x1"; then
   781     AC_DEFINE([EC_IDENT_WILDCARDS], [1],
   936     AC_DEFINE([EC_IDENT_WILDCARDS], [1],
   782         [Use vendor id / product code wildcards])
   937         [Use vendor id / product code wildcards])
       
   938     AC_MSG_RESULT([yes])
       
   939 else
       
   940     AC_MSG_RESULT([no])
       
   941 fi
       
   942 
       
   943 #------------------------------------------------------------------------------
       
   944 # Redundancy (number of devices)
       
   945 #------------------------------------------------------------------------------
       
   946 
       
   947 AC_ARG_WITH([devices],
       
   948     AC_HELP_STRING(
       
   949         [--with-devices=<NUMBER>],
       
   950         [Number of Ethernet devices per master. Default: 1]
       
   951     ),
       
   952     [
       
   953         devices=[$withval]
       
   954     ],
       
   955     [
       
   956         devices=1
       
   957     ]
       
   958 )
       
   959 
       
   960 AC_MSG_CHECKING([for number of Ethernet devices])
       
   961 
       
   962 if test "${devices}" -lt 1; then
       
   963     AC_MSG_ERROR([Number must be greater zero!])
       
   964 else
       
   965     if test "${devices}" -gt 1; then
       
   966         AC_MSG_RESULT([$devices (Redundancy enabled)])
       
   967     else
       
   968         AC_MSG_RESULT([$devices (Redundancy disabled)])
       
   969     fi
       
   970 fi
       
   971 
       
   972 AC_DEFINE_UNQUOTED([EC_MAX_NUM_DEVICES], $devices,
       
   973     [Max. number of Ethernet devices per master])
       
   974 
       
   975 #------------------------------------------------------------------------------
       
   976 # SII assignment
       
   977 #------------------------------------------------------------------------------
       
   978 
       
   979 AC_MSG_CHECKING([whether to assign the SII to PDI])
       
   980 
       
   981 AC_ARG_ENABLE([sii-assign],
       
   982     AS_HELP_STRING([--enable-sii-assign],
       
   983                    [Enable SII assignment to PDI (default: no)]),
       
   984     [
       
   985         case "${enableval}" in
       
   986             yes) siiassign=1
       
   987                 ;;
       
   988             no) siiassign=0
       
   989                 ;;
       
   990             *) AC_MSG_ERROR([Invalid value for --enable-sii-assign])
       
   991                 ;;
       
   992         esac
       
   993     ],
       
   994     [siiassign=0]
       
   995 )
       
   996 
       
   997 if test "x${siiassign}" = "x1"; then
       
   998     AC_DEFINE([EC_SII_ASSIGN], [1], [Assign SII to PDI])
       
   999     AC_MSG_RESULT([yes])
       
  1000 else
       
  1001     AC_MSG_RESULT([no])
       
  1002 fi
       
  1003 
       
  1004 #------------------------------------------------------------------------------
       
  1005 # syslog output in realtime context
       
  1006 #------------------------------------------------------------------------------
       
  1007 
       
  1008 AC_MSG_CHECKING([whether to syslog in realtime context])
       
  1009 
       
  1010 AC_ARG_ENABLE([rt-syslog],
       
  1011     AS_HELP_STRING([--enable-rt-syslog],
       
  1012                    [Enable RT syslog (default: yes)]),
       
  1013     [
       
  1014         case "${enableval}" in
       
  1015             yes) rtsyslog=1
       
  1016                 ;;
       
  1017             no) rtsyslog=0
       
  1018                 ;;
       
  1019             *) AC_MSG_ERROR([Invalid value for --enable-rt-syslog])
       
  1020                 ;;
       
  1021         esac
       
  1022     ],
       
  1023     [rtsyslog=1]
       
  1024 )
       
  1025 
       
  1026 if test "x${rtsyslog}" = "x1"; then
       
  1027     AC_DEFINE([EC_RT_SYSLOG], [1], [Output to syslog in RT context])
       
  1028     AC_MSG_RESULT([yes])
       
  1029 else
       
  1030     AC_MSG_RESULT([no])
   783 fi
  1031 fi
   784 
  1032 
   785 #------------------------------------------------------------------------------
  1033 #------------------------------------------------------------------------------
   786 
  1034 
   787 AC_CONFIG_FILES([
  1035 AC_CONFIG_FILES([
   788         Doxyfile
  1036         Doxyfile
   789         Kbuild
  1037         Kbuild
   790         Makefile
  1038         Makefile
   791         devices/Kbuild
  1039         devices/Kbuild
   792         devices/Makefile
  1040         devices/Makefile
       
  1041         devices/ccat/Kbuild
       
  1042         devices/ccat/Makefile
   793         devices/e1000/Kbuild
  1043         devices/e1000/Kbuild
   794         devices/e1000/Makefile
  1044         devices/e1000/Makefile
   795         devices/e1000e/Kbuild
  1045         devices/e1000e/Kbuild
   796         devices/e1000e/Makefile
  1046         devices/e1000e/Makefile
   797         ethercat.spec
  1047         ethercat.spec
   803         examples/mini/Kbuild
  1053         examples/mini/Kbuild
   804         examples/mini/Makefile
  1054         examples/mini/Makefile
   805         examples/rtai/Kbuild
  1055         examples/rtai/Kbuild
   806         examples/rtai/Makefile
  1056         examples/rtai/Makefile
   807         examples/rtai_rtdm/Makefile
  1057         examples/rtai_rtdm/Makefile
       
  1058         examples/rtai_rtdm_dc/Makefile
   808         examples/tty/Kbuild
  1059         examples/tty/Kbuild
   809         examples/tty/Makefile
  1060         examples/tty/Makefile
   810         examples/user/Makefile
  1061         examples/user/Makefile
   811         examples/xenomai/Makefile
  1062         examples/xenomai/Makefile
   812         examples/xenomai_posix/Makefile
  1063         examples/xenomai_posix/Makefile
   813         include/Makefile
  1064         include/Makefile
   814         lib/Makefile
  1065         lib/Makefile
   815         m4/Makefile
  1066         m4/Makefile
   816         master/Kbuild
  1067         master/Kbuild
   817         master/Makefile
  1068         master/Makefile
   818         rtdm/Kbuild
       
   819         rtdm/Makefile
       
   820         script/Makefile
  1069         script/Makefile
   821         script/ethercat.service
  1070         script/ethercat.service
   822         script/ethercatctl
  1071         script/ethercatctl
   823         script/init.d/Makefile
  1072         script/init.d/Makefile
   824         script/init.d/ethercat
  1073         script/init.d/ethercat