/ configure.ac
configure.ac
   1  dnl Process this file with autoconf to produce a configure script.
   2  AC_PREREQ(2.69)
   3  
   4  AC_INIT([4.0.0], [4.0.0], [neotheuser@ymail.com])
   5  AC_CONFIG_AUX_DIR(base/config/autoconf)
   6  AC_CONFIG_MACRO_DIR([m4])
   7  AC_CANONICAL_SYSTEM
   8  AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2])
   9  AM_SILENT_RULES([yes])
  10  
  11  CONFIG_RTAI_VERSION_MAJOR=4
  12  CONFIG_RTAI_VERSION_MINOR=0
  13  CONFIG_RTAI_REVISION_LEVEL=0
  14  
  15  AC_CONFIG_HEADERS(rtai_config.h)
  16  AC_CONFIG_SRCDIR(base/sched/sched.c)
  17  AC_PREFIX_DEFAULT(/usr/realtime)
  18  AC_CANONICAL_BUILD
  19  AC_CANONICAL_HOST
  20  AC_PROG_INSTALL
  21  LT_INIT
  22  AM_PROG_AS
  23  
  24  AC_ARG_WITH(CC,
  25      [  --with-cc=compiler      use specific C compiler],
  26      [
  27  	case "$withval" in
  28  	"" | y | ye | yes | n | no)
  29  	    AC_MSG_ERROR([You must supply an argument to --with-cc.])
  30  	  ;;
  31  	esac
  32  	CC="$withval"
  33      ])
  34  AC_PROG_CC
  35  CFLAGS=""
  36  
  37  AC_ARG_WITH(CXX,
  38      [  --with-cxx=compiler      use specific C++ compiler],
  39      [ case "$withval" in
  40  	"" | y | ye | yes | n | no)
  41  	    AC_MSG_ERROR([You must supply an argument to --with-cxx.])
  42  	  ;;
  43  	esac
  44  	CXX="$withval" ])
  45  AC_PROG_CXX
  46  CXXFLAGS=""
  47  
  48  dnl If we're using GCC, make sure that it is at least version 3.3.0.  Older
  49  dnl versions are explictly not supported.
  50  AC_MSG_CHECKING([whether gcc version is sufficient])
  51  major=0
  52  minor=0
  53  GCC_VERSION=`$CC -dumpversion`
  54  if test $? -eq 0; then
  55  	GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
  56  	GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
  57  fi
  58  if test $GCC_VERSION_MAJOR -lt 3 -o $GCC_VERSION_MAJOR -eq 3 -a $GCC_VERSION_MINOR -lt 3 ; then
  59  	AC_MSG_RESULT([no])
  60  	AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
  61  else
  62  	AC_MSG_RESULT([yes])
  63  fi
  64  RTAI_FP_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"
  65  
  66  AC_DEFINE_UNQUOTED(CONFIG_RTAI_BUILD_STRING,"$build",[Build system alias])
  67  RTAI_BUILD_STRING="$build"
  68  AC_DEFINE_UNQUOTED(CONFIG_RTAI_HOST_STRING,"$host",[Host system alias])
  69  RTAI_HOST_STRING="$host"
  70  AC_DEFINE_UNQUOTED(CONFIG_RTAI_COMPILER,"`$CC -v 2>&1 | tail -n 1`",[Compiler])
  71  
  72  dnl Find arch-specific requirements and supports. Features which
  73  dnl are not supported by all archs must be listed here, so that a
  74  dnl an Autoconf flag can later be defined/undefined in rtai_config.h.
  75  
  76  arch_supports_lxrt=y
  77  arch_has_mmu=y
  78  
  79  case "$host" in
  80   i*86*-*)
  81  	RTAI_TARGET_ARCH=x86
  82  	RTAI_TARGET_SUBARCH=32
  83  	wanted_kernel_arch=CONFIG_X86_32
  84  	;;
  85   x86_64*-*)
  86  	RTAI_TARGET_ARCH=x86
  87  	RTAI_TARGET_SUBARCH=64
  88  	wanted_kernel_arch=CONFIG_X86_64
  89  	;;
  90  esac
  91  
  92  dnl
  93  dnl Load the RTAI configuration.
  94  dnl
  95  
  96  RTAI_KCONFIG_FILE=$srcdir/base/arch/x86/defconfig
  97  kconfig_type=default
  98  
  99  AC_ARG_WITH(kconfig-file,
 100      [  --with-kconfig-file=<kconfig-file>      KConfig parameter file],
 101      [
 102  	case "$withval" in
 103  	"" | y | ye | yes | n | no)
 104  	    AC_MSG_ERROR([You must supply an argument to --with-kconfig-file.])
 105  	  ;;
 106  	esac
 107  	RTAI_KCONFIG_FILE="$withval"
 108  	kconfig_type=supplied
 109      ])
 110  
 111  AC_MSG_CHECKING([for RTAI Kconfig file])
 112  if test \! -f $RTAI_KCONFIG_FILE; then
 113      AC_MSG_ERROR([Kconfig-file $RTAI_KCONFIG_FILE not found -- --with-kconfig-file sets Kconfig file])
 114  fi
 115  . $RTAI_KCONFIG_FILE
 116  AC_MSG_RESULT([$RTAI_KCONFIG_FILE ($kconfig_type)])
 117  
 118  dnl
 119  dnl Installation directory for modules
 120  dnl
 121  
 122  AC_MSG_CHECKING([for module installation directory])
 123  
 124  AC_ARG_WITH(module-dir,
 125      [  --with-module-dir=<module-dir>      Installation directory for modules],
 126      [
 127  	case "$withval" in
 128  	"" | y | ye | yes | n | no)
 129  	    AC_MSG_ERROR([You must supply an argument to --with-module-dir.])
 130  	  ;;
 131  	esac
 132  	RTAI_MODULE_DIR="$withval"
 133      ])
 134  
 135  CONFIG_RTAI_OLD_FASHIONED_BUILD=y
 136  
 137  dnl Set a default module dir if unspecified
 138  if test "x" = "x$RTAI_MODULE_DIR"
 139  then
 140     RTAI_MODULE_DIR='${exec_prefix}/modules'
 141  fi
 142  
 143  AC_MSG_RESULT([$RTAI_MODULE_DIR])
 144  CONFIG_RTAI_MODULE_DIR=$RTAI_MODULE_DIR
 145  
 146  dnl
 147  dnl Process the Linux kernel configuration
 148  dnl
 149  
 150  AC_MSG_CHECKING([for Linux source tree])
 151  
 152  dnl CONFIG_MODULES has been forcibly set in RTAI's configuration
 153  dnl file, therefore we must unset it before later checking if the kernel
 154  dnl actually defined it as required too.
 155  unset CONFIG_MODULES
 156  
 157  dnl safe default
 158  if test x$CONFIG_RTAI_LINUXDIR != x ; then
 159  	RTAI_LINUX_DIR=$CONFIG_RTAI_LINUXDIR
 160  else
 161  	RTAI_LINUX_DIR="/usr/src/linux"
 162  fi
 163  
 164  AC_ARG_WITH(linux-dir,
 165      [  --with-linux-dir=<linux-dir>      RTAI-enabled Linux kernel tree],
 166      [
 167  	case "$withval" in
 168  	"" | y | ye | yes | n | no)
 169  	    AC_MSG_ERROR([You must supply an argument to --with-linux-dir.])
 170  	  ;;
 171  	esac
 172  	RTAI_LINUX_DIR="$withval"
 173      ])
 174  
 175  if test x${RTAI_LINUX_DIR} = x; then
 176     echo
 177     AC_MSG_ERROR([Linux kernel tree not specified -- use --with-linux-dir])
 178  fi
 179  
 180  if test \! -r ${RTAI_LINUX_DIR}/Makefile; then
 181     echo
 182     AC_MSG_ERROR([No Linux kernel tree in ${RTAI_LINUX_DIR}])
 183  fi
 184  
 185  if grep KERNELSRC $RTAI_LINUX_DIR/Makefile > /dev/null; then
 186  eval LINUX_`grep '^KERNELSRC' $RTAI_LINUX_DIR/Makefile | sed -e 's, ,,g'|sed -e 's,:,,g'`
 187  eval LINUX_`grep '^KERNELOUTPUT' $RTAI_LINUX_DIR/Makefile | sed -e 's, ,,g'|sed -e 's,:,,g'`
 188  elif grep '^MAKEARGS *:= *-C' $RTAI_LINUX_DIR/Makefile > /dev/null; then
 189  LINUX_KERNELSRC=`sed -n -e 's,^MAKEARGS *:= *-C *\(@<:@^@<:@:space:@:>@@:>@*\).*,\1,p' $RTAI_LINUX_DIR/Makefile`
 190  LINUX_KERNELOUTPUT=$RTAI_LINUX_DIR
 191  else
 192  LINUX_KERNELOUTPUT=$RTAI_LINUX_DIR
 193  LINUX_KERNELSRC=$RTAI_LINUX_DIR
 194  fi
 195  
 196  eval linux_`grep '^EXTRAVERSION =' $LINUX_KERNELSRC/Makefile | sed -e 's, ,,g'`
 197  eval linux_`grep '^PATCHLEVEL =' $LINUX_KERNELSRC/Makefile | sed -e 's, ,,g'`
 198  eval linux_`grep '^SUBLEVEL =' $LINUX_KERNELSRC/Makefile | sed -e 's, ,,g'`
 199  eval linux_`grep '^VERSION =' $LINUX_KERNELSRC/Makefile | sed -e 's, ,,g'`
 200  
 201  dnl Load Linux kernel configuration now, before config symbols are tested.
 202  if test \! -r ${LINUX_KERNELOUTPUT}/.config; then
 203     AC_MSG_RESULT([invalid])
 204     AC_MSG_ERROR([$LINUX_KERNELOUTPUT is not configured -- --with-linux-dir sets linux-dir])
 205  fi
 206  
 207  . $LINUX_KERNELOUTPUT/.config
 208  
 209  RTAI_LINUX_VERSION="$linux_VERSION.$linux_PATCHLEVEL.$linux_SUBLEVEL"
 210  AC_MSG_RESULT([$RTAI_LINUX_DIR (kernel ${RTAI_LINUX_VERSION}${CONFIG_SMP:+-SMP})])
 211  if test x${CONFIG_RTAI_LINUXDIR} = x; then
 212     CONFIG_RTAI_LINUXDIR=$RTAI_LINUX_DIR
 213  fi
 214  
 215  dnl
 216  dnl Identify the base technology used.
 217  dnl
 218  
 219  unset CONFIG_RTAI_ADEOS
 220  unset CONFIG_RTAI_IPIPE
 221  
 222  AC_MSG_CHECKING([for RTAI base technology])
 223  
 224  dnl we simply check for ipipe.h
 225  if test -r $LINUX_KERNELSRC/include/linux/ipipe.h; then
 226     AC_DEFINE(CONFIG_RTAI_IPIPE,1,[Use RTAI Adeos-newgen HAL])
 227     AC_MSG_RESULT([RTAI Adeos-newgen HAL])
 228     CONFIG_RTAI_IPIPE=y
 229  else
 230      echo
 231      AC_MSG_ERROR([HAL patch not applied/enabled in $LINUX_KERNELSRC])
 232  fi
 233  
 234  CONFIG_KBUILD=y
 235  
 236  dnl
 237  dnl Perform a few sanity checks.
 238  dnl
 239  
 240  AC_MSG_CHECKING([for kernel architecture])
 241  KERNEL_ARCH="`uname -m`"
 242  AC_MSG_RESULT([$KERNEL_ARCH])
 243  
 244  if test x${CONFIG_MODULES} = x ; then
 245    AC_MSG_ERROR([Please set CONFIG_MODULES for $RTAI_LINUX_DIR and rebuild your kernel])
 246  fi
 247  
 248  if test x${CONFIG_MODVERSIONS} = xy ; then
 249  	case "${RTAI_LINUX_VERSION}" in
 250  	2.4.*)
 251    AC_MSG_ERROR([Please unset CONFIG_MODVERSIONS for $RTAI_LINUX_DIR and rebuild your kernel])
 252  		;;
 253  	*)
 254  		dnl reported to be harmless in 2.6
 255  		;;
 256  	esac
 257  fi
 258  
 259  if test x${CONFIG_RTAI_ADEOS} = xy -a x${CONFIG_ADEOS_CORE} = x; then
 260     AC_MSG_ERROR([Please activate the Adeos support in $RTAI_LINUX_DIR and rebuild your kernel])
 261  fi
 262  
 263  dnl
 264  dnl Process the build options, possibly overriding the loaded
 265  dnl configuration.
 266  dnl
 267  
 268  RTAI_BUILTIN_MODLIST=""
 269  
 270  AC_MSG_CHECKING(for trace support)
 271  AC_ARG_ENABLE(trace,
 272  	[ --enable-trace		Enable trace support],
 273  	[case "$enableval" in
 274  	y | yes) CONFIG_RTAI_TRACE=y ;;
 275  	*) unset CONFIG_RTAI_TRACE ;;
 276  	esac])
 277  AC_MSG_RESULT(${CONFIG_RTAI_TRACE:-no})
 278  
 279  if test x${CONFIG_RTAI_MATH} = xy; then
 280     CONFIG_RTAI_MATH=m
 281  fi
 282  
 283  AC_MSG_CHECKING(for math support)
 284  AC_ARG_ENABLE(math,
 285  	[ --enable-math		Enable math support],
 286  	[case "$enableval" in
 287  	y | yes | b | builtin | built-in) CONFIG_RTAI_MATH=y ;;
 288  	m | mod | module) CONFIG_RTAI_MATH=m ;;
 289  	*) unset CONFIG_RTAI_MATH ;;
 290  	esac])
 291  AC_MSG_RESULT(${CONFIG_RTAI_MATH:-no})
 292  
 293  if test x$CONFIG_RTAI_MATH = xy ; then
 294    RTAI_BUILTIN_MODLIST="$RTAI_BUILTIN_MODLIST math"
 295  fi
 296  
 297  AC_MSG_CHECKING(for bits IPC support)
 298  AC_ARG_ENABLE(bits,
 299  	[ --enable-bits		Enable bits IPC support],
 300  	[case "$enableval" in
 301  	y | yes | b | builtin | built-in) CONFIG_RTAI_BITS=y ;;
 302  	m | mod | module) CONFIG_RTAI_BITS=m ;;
 303  	*) unset CONFIG_RTAI_BITS ;;
 304  	esac])
 305  AC_MSG_RESULT(${CONFIG_RTAI_BITS:-no})
 306  
 307  if test x$CONFIG_RTAI_BITS = xy ; then
 308    RTAI_BUILTIN_MODLIST="$RTAI_BUILTIN_MODLIST ipc/bits"
 309  fi
 310  
 311  AC_MSG_CHECKING(for real-time fifos support)
 312  AC_ARG_ENABLE(fifos,
 313  	[ --enable-fifos		Enable fifo IPC support],
 314  	[case "$enableval" in
 315  	y | yes | b | builtin | built-in) CONFIG_RTAI_FIFOS=y ;;
 316  	m | mod | module) CONFIG_RTAI_FIFOS=m ;;
 317  	*) unset CONFIG_RTAI_FIFOS ;;
 318  	esac])
 319  AC_MSG_RESULT(${CONFIG_RTAI_FIFOS:-no})
 320  
 321  if test x$CONFIG_RTAI_FIFOS = xy ; then
 322    RTAI_BUILTIN_MODLIST="$RTAI_BUILTIN_MODLIST ipc/fifos"
 323  fi
 324  
 325  AC_MSG_CHECKING(for netrpc support)
 326  AC_ARG_ENABLE(netrpc,
 327  	[ --enable-netrpc	Enable netrpc support],
 328  	[case "$enableval" in
 329  	y | yes | b | builtin | built-in) CONFIG_RTAI_NETRPC=y ;;
 330  	m | mod | module) CONFIG_RTAI_NETRPC=m ;;
 331  	*) unset CONFIG_RTAI_NETRPC ;;
 332  	esac])
 333  AC_MSG_RESULT(${CONFIG_RTAI_NETRPC:-no})
 334  
 335  if test x$CONFIG_RTAI_NETRPC = xy ; then
 336    RTAI_BUILTIN_MODLIST="$RTAI_BUILTIN_MODLIST ipc/netrpc"
 337  fi
 338  
 339  AC_MSG_CHECKING(for netrpc emulation of RTNet)
 340  AC_ARG_ENABLE(netrpc-rtnet,
 341  	[ --enable-netrpc-rtnet	Enable netrpc emulation of RTNet],
 342  	[case "$enableval" in
 343  	y | yes) CONFIG_RTAI_NETRPC_RTNET=y ;;
 344  	*) unset CONFIG_RTAI_NETRPC_RTNET ;;
 345  	esac])
 346  AC_MSG_RESULT(${CONFIG_RTAI_NETRPC_RTNET:-no})
 347  
 348  AC_MSG_CHECKING(for semaphore support)
 349  AC_ARG_ENABLE(sem,
 350  	[ --enable-sem		Enable semaphore support],
 351  	[case "$enableval" in
 352  	y | yes | b | builtin | built-in) CONFIG_RTAI_SEM=y ;;
 353  	m | mod | module) CONFIG_RTAI_SEM=m ;;
 354  	*) unset CONFIG_RTAI_SEM ;;
 355  	esac])
 356  AC_MSG_RESULT(${CONFIG_RTAI_SEM:-no})
 357  
 358  if test x$CONFIG_RTAI_SEM = xy ; then
 359    RTAI_BUILTIN_MODLIST="$RTAI_BUILTIN_MODLIST ipc/sem"
 360  fi
 361  
 362  AC_MSG_CHECKING(for RT POLL support)
 363  AC_ARG_ENABLE(rt-poll,
 364  	[ --enable-rt-poll		enable polling support of RTAI IPCs],
 365  	[case "$enableval" in
 366  	y | yes) CONFIG_RTAI_RT_POLL=y ;;
 367  	*) unset CONFIG_RTAI_RT_POLL ;;
 368  	esac])
 369  AC_MSG_RESULT(${CONFIG_RTAI_RT_POLL:-no})
 370  
 371  AC_MSG_CHECKING(for RT POLL on stack)
 372  AC_ARG_ENABLE(rt-poll-on-stack,
 373  	[ --enable-rt-poll-on-stack	Use the stack for rt_poll dynamic arrays],
 374  	[case "$enableval" in
 375  	y | yes) CONFIG_RTAI_RT_POLL_ON_STACK=y ;;
 376  	*) unset CONFIG_RTAI_RT_POLL_ON_STACK ;;
 377  	esac])
 378  AC_MSG_RESULT(${CONFIG_RTAI_RT_POLL_ON_STACK:-no})
 379  
 380  AC_MSG_CHECKING(for messaging support)
 381  AC_ARG_ENABLE(msg,
 382  	[ --enable-msg		Enable messaging support],
 383  	[case "$enableval" in
 384  	y | yes | b | builtin | built-in) CONFIG_RTAI_MSG=y ;;
 385  	m | mod | module) CONFIG_RTAI_MSG=m ;;
 386  	*) unset CONFIG_RTAI_MSG ;;
 387  	esac])
 388  AC_MSG_RESULT(${CONFIG_RTAI_MSG:-no})
 389  
 390  if test x$CONFIG_RTAI_MSG = xy ; then
 391    RTAI_BUILTIN_MODLIST="$RTAI_BUILTIN_MODLIST ipc/msg"
 392  fi
 393  
 394  AC_MSG_CHECKING(for mailbox support)
 395  AC_ARG_ENABLE(mbx,
 396  	[ --enable-mbx		Enable mailbox support],
 397  	[case "$enableval" in
 398  	y | yes | b | builtin | built-in) CONFIG_RTAI_MBX=y ;;
 399  	m | mod | module) CONFIG_RTAI_MBX=m ;;
 400  	*) unset CONFIG_RTAI_MBX ;;
 401  	esac])
 402  AC_MSG_RESULT(${CONFIG_RTAI_MBX:-no})
 403  
 404  if test x$CONFIG_RTAI_MBX = xy ; then
 405    RTAI_BUILTIN_MODLIST="$RTAI_BUILTIN_MODLIST ipc/mbx"
 406  fi
 407  
 408  AC_MSG_CHECKING(for typed mailbox support)
 409  AC_ARG_ENABLE(tbx,
 410  	[ --enable-tbx		Enable typed mailbox support],
 411  	[case "$enableval" in
 412  	y | yes | b | builtin | built-in) CONFIG_RTAI_TBX=y ;;
 413  	m | mod | module) CONFIG_RTAI_TBX=m ;;
 414  	*) unset CONFIG_RTAI_TBX ;;
 415  	esac])
 416  AC_MSG_RESULT(${CONFIG_RTAI_TBX:-no})
 417  
 418  if test x$CONFIG_RTAI_TBX = xy ; then
 419    RTAI_BUILTIN_MODLIST="$RTAI_BUILTIN_MODLIST ipc/tbx"
 420  fi
 421  
 422  AC_MSG_CHECKING(for POSIX-like message queue support)
 423  AC_ARG_ENABLE(mq,
 424  	[ --enable-mq		Enable POSIX-like message queue support],
 425  	[case "$enableval" in
 426  	y | yes | b | builtin | built-in) CONFIG_RTAI_MQ=y ;;
 427  	m | mod | module) CONFIG_RTAI_MQ=m ;;
 428  	*) unset CONFIG_RTAI_MQ ;;
 429  	esac])
 430  AC_MSG_RESULT(${CONFIG_RTAI_MQ:-no})
 431  
 432  if test x$CONFIG_RTAI_MQ = xy ; then
 433    RTAI_BUILTIN_MODLIST="$RTAI_BUILTIN_MODLIST ipc/mq"
 434  fi
 435  
 436  AC_MSG_CHECKING(for shared memory support)
 437  AC_ARG_ENABLE(shm,
 438  	[ --enable-shm		Enable shared memory support],
 439  	[case "$enableval" in
 440  	y | yes | b | builtin | built-in) CONFIG_RTAI_SHM=y ;;
 441  	m | mod | module) CONFIG_RTAI_SHM=m ;;
 442  	*) unset CONFIG_RTAI_SHM ;;
 443  	esac])
 444  AC_MSG_RESULT(${CONFIG_RTAI_SHM:-no})
 445  
 446  if test x$CONFIG_RTAI_SHM = xy ; then
 447    RTAI_BUILTIN_MODLIST="$RTAI_BUILTIN_MODLIST ipc/shm"
 448  fi
 449  
 450  AC_MSG_CHECKING(for real-time malloc support)
 451  AC_ARG_ENABLE(malloc,
 452  	[ --enable-malloc		Enable real-time malloc support],
 453  	[case "$enableval" in
 454  	y | yes | b | builtin | built-in) CONFIG_RTAI_MALLOC=y ;;
 455  	m | mod | module) CONFIG_RTAI_MALLOC=m ;;
 456  	*) unset CONFIG_RTAI_MALLOC ;;
 457  	esac])
 458  AC_MSG_RESULT(${CONFIG_RTAI_MALLOC:-no})
 459  
 460  if test x$CONFIG_RTAI_MALLOC = xy ; then
 461    RTAI_BUILTIN_MODLIST="$RTAI_BUILTIN_MODLIST malloc"
 462  fi
 463  
 464  AC_MSG_CHECKING(for tasklets support)
 465  AC_ARG_ENABLE(tasklets,
 466  	[ --enable-tasklets	Enable tasklets support],
 467  	[case "$enableval" in
 468  	y | yes | b | builtin | built-in) CONFIG_RTAI_TASKLETS=y ;;
 469  	m | mod | module) CONFIG_RTAI_TASKLETS=m ;;
 470  	*) unset CONFIG_RTAI_TASKLETS ;;
 471  	esac])
 472  AC_MSG_RESULT(${CONFIG_RTAI_TASKLETS:-no})
 473  
 474  if test x$CONFIG_RTAI_TASKLETS = xy ; then
 475    RTAI_BUILTIN_MODLIST="$RTAI_BUILTIN_MODLIST tasklets"
 476  fi
 477  
 478  AC_MSG_CHECKING(whether LXRT wraps service calls through Linux syscalls)
 479  AC_ARG_ENABLE(lxrt-use-linux-syscall,
 480  	[ --enable-lxrt-use-linux-syscall	Wrap LXRT service calls throug Linux syscall mechanism],
 481  	[case "$enableval" in
 482  	y | yes) CONFIG_RTAI_LXRT_USE_LINUX_SYSCALL=y ;;
 483  	*) unset CONFIG_RTAI_LXRT_USE_LINUX_SYSCALL ;;
 484  	esac])
 485  AC_MSG_RESULT(${CONFIG_RTAI_LXRT_USE_LINUX_SYSCALL:-no})
 486  
 487  dnl CONFIG_RTAI_KTASKS_SCHED_LXRT has to be forced
 488  AC_ARG_ENABLE(ktasks-sched-lxrt,
 489  	[ --enable-ktasks-sched-lxrt	Enable LXRT scheduler with kernel tasks support],
 490  	[case "$enableval" in
 491  	y | yes | m | mod | module) CONFIG_RTAI_KTASKS_SCHED_LXRT_=y ;;
 492  	*) echo "--enable-ktasks-sched-lxrt forced to \"yes\"" ; CONFIG_RTAI_KTASKS_SCHED_LXRT_=y ;;
 493  	esac])
 494  
 495  AC_MSG_CHECKING(for scheduler lock in ISRs)
 496  AC_ARG_ENABLE(sched-lock-isr,
 497  	[ --enable-sched-lock-isr	Enable scheduler lock in ISRs],
 498  	[case "$enableval" in
 499  	y | yes) CONFIG_RTAI_SCHED_ISR_LOCK=y ;;
 500  	*) unset CONFIG_RTAI_SCHED_ISR_LOCK ;;
 501  	esac])
 502  AC_MSG_RESULT(${CONFIG_RTAI_SCHED_ISR_LOCK:-no})
 503  
 504  AC_MSG_CHECKING(for RTC freq)
 505  AC_ARG_ENABLE(rtc-freq,
 506  	[ --enable-rtc-freq	Enable RTC freq],
 507  	[case "$enableval" in
 508   changequote(,)dnl add a test for 0 or power of 2, <2-8192>
 509  	[0-9]*) CONFIG_RTAI_RTC_FREQ=$enableval ;;
 510   changequote([,])dnl
 511  	*) AC_MSG_ERROR([Bad argument to option: --enable-rtc-freq=<power of 2>]) ;;
 512  	esac])
 513  if test x$CONFIG_RTAI_RTC_FREQ = x ; then
 514    # Use a reasonable default if unset
 515    CONFIG_RTAI_RTC_FREQ=0
 516  fi
 517  AC_MSG_RESULT($CONFIG_RTAI_RTC_FREQ)
 518  
 519  AC_MSG_CHECKING(for long timed lists)
 520  AC_ARG_ENABLE(long-timed-lists,
 521  	[ --enable-long-timed-lists	Enable long timed lists],
 522  	[case "$enableval" in
 523  	y | yes) CONFIG_RTAI_LONG_TIMED_LIST=y ;;
 524  	*) unset CONFIG_RTAI_LONG_TIMED_LIST;;
 525  	esac])
 526  AC_MSG_RESULT(${CONFIG_RTAI_LONG_TIMED_LIST:-no})
 527  
 528  AC_MSG_CHECKING(for 8254 tuning latency)
 529  AC_ARG_ENABLE(sched-8254-latency,
 530  	[ --enable-sched-8254-latency	Set 8254 tuning latency],
 531  	[case "$enableval" in
 532   changequote(,)dnl
 533  	[0-9]*) CONFIG_RTAI_SCHED_8254_LATENCY=$enableval ;;
 534   changequote([,])dnl
 535  	*) AC_MSG_ERROR([Bad argument to option: --enable-8254-latency=<nanoseconds>]) ;;
 536  	esac])
 537  if test x$CONFIG_RTAI_SCHED_8254_LATENCY = x ; then
 538    # Use a reasonable default if unset
 539    CONFIG_RTAI_SCHED_8254_LATENCY=4700
 540  fi
 541  AC_MSG_RESULT($CONFIG_RTAI_SCHED_8254_LATENCY)
 542  
 543  AC_MSG_CHECKING(for APIC tuning latency)
 544  AC_ARG_ENABLE(sched-apic-latency,
 545  	[ --enable-sched-apic-latency	Set APIC tuning latency],
 546  	[case "$enableval" in
 547   changequote(,)dnl
 548  	[0-9]*) CONFIG_RTAI_SCHED_APIC_LATENCY=$enableval ;;
 549   changequote([,])dnl
 550  	*) AC_MSG_ERROR([Bad argument to option: --enable-sched-apic-latency=<nanoseconds>]) ;;
 551  	esac])
 552  if test x$CONFIG_RTAI_SCHED_APIC_LATENCY = x ; then
 553    # Use a reasonable default if unset
 554    CONFIG_RTAI_SCHED_APIC_LATENCY=3944
 555  fi
 556  AC_MSG_RESULT($CONFIG_RTAI_SCHED_APIC_LATENCY)
 557  
 558  AC_MSG_CHECKING(for user busy align ret delay)
 559  AC_ARG_ENABLE(user-busy-align-ret-delay,
 560  	[ --user-busy-align-ret-delay	Set user busy align ret delay],
 561  	[case "$enableval" in
 562   changequote(,)dnl
 563  	[0-9]*) CONFIG_RTAI_USER_BUSY_ALIGN_RET_DELAY=$enableval ;;
 564   changequote([,])dnl
 565  	*) AC_MSG_ERROR([Bad argument to option: --user-busy-align-ret-delay=<nanoseconds>]) ;;
 566  	esac])
 567  if test x$CONFIG_RTAI_USER_BUSY_ALIGN_RET_DELAY = x ; then
 568    # Use a reasonable default if unset
 569    CONFIG_RTAI_USER_BUSY_ALIGN_RET_DELAY=0
 570  fi
 571  AC_MSG_RESULT($CONFIG_RTAI_USER_BUSY_ALIGN_RET_DELAY)
 572  
 573  AC_MSG_CHECKING(for kernel busy align ret delay)
 574  AC_ARG_ENABLE(kernel-busy-align-ret-delay,
 575  	[ --kernel-busy-align-ret-delay	Set kernel busy align ret delay],
 576  	[case "$enableval" in
 577   changequote(,)dnl
 578  	[0-9]*) CONFIG_RTAI_KERN_BUSY_ALIGN_RET_DELAY=$enableval ;;
 579   changequote([,])dnl
 580  	*) AC_MSG_ERROR([Bad argument to option: --kernel-busy-align-ret-delay=<nanoseconds>]) ;;
 581  	esac])
 582  if test x$CONFIG_RTAI_KERN_BUSY_ALIGN_RET_DELAY = x ; then
 583    # Use a reasonable default if unset
 584    CONFIG_RTAI_KERN_BUSY_ALIGN_RET_DELAY=0
 585  fi
 586  AC_MSG_RESULT($CONFIG_RTAI_KERN_BUSY_ALIGN_RET_DELAY)
 587  
 588  AC_MSG_CHECKING(for maximum number of LXRT slots)
 589  AC_ARG_ENABLE(sched-lxrt-numslots,
 590  	[ --enable-sched-lxrt-numslots	Set maximum number of LXRT slots],
 591  	[case "$enableval" in
 592   changequote(,)dnl
 593  	[0-9]*) CONFIG_RTAI_SCHED_LXRT_NUMSLOTS=$enableval ;;
 594   changequote([,])dnl
 595  	*) AC_MSG_ERROR([Bad argument to option: --enable-sched-lxrt-numslots=<number>]) ;;
 596  	esac])
 597  if test x$CONFIG_RTAI_SCHED_LXRT_NUMSLOTS = x ; then
 598    # Use a reasonable default if unset
 599    CONFIG_RTAI_SCHED_LXRT_NUMSLOTS=512
 600  fi
 601  AC_MSG_RESULT($CONFIG_RTAI_SCHED_LXRT_NUMSLOTS)
 602  
 603  AC_MSG_CHECKING(for RTDM support)
 604  AC_ARG_ENABLE(rtdm,
 605  	[ --enable-rtdm		Enable RTDM support],
 606  	[case "$enableval" in
 607  	y | yes | b | builtin | built-in) CONFIG_RTAI_RTDM=y ;;
 608  	m | mod | module) CONFIG_RTAI_RTDM=m ;;
 609  	*) unset CONFIG_RTAI_RTDM ;;
 610  	esac])
 611  AC_MSG_RESULT(${CONFIG_RTAI_RTDM:-no})
 612  
 613  AC_MSG_CHECKING(for maximum file descriptors in RTDM)
 614  AC_ARG_ENABLE(rtdm-fd-max,
 615  	      [ --enable-rtdm-fd-max		Set maximum number of RTDM file descriptor slots],
 616  	[case "$enableval" in
 617   changequote(,)dnl
 618  	[1-9][0-9]*) CONFIG_RTAI_RTDM_FD_MAX=$enableval ;;
 619   changequote([,])dnl
 620  	*) AC_MSG_ERROR([Bad argument to option: --enable-rtdm-fd-max=<number>]) ;;
 621  	esac])
 622  if test x$CONFIG_RTAI_RTDM_FD_MAX = x ; then
 623    # Use a reasonable default if unset
 624    CONFIG_RTAI_RTDM_FD_MAX=128
 625  else
 626  	case $CONFIG_RTAI_RTDM_FD_MAX in
 627  	changequote(,)dnl
 628  	[1-9][0-9]*) ;;
 629  	changequote([,])dnl
 630  	*) AC_MSG_ERROR([Bad value $CONFIG_RTAI_RTDM_FD_MAX for RTAI_RTDM_FD_MAX]) ;;
 631  	esac
 632  fi
 633  AC_MSG_RESULT($CONFIG_RTAI_RTDM_FD_MAX)
 634  
 635  AC_MSG_CHECKING(for shared interrupts in RTDM)
 636  AC_ARG_ENABLE(rtdm-shirq,
 637  	      [ --enable-rtdm-shirq	Enable shared interrupts in RTDM],
 638  	[case "$enableval" in
 639  	y | yes) CONFIG_RTAI_RTDM_SHIRQ=y ;;
 640  	*) unset CONFIG_RTAI_RTDM_SHIRQ ;;
 641  	esac])
 642  AC_MSG_RESULT(${CONFIG_RTAI_RTDM_SHIRQ:-no})
 643  
 644  AC_MSG_CHECKING(for select(2) support in RTDM)
 645  AC_ARG_ENABLE(rtdm-select,
 646  	      [ --enable-rtdm-select	Enable select support in RTDM],
 647  	[case "$enableval" in
 648  	y | yes) CONFIG_RTAI_RTDM_SELECT=y ;;
 649  	*) unset CONFIG_RTAI_RTDM_SELECT ;;
 650  	esac])
 651  AC_MSG_RESULT(${CONFIG_RTAI_RTDM_SELECT:-no})
 652  
 653  AC_MSG_CHECKING(for RTDM debug)
 654  AC_ARG_ENABLE(debug-rtdm,
 655  	      [ --enable-debug-rtdm		Enable RTDM debug],
 656  	[case "$enableval" in
 657  	y | yes) CONFIG_RTAI_DEBUG_RTDM=y ;;
 658  	*) unset CONFIG_RTAI_DEBUG_RTDM ;;
 659  	esac])
 660  AC_MSG_RESULT(${CONFIG_RTAI_DEBUG_RTDM:-no})
 661  
 662  AC_MSG_CHECKING(for task switch signal)
 663  AC_ARG_ENABLE(task-switch-signal,
 664  	      [ --enable-task-switch-signal		Enable RTAI task switch signal],
 665  	[case "$enableval" in
 666  	y | yes) CONFIG_RTAI_TASK_SWITCH_SIGNAL=y ;;
 667  	*) unset CONFIG_RTAI_TASK_SWITCH_SIGNAL ;;
 668  	esac])
 669  AC_MSG_RESULT(${CONFIG_RTAI_TASK_SWITCH_SIGNAL:-no})
 670  
 671  AC_MSG_CHECKING(for hard-soft toggler)
 672  AC_ARG_ENABLE(hard-soft-toggler,
 673  	      [ --enable-hard-soft-toggler		Enable RTAI hard-soft toggler],
 674  	[case "$enableval" in
 675  	y | yes) CONFIG_RTAI_HARD_SOFT_TOGGLER=y ;;
 676  	*) unset CONFIG_RTAI_HARD_SOFT_TOGGLER ;;
 677  	esac])
 678  AC_MSG_RESULT(${CONFIG_RTAI_HARD_SOFT_TOGGLER:-no})
 679  
 680  AC_MSG_CHECKING(for Linux task priority alignment to RTAI)
 681  AC_ARG_ENABLE(align-priority,
 682  	      [ --enable-align-priority		Keep Linux task priority aligned to RTAI],
 683  	[case "$enableval" in
 684  	y | yes) CONFIG_RTAI_ALIGN_LINUX_PRIORITY=y ;;
 685  	*) unset CONFIG_RTAI_ALIGN_LINUX_PRIORITY ;;
 686  	esac])
 687  AC_MSG_RESULT(${CONFIG_RTAI_ALIGN_LINUX_PRIORITY:-no})
 688  
 689  AC_MSG_CHECKING(for calibration frequency factor)
 690  AC_ARG_ENABLE(cal-freq-fact,
 691  	[ --enable-cal-freq-fact      	Set calibration frequency factor],
 692  	[case "$enableval" in
 693   changequote(,)dnl
 694  	[0-9]*) CONFIG_RTAI_CAL_FREQS_FACT=$enableval ;;
 695   changequote([,])dnl
 696  	*) AC_MSG_ERROR([Bad argument to option: --enable-cal-freq-fact=<number>]) ;;
 697  	esac])
 698  if test x$CONFIG_RTAI_CAL_FREQS_FACT = x ; then
 699    # Use a reasonable default if unset
 700    CONFIG_RTAI_CAL_FREQS_FACT=0
 701  fi
 702  AC_MSG_RESULT($CONFIG_RTAI_CAL_FREQS_FACT)
 703  
 704  AC_MSG_CHECKING([if gcc accepts -fno-use-cxa-atexit])
 705  save_CXXFLAGS="$CXXFLAGS"
 706  CXXFLAGS="-fno-use-cxa-atexit -Werror"
 707  AC_CACHE_VAL(ac_cv_accepts_cxa_atexit,
 708  AC_LANG_SAVE
 709  AC_LANG_CPLUSPLUS
 710  [AC_TRY_COMPILE([],
 711  [int i = 0; return i; ],
 712  [ac_cv_accepts_cxa_atexit=yes],
 713  [ac_cv_accepts_cxa_atexit=no])]
 714  AC_LANG_RESTORE)
 715  AC_MSG_RESULT($ac_cv_accepts_cxa_atexit)
 716  CXXFLAGS="$save_CXXFLAGS"
 717  
 718  CONFIG_RTAI_FPU_SUPPORT=y
 719  
 720  AC_MSG_CHECKING(for math C99 support)
 721  AC_ARG_ENABLE(math-c99,
 722  	[ --enable-math-c99	Enable math C99 support],
 723  	[case "$enableval" in
 724  	y | yes) CONFIG_RTAI_MATH_C99=y ;;
 725  	*) unset CONFIG_RTAI_MATH_C99 ;;
 726  	esac])
 727  AC_MSG_RESULT(${CONFIG_RTAI_MATH_C99:-no})
 728  
 729  AC_MSG_CHECKING(for tlsf use in real-time malloc support)
 730  AC_ARG_ENABLE(malloc-tlsf,
 731  	[ --enable-malloc-tlsf	Enable tlsf support in malloc],
 732  	[case "$enableval" in
 733  	y | yes) CONFIG_RTAI_USE_TLSF=y ;;
 734  	*) unset CONFIG_RTAI_USE_TLSF;;
 735  	esac])
 736  AC_MSG_RESULT(${CONFIG_RTAI_USE_TLSF:-no})
 737  
 738  AC_MSG_CHECKING(for vmalloc use in real-time malloc support)
 739  AC_ARG_ENABLE(malloc-vmalloc,
 740  	[ --enable-malloc-vmalloc	Enable vmalloc support in malloc],
 741  	[case "$enableval" in
 742  	y | yes) CONFIG_RTAI_MALLOC_VMALLOC=y ;;
 743  	*) unset CONFIG_RTAI_MALLOC_VMALLOC ;;
 744  	esac])
 745  AC_MSG_RESULT(${CONFIG_RTAI_MALLOC_VMALLOC:-no})
 746  
 747  AC_MSG_CHECKING(for size of real-time malloc heap)
 748  AC_ARG_ENABLE(malloc-heap-size,
 749  	[ --enable-malloc-heap-size	Set size of real-time malloc heap],
 750  	[case "$enableval" in
 751   changequote(,)dnl
 752  	[0-9]*) CONFIG_RTAI_MALLOC_HEAPSZ=$enableval ;;
 753   changequote([,])dnl
 754  	*) AC_MSG_ERROR([Bad argument to option: --enable-malloc-heap-size=<Kbytes>]) ;;
 755  	esac])
 756  if test x$CONFIG_RTAI_MALLOC_HEAPSZ = x ; then
 757    # Use a reasonable default if unset (in Kbytes)
 758    CONFIG_RTAI_MALLOC_HEAPSZ=128
 759  fi
 760  AC_MSG_RESULT($CONFIG_RTAI_MALLOC_HEAPSZ)
 761  
 762  AC_MSG_CHECKING(for size of real-time kernel task stack heap)
 763  AC_ARG_ENABLE(kstack-heap-size,
 764  	[ --enable-kstack-heap-size	Set size of real-time kernel task stack heap],
 765  	[case "$enableval" in
 766   changequote(,)dnl
 767  	[0-9]*) CONFIG_RTAI_KSTACK_HEAPSZ=$enableval ;;
 768   changequote([,])dnl
 769  	*) AC_MSG_ERROR([Bad argument to option: --enable-kstack-heap-size=<Kbytes>]) ;;
 770  	esac])
 771  if test x$CONFIG_RTAI_KSTACK_HEAPSZ = x ; then
 772    # Use a reasonable default if unset (in Kbytes)
 773    CONFIG_RTAI_KSTACK_HEAPSZ=512
 774  fi
 775  AC_MSG_RESULT($CONFIG_RTAI_KSTACK_HEAPSZ)
 776  
 777  AC_MSG_CHECKING(for number of CPUs)
 778  AC_ARG_ENABLE(cpus,
 779  	[ --enable-cpus		Enable CPUs],
 780  	[case "$enableval" in
 781   changequote(,)dnl
 782  	[1-8]) CONFIG_RTAI_CPUS=$enableval ;;
 783   changequote([,])dnl
 784  	*) AC_MSG_ERROR([Bad argument to option: --enable-cpus=<number-of-CPUs>]) ;;
 785  	esac])
 786  AC_MSG_RESULT(${CONFIG_RTAI_CPUS:-1})
 787  
 788  dnl
 789  dnl Check for TSC options
 790  dnl
 791  
 792  AC_MSG_CHECKING(for diagnose out of sync MP-TSCs)
 793  AC_ARG_ENABLE(diag-tsc-sync,
 794  	      [ --enable-diag-tsc-sync		Enable diagnose out of sync MP-TSCs],
 795  	[case "$enableval" in
 796  	y | yes) CONFIG_RTAI_DIAG_TSC_SYNC=y ;;
 797  	*) unset CONFIG_RTAI_DIAG_TSC_SYNC ;;
 798  	esac])
 799  AC_MSG_RESULT(${CONFIG_RTAI_DIAG_TSC_SYNC:-no})
 800  
 801  dnl FIXME: is 0-7 correct?
 802  dnl what about larger CPU numbers (if at all possible)?
 803  dnl should we test for valid CPU number?
 804  AC_MSG_CHECKING(for master CPU for aligning MP-TSCs)
 805  AC_ARG_ENABLE(master-tsc-cpu,
 806  	[ --enable-master-tsc-cpu	Enable master TSC CPU],
 807  	[case "$enableval" in
 808   changequote(,)dnl
 809  	[0-7])
 810   changequote([,])dnl
 811  		if test x$CONFIG_RTAI_CPUS = x ; then
 812  			AC_MSG_ERROR([Option --enable-cpus must be defined before --enable-master-tsc-cpu])
 813  		fi
 814  		if test $enableval -lt 0 -o $enableval -ge $CONFIG_RTAI_CPUS ; then
 815  			AC_MSG_ERROR([Invalid value to option: --enable-master-tsc-cpu=<master-CPU-number> (must be between 0 and CONFIG_RTAI_CPUS)])
 816  		fi
 817  		CONFIG_RTAI_MASTER_TSC_CPU=$enableval ;;
 818  	*) AC_MSG_ERROR([Bad argument to option: --enable-master-tsc-cpu=<master-CPU-number>]) ;;
 819  	esac])
 820  AC_MSG_RESULT(${CONFIG_RTAI_MASTER_TSC_CPU:0})
 821  
 822  AC_MSG_CHECKING(for tune out of sync MP-TSCs)
 823  AC_ARG_ENABLE(tune-tsc-sync,
 824  	      [ --enable-tune-tsc-sync		Enable tune out of sync MP-TSCs],
 825  	[case "$enableval" in
 826  	y | yes) CONFIG_RTAI_TUNE_TSC_SYNC=y ;;
 827  	*) unset CONFIG_RTAI_TUNE_TSC_SYNC ;;
 828  	esac])
 829  AC_MSG_RESULT(${CONFIG_RTAI_TUNE_TSC_SYNC:-no})
 830  
 831  dnl add arch specific tests
 832  if test x$CONFIG_X86_TSC = xy ; then
 833  	AC_DEFINE(CONFIG_RTAI_TSC,1,[Use TSC in user space])
 834  fi
 835  
 836  AC_MSG_CHECKING(for debug symbols in kernel modules)
 837  AC_ARG_ENABLE(module-debug,
 838  	[ --enable-module-debug	Enable debug information in kernel modules],
 839  	[case "$enableval" in
 840  	y | yes) CONFIG_RTAI_KMOD_DEBUG=y ;;
 841  	*) unset CONFIG_RTAI_KMOD_DEBUG ;;
 842  	esac])
 843  AC_MSG_RESULT(${CONFIG_RTAI_KMOD_DEBUG:-no})
 844  
 845  AC_MSG_CHECKING(for debug symbols in user-space programs)
 846  AC_ARG_ENABLE(user-debug,
 847  	[ --enable-user-debug	Enable debug information in user-space programs],
 848  	[case "$enableval" in
 849  	y | yes) CONFIG_RTAI_USER_DEBUG=y ;;
 850  	*) unset CONFIG_RTAI_USER_DEBUG ;;
 851  	esac])
 852  AC_MSG_RESULT(${CONFIG_RTAI_USER_DEBUG:-no})
 853  
 854  dnl Catch sub-package flags
 855  
 856  dnl We need to know this before building the APIC support
 857  dnl into the SMP scheduler for the x86 platform. Autoconf imposes
 858  dnl us to define all Automake conditionals...unconditionally. e.g.
 859  dnl regardless of the current architecture setup.
 860  AM_CONDITIONAL(CONFIG_X86_LOCAL_APIC,[test -n "$CONFIG_X86_LOCAL_APIC"])
 861  
 862  if test -n "$CONFIG_RTAI_TRACE" -a x$CONFIG_TRACE = x; then
 863     AC_MSG_ERROR([Missing LTT support in kernel to enable trace support.])
 864  fi
 865  
 866  dnl Check for invalid combinations
 867  
 868  if test x$CONFIG_RTAI_NETRPC = xy -o x$CONFIG_RTAI_NETRPC = xm ; then
 869     if test x$CONFIG_RTAI_MSG = x ; then
 870        AC_MSG_ERROR([--enable-netrpc requires --enable-msg])
 871     fi
 872  fi
 873  
 874  if test x$CONFIG_RTAI_NETRPC = xy ; then
 875     if test x$CONFIG_RTAI_MSG = xm ; then
 876        AC_MSG_ERROR([--enable-netrpc=y requires --enable-msg=y])
 877     fi
 878  fi
 879  
 880  if test x$CONFIG_RTAI_RT_POLL = xy ; then
 881     if test x$CONFIG_RTAI_SEM = x ; then
 882        AC_MSG_ERROR([--enable-rt-poll requires --enable-sem])
 883     fi
 884  fi
 885  
 886  if test x$CONFIG_RTAI_RT_POLL_ON_STACK = xy ; then
 887     if test x$CONFIG_RTAI_RT_POLL = x ; then
 888        AC_MSG_ERROR([--enable-rt-poll-on-stack requires --enable-rt-poll])
 889     fi
 890  fi
 891  
 892  if test x$CONFIG_RTAI_MBX = xy -o x$CONFIG_RTAI_MBX = xm ; then
 893     if test x$CONFIG_RTAI_SEM = x ; then
 894        AC_MSG_ERROR([--enable-mbx requires --enable-sem])
 895     fi
 896  fi
 897  
 898  if test x$CONFIG_RTAI_MBX = xy ; then
 899     if test x$CONFIG_RTAI_SEM = xm ; then
 900        AC_MSG_ERROR([--enable-mbx=y requires --enable-sem=y])
 901     fi
 902  fi
 903  
 904  if test x$CONFIG_RTAI_TBX = xy -o x$CONFIG_RTAI_TBX = xm ; then
 905     if test x$CONFIG_RTAI_SEM = x ; then
 906        AC_MSG_ERROR([--enable-tbx requires --enable-sem])
 907     fi
 908  fi
 909  
 910  if test x$CONFIG_RTAI_TBX = xy ; then
 911     if test x$CONFIG_RTAI_SEM = xm ; then
 912        AC_MSG_ERROR([--enable-tbx=y requires --enable-sem=y])
 913     fi
 914  fi
 915  
 916  if test x$CONFIG_RTAI_MQ = xy -o x$CONFIG_RTAI_MQ = xm ; then
 917     if test x$CONFIG_RTAI_SEM = x ; then
 918        AC_MSG_ERROR([--enable-mq requires --enable-sem])
 919     fi
 920  fi
 921  
 922  if test x$CONFIG_RTAI_MQ = xy ; then
 923     if test x$CONFIG_RTAI_SEM = xm ; then
 924        AC_MSG_ERROR([--enable-mq=y requires --enable-sem=y])
 925     fi
 926  fi
 927  
 928  if test x$CONFIG_RTAI_RTDM_SELECT = xy ; then
 929     if test x$CONFIG_RTAI_RTDM = x ; then
 930        AC_MSG_ERROR([--enable-rtdm-select=y requires --enable-rtdm=y])
 931     fi
 932  fi
 933  
 934  if test x$CONFIG_RTAI_RTDM_SHIRQ = xy ; then
 935     if test x$CONFIG_RTAI_RTDM = x ; then
 936        AC_MSG_ERROR([--enable-rtdm-shirq=y requires --enable-rtdm=y])
 937     fi
 938  fi
 939  
 940  dnl Built-in math support is not currently available with Kbuild-built
 941  dnl kernels due to bad dependencies on user-space headers we really
 942  dnl need to fix first. So we leave in place all the config machinery
 943  dnl for having built-in/modular math support, but will complain here
 944  dnl until those dependencies are properly cleared.
 945  if test x$CONFIG_KBUILD = xy -a x$CONFIG_RTAI_MATH = xy ; then
 946     AC_MSG_ERROR([Built-in math support is not currently available with Linux >= 2.6.x])
 947  fi
 948  
 949  dnl
 950  dnl Build a Kconfig file corresponding to the current configuration
 951  dnl if none exists.
 952  dnl
 953  
 954  if test \! -r .rtai_config; then
 955     set | grep -e '^CONFIG_RTAI' -e '^CONFIG_MODULES' | \
 956     sed -e 's,\(.*\)=\(.*\)$,\1=\2,' > .rtai_config
 957  fi
 958  
 959  dnl
 960  dnl Produce the info needed to build rtai_config.h
 961  dnl
 962  
 963  AC_DEFINE_UNQUOTED(CONFIG_RTAI_VERSION_MAJOR,$CONFIG_RTAI_VERSION_MAJOR,[Kconfig])
 964  AC_DEFINE_UNQUOTED(CONFIG_RTAI_VERSION_MINOR,$CONFIG_RTAI_VERSION_MINOR,[Kconfig])
 965  AC_DEFINE_UNQUOTED(CONFIG_RTAI_REVISION_LEVEL,$CONFIG_RTAI_REVISION_LEVEL,[Kconfig])
 966  
 967  AC_DEFINE(CONFIG_RTAI,1,[Legacy])
 968  AC_DEFINE(CONFIG_RTAI_MOUNT_ON_LOAD,1,[Legacy])
 969  test \! x$CONFIG_KBUILD = x && AC_DEFINE(CONFIG_KBUILD,1,[Kconfig])
 970  test \! x$CONFIG_RTAI_ADEOS = x && AC_DEFINE(CONFIG_RTAI_ADEOS,1,[Kconfig])
 971  test \! x$CONFIG_RTAI_HAL_PREEMPT = x && AC_DEFINE(CONFIG_RTAI_HAL_PREEMPT,1,[Kconfig])
 972  test \! x$CONFIG_RTAI_CPUS = x && AC_DEFINE_UNQUOTED(CONFIG_RTAI_CPUS,$CONFIG_RTAI_CPUS,[Kconfig])
 973  test x$CONFIG_RTAI_DIAG_TSC_SYNC = xy && AC_DEFINE(CONFIG_RTAI_DIAG_TSC_SYNC,1,[Kconfig])
 974  test \! x$CONFIG_RTAI_MASTER_TSC_CPU = x && AC_DEFINE_UNQUOTED(CONFIG_RTAI_MASTER_TSC_CPU,$CONFIG_RTAI_MASTER_TSC_CPU,[Kconfig])
 975  test x$CONFIG_RTAI_TUNE_TSC_SYNC = xy && AC_DEFINE(CONFIG_RTAI_TUNE_TSC_SYNC,1,[Kconfig])
 976  test \! x$CONFIG_RTAI_FPU_SUPPORT = x && AC_DEFINE(CONFIG_RTAI_FPU_SUPPORT,1,[Kconfig])
 977  test \! x$CONFIG_RTAI_MATH_C99 = x && AC_DEFINE(CONFIG_RTAI_MATH_C99,1,[Kconfig])
 978  test \! x$CONFIG_RTAI_TRACE = x && AC_DEFINE(CONFIG_RTAI_TRACE,1,[Kconfig])
 979  test \! x$CONFIG_RTAI_MATH = x && AC_DEFINE(CONFIG_RTAI_MATH,1,[Kconfig])
 980  test \! x$CONFIG_RTAI_BITS = x && AC_DEFINE(CONFIG_RTAI_BITS,1,[Kconfig])
 981  test \! x$CONFIG_RTAI_FIFOS = x && AC_DEFINE(CONFIG_RTAI_FIFOS,1,[Kconfig])
 982  test \! x$CONFIG_RTAI_NETRPC = x && AC_DEFINE(CONFIG_RTAI_NETRPC,1,[Kconfig])
 983  test x$CONFIG_RTAI_NETRPC_RTNET = xy && AC_DEFINE(CONFIG_RTAI_NETRPC_RTNET,1,[Kconfig])
 984  test \! x$CONFIG_RTAI_SEM = x && AC_DEFINE(CONFIG_RTAI_SEM,1,[Kconfig])
 985  test \! x$CONFIG_RTAI_RT_POLL = x && AC_DEFINE(CONFIG_RTAI_RT_POLL,1,[Kconfig])
 986  test \! x$CONFIG_RTAI_RT_POLL_ON_STACK = x && AC_DEFINE(CONFIG_RTAI_RT_POLL_ON_STACK,1,[Kconfig])
 987  test \! x$CONFIG_RTAI_MSG = x && AC_DEFINE(CONFIG_RTAI_MSG,1,[Kconfig])
 988  test \! x$CONFIG_RTAI_MBX = x && AC_DEFINE(CONFIG_RTAI_MBX,1,[Kconfig])
 989  test \! x$CONFIG_RTAI_TBX = x && AC_DEFINE(CONFIG_RTAI_TBX,1,[Kconfig])
 990  test \! x$CONFIG_RTAI_MQ = x && AC_DEFINE(CONFIG_RTAI_MQ,1,[Kconfig])
 991  test \! x$CONFIG_RTAI_SHM = x && AC_DEFINE(CONFIG_RTAI_SHM,1,[Kconfig])
 992  test \! x$CONFIG_RTAI_MALLOC = x && AC_DEFINE(CONFIG_RTAI_MALLOC,1,[Kconfig])
 993  test \! x$CONFIG_RTAI_USE_TLSF = x && AC_DEFINE(CONFIG_RTAI_USE_TLSF,1,[Kconfig])
 994  test \! x$CONFIG_RTAI_MALLOC_VMALLOC = x && AC_DEFINE(CONFIG_RTAI_MALLOC_VMALLOC,1,[Kconfig])
 995  test \! x$CONFIG_RTAI_TASKLETS = x && AC_DEFINE(CONFIG_RTAI_TASKLETS,1,[Kconfig])
 996  test \! x$CONFIG_RTAI_LXRT_USE_LINUX_SYSCALL = x && AC_DEFINE(CONFIG_RTAI_LXRT_USE_LINUX_SYSCALL,1,[Kconfig])
 997  test \! x$CONFIG_RTAI_RTDM = x && AC_DEFINE(CONFIG_RTAI_RTDM,1,[Kconfig])
 998  test \! x$CONFIG_RTAI_ALIGN_LINUX_PRIORITY = x && AC_DEFINE(CONFIG_RTAI_ALIGN_LINUX_PRIORITY,1,[Kconfig])
 999  test \! x$CONFIG_RTAI_TASK_SWITCH_SIGNAL = x && AC_DEFINE(CONFIG_RTAI_TASK_SWITCH_SIGNAL,1,[Kconfig])
1000  test \! x$CONFIG_RTAI_HARD_SOFT_TOGGLER = x && AC_DEFINE(CONFIG_RTAI_HARD_SOFT_TOGGLER,1,[Kconfig])
1001  
1002  test x$CONFIG_RTAI_MATH = xy && AC_DEFINE(CONFIG_RTAI_MATH_BUILTIN,1,[Kconfig])
1003  test x$CONFIG_RTAI_BITS = xy && AC_DEFINE(CONFIG_RTAI_BITS_BUILTIN,1,[Kconfig])
1004  test x$CONFIG_RTAI_FIFOS = xy && AC_DEFINE(CONFIG_RTAI_FIFOS_BUILTIN,1,[Kconfig])
1005  test x$CONFIG_RTAI_NETRPC = xy && AC_DEFINE(CONFIG_RTAI_NETRPC_BUILTIN,1,[Kconfig])
1006  test x$CONFIG_RTAI_SEM = xy && AC_DEFINE(CONFIG_RTAI_SEM_BUILTIN,1,[Kconfig])
1007  test x$CONFIG_RTAI_MSG = xy && AC_DEFINE(CONFIG_RTAI_MSG_BUILTIN,1,[Kconfig])
1008  test x$CONFIG_RTAI_MBX = xy && AC_DEFINE(CONFIG_RTAI_MBX_BUILTIN,1,[Kconfig])
1009  test x$CONFIG_RTAI_TBX = xy && AC_DEFINE(CONFIG_RTAI_TBX_BUILTIN,1,[Kconfig])
1010  test x$CONFIG_RTAI_MQ = xy && AC_DEFINE(CONFIG_RTAI_MQ_BUILTIN,1,[Kconfig])
1011  test x$CONFIG_RTAI_SHM = xy && AC_DEFINE(CONFIG_RTAI_SHM_BUILTIN,1,[Kconfig])
1012  test x$CONFIG_RTAI_MALLOC = xy && AC_DEFINE(CONFIG_RTAI_MALLOC_BUILTIN,1,[Kconfig])
1013  test x$CONFIG_RTAI_TASKLETS = xy && AC_DEFINE(CONFIG_RTAI_TASKLETS_BUILTIN,1,[Kconfig])
1014  
1015  test x$CONFIG_RTAI_SCHED_ISR_LOCK = xy && AC_DEFINE(CONFIG_RTAI_SCHED_ISR_LOCK,1,[Kconfig])
1016  AC_DEFINE_UNQUOTED(CONFIG_RTAI_RTC_FREQ,$CONFIG_RTAI_RTC_FREQ,[Kconfig])
1017  test x$CONFIG_RTAI_LONG_TIMED_LIST = xy && AC_DEFINE(CONFIG_RTAI_LONG_TIMED_LIST,1,[Kconfig])
1018  AC_DEFINE_UNQUOTED(CONFIG_RTAI_SCHED_8254_LATENCY,$CONFIG_RTAI_SCHED_8254_LATENCY,[Kconfig])
1019  AC_DEFINE_UNQUOTED(CONFIG_RTAI_SCHED_APIC_LATENCY,$CONFIG_RTAI_SCHED_APIC_LATENCY,[Kconfig])
1020  AC_DEFINE_UNQUOTED(CONFIG_RTAI_SCHED_LXRT_NUMSLOTS,$CONFIG_RTAI_SCHED_LXRT_NUMSLOTS,[Kconfig])
1021  AC_DEFINE_UNQUOTED(CONFIG_RTAI_RTDM_FD_MAX,$CONFIG_RTAI_RTDM_FD_MAX,[Kconfig])
1022  test x$CONFIG_RTAI_RTDM_SHIRQ = xy && AC_DEFINE(CONFIG_RTAI_RTDM_SHIRQ,1,[Kconfig])
1023  test x$CONFIG_RTAI_RTDM_SELECT = xy && AC_DEFINE(CONFIG_RTAI_RTDM_SELECT,1,[Kconfig])
1024  test x$CONFIG_RTAI_DEBUG_RTDM = xy && AC_DEFINE(CONFIG_RTAI_DEBUG_RTDM,1,[Kconfig])
1025  AC_DEFINE_UNQUOTED(CONFIG_RTAI_CAL_FREQS_FACT,$CONFIG_RTAI_CAL_FREQS_FACT,[Kconfig])
1026  
1027  case $CONFIG_RTAI_MONITOR_EXECTIME in
1028  	y) CONFIG_RTAI_MONITOR_EXECTIME=1 ;;
1029  	n|*) CONFIG_RTAI_MONITOR_EXECTIME=0 ;;
1030  esac
1031  AC_DEFINE_UNQUOTED(CONFIG_RTAI_MONITOR_EXECTIME,$CONFIG_RTAI_MONITOR_EXECTIME,[Kconfig])
1032  
1033  case $CONFIG_RTAI_ALLOW_RR in
1034  	y) CONFIG_RTAI_ALLOW_RR=1 ;;
1035  	n|*) CONFIG_RTAI_ALLOW_RR=0 ;;
1036  esac
1037  AC_DEFINE_UNQUOTED(CONFIG_RTAI_ALLOW_RR,$CONFIG_RTAI_ALLOW_RR,[Kconfig])
1038  
1039  test x$CONFIG_RTAI_FULL_PRINHER = xy && AC_DEFINE(CONFIG_RTAI_FULL_PRINHER,1,[Kconfig])
1040  case $CONFIG_RTAI_USE_NEWERR in
1041  	y) CONFIG_RTAI_USE_NEWERR=1 ;;
1042  	n|*) CONFIG_RTAI_USE_NEWERR=0 ;;
1043  esac
1044  AC_DEFINE_UNQUOTED(CONFIG_RTAI_USE_NEWERR,$CONFIG_RTAI_USE_NEWERR,[Kconfig])
1045  
1046  test x$CONFIG_RTAI_CLOCK_REALTIME = xy && AC_DEFINE(CONFIG_RTAI_CLOCK_REALTIME,1,[Kconfig])
1047  
1048  case $CONFIG_RTAI_IMMEDIATE_LINUX_SYSCALL in
1049  	y) CONFIG_RTAI_IMMEDIATE_LINUX_SYSCALL=1 ;;
1050  	n|*) CONFIG_RTAI_IMMEDIATE_LINUX_SYSCALL=0 ;;
1051  esac
1052  AC_DEFINE_UNQUOTED(CONFIG_RTAI_IMMEDIATE_LINUX_SYSCALL,$CONFIG_RTAI_IMMEDIATE_LINUX_SYSCALL,[Kconfig])
1053  
1054  case $CONFIG_RTAI_ONE_SHOT in
1055  	y) CONFIG_RTAI_ONE_SHOT=1 ;;
1056  	n|*) CONFIG_RTAI_ONE_SHOT=0 ;;
1057  esac
1058  AC_DEFINE_UNQUOTED(CONFIG_RTAI_ONE_SHOT,$CONFIG_RTAI_ONE_SHOT,[Kconfig])
1059  
1060  case $CONFIG_RTAI_BUSY_TIME_ALIGN in
1061  	y) CONFIG_RTAI_BUSY_TIME_ALIGN=1 ;;
1062  	n|*) CONFIG_RTAI_BUSY_TIME_ALIGN=0 ;;
1063  esac
1064  AC_DEFINE_UNQUOTED(CONFIG_RTAI_BUSY_TIME_ALIGN,$CONFIG_RTAI_BUSY_TIME_ALIGN,[Kconfig])
1065  AC_DEFINE_UNQUOTED(CONFIG_RTAI_USER_BUSY_ALIGN_RET_DELAY,$CONFIG_RTAI_USER_BUSY_ALIGN_RET_DELAY,[Kconfig])
1066  AC_DEFINE_UNQUOTED(CONFIG_RTAI_KERN_BUSY_ALIGN_RET_DELAY,$CONFIG_RTAI_KERN_BUSY_ALIGN_RET_DELAY,[Kconfig])
1067  
1068  case $CONFIG_RTAI_DONT_DISPATCH_CORE_IRQS in
1069  	y) CONFIG_RTAI_DONT_DISPATCH_CORE_IRQS=1 ;;
1070  	n|*) CONFIG_RTAI_DONT_DISPATCH_CORE_IRQS=0 ;;
1071  esac
1072  AC_DEFINE_UNQUOTED(CONFIG_RTAI_DONT_DISPATCH_CORE_IRQS,$CONFIG_RTAI_DONT_DISPATCH_CORE_IRQS,[Kconfig])
1073  
1074  AC_DEFINE_UNQUOTED(CONFIG_RTAI_MALLOC_HEAPSZ,$CONFIG_RTAI_MALLOC_HEAPSZ,[Kconfig])
1075  AC_DEFINE_UNQUOTED(CONFIG_RTAI_KSTACK_HEAPSZ,$CONFIG_RTAI_KSTACK_HEAPSZ,[Kconfig])
1076  if test x$CONFIG_DEVFS_FS = xy; then
1077     fifos_template="/dev/rtf/%d"
1078  else
1079     fifos_template="/dev/rtf%d"
1080  fi
1081  AC_DEFINE_UNQUOTED(CONFIG_RTAI_FIFOS_TEMPLATE,"$fifos_template",[Kconfig])
1082  
1083  AC_DEFINE(CONFIG_RTAI_INTERNAL_LXRT_SUPPORT,1,[Kconfig])
1084  
1085  dnl Set default inline mode for LXRT as specified from
1086  dnl Kconfig. Defaults to static / eager inlining.
1087  
1088  CONFIG_RTAI_LXRT_INLINE=1
1089  
1090  AC_DEFINE_UNQUOTED(CONFIG_RTAI_INTERNAL_LXRT_INLINE,1,[Kconfig])
1091  
1092  AH_VERBATIM(CONFIG_RTAI_LXRT_INLINE,[
1093  #ifndef CONFIG_RTAI_LXRT_INLINE
1094  #define CONFIG_RTAI_LXRT_INLINE CONFIG_RTAI_INTERNAL_LXRT_INLINE
1095  #endif /* !CONFIG_RTAI_LXRT_INLINE */
1096  #define __hidefun(name) name ## _hidden_inline
1097  #define RTAI_PROTO(type,name,arglist) static inline type name arglist
1098  #define RTAI_PROTO_ALWAYS_INLINE(type,name,arglist) static inline type name arglist
1099  #define RTAI_PROTO_NEVER_INLINE(type,name,arglist) type name arglist; static inline type __hidefun(name) arglist
1100  ])
1101  
1102  dnl CAUTION: We need to have the CONFIG_RTAI_XX symbols always defined when
1103  dnl the configuration header is read, but we want the Autoconf-produced
1104  dnl symbols to be defined only when compiling RTAI. This way, we won't
1105  dnl pollute the namespace with the latter when our configuration header is
1106  dnl indirectly included by a client application. To achieve this, we ask
1107  dnl autoheader to produce the following header structure:
1108  dnl #define CONFIG_XX
1109  dnl #define CONFIG_XX ...
1110  dnl #ifdef __IN_RTAI__
1111  dnl <Autoconf-defined symbols>
1112  dnl #endif /* __IN_RTAI__ */
1113  dnl This is quite a hack since we have to rely on the fact that
1114  dnl all Autoconf-generated symbols are lexicographically sorted
1115  dnl after CONFIG_RTAI_XX ones, but, well...
1116  
1117  dnl Use a key which will cause the verbatim string to be put after
1118  dnl all CONFIG_RTAI_XX symbols, but still before any Autoconf-generated
1119  dnl symbol, hence CONFIG_RTAI___.
1120  AH_VERBATIM(CONFIG_RTAI___,[#ifdef __IN_RTAI__])
1121  
1122  dnl Now we can close the conditional section, right after all
1123  dnl Autoconf-generated symbols have been listed.
1124  AH_BOTTOM([#endif /* __IN_RTAI__ */])
1125  
1126  dnl No longer used after 2.6.17
1127  dnl AH_BOTTOM([#include <linux/config.h>])
1128  
1129  dnl
1130  dnl Produce automake conditionals.
1131  dnl
1132  
1133  dnl Whether Linux is using the Kbuild make system.
1134  AM_CONDITIONAL(CONFIG_KBUILD,[test "$CONFIG_KBUILD" = y])
1135  
1136  dnl CPU architecture
1137  AM_CONDITIONAL(CONFIG_X86_64,[test "$CONFIG_X86_64" = y])
1138  AM_CONDITIONAL(CONFIG_X86,[test "$CONFIG_X86" = y])
1139  AM_CONDITIONAL(CONFIG_SMP,[test "$CONFIG_SMP" = y])
1140  
1141  AM_CONDITIONAL(CONFIG_RTAI_TRACE,[test -n "$CONFIG_RTAI_TRACE"])
1142  AM_CONDITIONAL(CONFIG_RTAI_MATH,[test -n "$CONFIG_RTAI_MATH"])
1143  AM_CONDITIONAL(CONFIG_RTAI_BITS,[test -n "$CONFIG_RTAI_BITS"])
1144  AM_CONDITIONAL(CONFIG_RTAI_FIFOS,[test -n "$CONFIG_RTAI_FIFOS"])
1145  AM_CONDITIONAL(CONFIG_RTAI_NETRPC,[test -n "$CONFIG_RTAI_NETRPC"])
1146  AM_CONDITIONAL(CONFIG_RTAI_SEM,[test -n "$CONFIG_RTAI_SEM"])
1147  AM_CONDITIONAL(CONFIG_RTAI_RT_POLL,[test -n "$CONFIG_RTAI_RT_POLL"])
1148  AM_CONDITIONAL(CONFIG_RTAI_RT_POLL_ON_STACK,[test -n "$CONFIG_RTAI_RT_POLL_ON_STACK"])
1149  AM_CONDITIONAL(CONFIG_RTAI_MSG,[test -n "$CONFIG_RTAI_MSG"])
1150  AM_CONDITIONAL(CONFIG_RTAI_MBX,[test -n "$CONFIG_RTAI_MBX"])
1151  AM_CONDITIONAL(CONFIG_RTAI_TBX,[test -n "$CONFIG_RTAI_TBX"])
1152  AM_CONDITIONAL(CONFIG_RTAI_MQ,[test -n "$CONFIG_RTAI_MQ"])
1153  AM_CONDITIONAL(CONFIG_RTAI_SHM,[test -n "$CONFIG_RTAI_SHM"])
1154  AM_CONDITIONAL(CONFIG_RTAI_MALLOC,[test -n "$CONFIG_RTAI_MALLOC"])
1155  AM_CONDITIONAL(CONFIG_RTAI_TASKLETS,[test -n "$CONFIG_RTAI_TASKLETS"])
1156  AM_CONDITIONAL(CONFIG_RTAI_LXRT_USE_LINUX_SYSCALL,[test -n "$CONFIG_RTAI_LXRT_USE_LINUX_SYSCALL"])
1157  
1158  AM_CONDITIONAL(CONFIG_RTAI_MATH_BUILTIN,[test x$CONFIG_RTAI_MATH = xy])
1159  AM_CONDITIONAL(CONFIG_RTAI_BITS_BUILTIN,[test x$CONFIG_RTAI_BITS = xy])
1160  AM_CONDITIONAL(CONFIG_RTAI_FIFOS_BUILTIN,[test x$CONFIG_RTAI_FIFOS = xy])
1161  AM_CONDITIONAL(CONFIG_RTAI_NETRPC_BUILTIN,[test x$CONFIG_RTAI_NETRPC = xy])
1162  AM_CONDITIONAL(CONFIG_RTAI_SEM_BUILTIN,[test x$CONFIG_RTAI_SEM = xy])
1163  AM_CONDITIONAL(CONFIG_RTAI_MSG_BUILTIN,[test x$CONFIG_RTAI_MSG = xy])
1164  AM_CONDITIONAL(CONFIG_RTAI_MBX_BUILTIN,[test x$CONFIG_RTAI_MBX = xy])
1165  AM_CONDITIONAL(CONFIG_RTAI_TBX_BUILTIN,[test x$CONFIG_RTAI_TBX = xy])
1166  AM_CONDITIONAL(CONFIG_RTAI_MQ_BUILTIN,[test x$CONFIG_RTAI_MQ = xy])
1167  AM_CONDITIONAL(CONFIG_RTAI_SHM_BUILTIN,[test x$CONFIG_RTAI_SHM = xy])
1168  AM_CONDITIONAL(CONFIG_RTAI_MALLOC_BUILTIN,[test x$CONFIG_RTAI_MALLOC = xy])
1169  AM_CONDITIONAL(CONFIG_RTAI_TASKLETS_BUILTIN,[test x$CONFIG_RTAI_TASKLETS = xy])
1170  
1171  dnl Supported skins
1172  AM_CONDITIONAL(CONFIG_RTAI_RTDM,[test x$CONFIG_RTAI_RTDM = xy])
1173  
1174  dnl Misc compilation conditionals
1175  AM_CONDITIONAL(CONFIG_RTAI_ADEOS,[test "$CONFIG_RTAI_ADEOS" = y])
1176  AM_CONDITIONAL(CONFIG_RTAI_MATH_C99,[test "$CONFIG_RTAI_MATH_C99" = y])
1177  
1178  dnl Maintenance symbols and profiles
1179  AM_CONDITIONAL(CONFIG_RTAI_OLD_FASHIONED_BUILD,[test "$CONFIG_RTAI_OLD_FASHIONED_BUILD" = y])
1180  
1181  dnl
1182  dnl Define arch-specific CFLAGS and links
1183  dnl
1184  
1185  RTAI_MODULE_EXT=.ko
1186  RTAI_KBUILD_ENV='src2obj = $(patsubst %.$(1),%.o,$(filter %.$(1),$(call notdir,$(2))))'
1187  RTAI_KBUILD_TOP="@if test \\! -r Module.symvers ; then \$(LN_S) -f \"\`cd \$(top_builddir) && pwd\`/Module.symvers\" . ; fi;"
1188  RTAI_KBUILD_BOTTOM=
1189  RTAI_KBUILD_CMD="for src in \$^; do if test \\! -r \`basename \$\$src\`; then \$(LN_S) \$\$src; fi; done; \
1190  			rm -f $RTAI_LINUX_DIR/.tmp_versions/rtai_*.mod $RTAI_LINUX_DIR/.tmp_versions/*_rt.mod; \
1191  			\$(MAKE) -C $RTAI_LINUX_DIR CC=$CC ARCH=x86 \
1192  			SUBDIRS=\$\$PWD M=\$\$PWD rtai_srctree=\`cd \$(top_srcdir) && pwd\` rtai_srcdir=\`cd \$(srcdir) && pwd\` V=\$(V) modules \
1193  			rtai_objs='\$(call src2obj,c,\$^) \$(call src2obj,S,\$^) \$(call src2obj,cc,\$^) \$(call src2obj,cpp,\$^)' rtai_target=\$(basename \$@)"
1194  RTAI_KBUILD_CLEAN='rm -f *.ko *.mod.c .*.cmd *.o Module.symvers Module.markers modules.order && rm -Rf .tmp_versions'
1195  RTAI_KBUILD_DISTCLEAN=""
1196  
1197  AC_MSG_CHECKING([for kernel module extension])
1198  AC_MSG_RESULT([$RTAI_MODULE_EXT])
1199  
1200  RTAI_REAL_USER_CFLAGS=""
1201  
1202  if test x"$LINUX_KERNELOUTPUT" != x"$LINUX_KERNELSRC"; then
1203    RTAI_REAL_USER_CFLAGS="-I$LINUX_KERNELOUTPUT/include $RTAI_REAL_USER_CFLAGS"
1204  fi
1205  
1206  dnl extra arch-dependent opts to be passed to the compiler
1207  RTAI_KMOD_CXXFLAGS="$RTAI_KMOD_CFLAGS -fno-rtti -fno-exceptions -fno-strength-reduce"
1208  RTAI_REAL_USER_CFLAGS="$RTAI_REAL_USER_CFLAGS -Wall -Wstrict-prototypes"
1209  RTAI_FP_CFLAGS="$RTAI_FP_CFLAGS -ffreestanding -fno-builtin-sin -fno-builtin-cos -mieee-fp -mhard-float -mpreferred-stack-boundary=4 -msse -Wno-undef"
1210  
1211  if test x$CONFIG_RTAI_KMOD_DEBUG = xy; then
1212     RTAI_KMOD_CFLAGS="-g $RTAI_KMOD_CFLAGS"
1213     RTAI_KMOD_CXXFLAGS="-g $RTAI_KMOD_CXXFLAGS"
1214  fi
1215  
1216  if [[ $ac_cv_accepts_cxa_atexit = yes ]]; then
1217     RTAI_KMOD_CXXFLAGS="$RTAI_KMOD_CXXFLAGS -fno-use-cxa-atexit"
1218  fi
1219  
1220  RTAI_LXRT_LDADD=
1221  
1222  RTAI_KMOD_APP_CFLAGS=$RTAI_KMOD_CFLAGS
1223  RTAI_KMOD_APP_CXXFLAGS=$RTAI_KMOD_CXXFLAGS
1224  RTAI_USER_APP_CFLAGS=$RTAI_REAL_USER_CFLAGS
1225  RTAI_KMOD_CFLAGS="$RTAI_KMOD_CFLAGS -D__IN_RTAI__"
1226  RTAI_KMOD_CXXFLAGS="$RTAI_KMOD_CXXFLAGS -D__IN_RTAI__"
1227  RTAI_REAL_USER_CFLAGS="$RTAI_REAL_USER_CFLAGS -D__IN_RTAI__"
1228  
1229  AC_CONFIG_LINKS(base/include/asm:$srcdir/base/include/asm-x86)
1230  
1231  if test x$CONFIG_RTAI_OLD_FASHIONED_BUILD = xy; then
1232     AC_CONFIG_LINKS(base/include/rtai_config.h:rtai_config.h)
1233  fi
1234  
1235  AC_MSG_CHECKING([for RTAI target architecture])
1236  if test x$RTAI_TARGET_SUBARCH = x; then
1237     AC_MSG_RESULT([x86])
1238  else
1239     AC_MSG_RESULT([x86 ($RTAI_TARGET_SUBARCH)])
1240  fi
1241  
1242  AC_CONFIG_LINKS(base/arch/x86/hal/Makefile:base/arch/x86/hal/Makefile.kbuild)
1243  AC_CONFIG_LINKS(base/arch/x86/calibration/Makefile:base/arch/x86/calibration/Makefile.kbuild)
1244  AC_CONFIG_LINKS(base/ipc/bits/Makefile:base/ipc/bits/Makefile.kbuild)
1245  AC_CONFIG_LINKS(base/ipc/fifos/Makefile:base/ipc/fifos/Makefile.kbuild)
1246  AC_CONFIG_LINKS(base/ipc/mbx/Makefile:base/ipc/mbx/Makefile.kbuild)
1247  AC_CONFIG_LINKS(base/ipc/mq/Makefile:base/ipc/mq/Makefile.kbuild)
1248  AC_CONFIG_LINKS(base/ipc/msg/Makefile:base/ipc/msg/Makefile.kbuild)
1249  AC_CONFIG_LINKS(base/ipc/sem/Makefile:base/ipc/sem/Makefile.kbuild)
1250  AC_CONFIG_LINKS(base/ipc/tbx/Makefile:base/ipc/tbx/Makefile.kbuild)
1251  AC_CONFIG_LINKS(base/ipc/netrpc/Makefile:base/ipc/netrpc/Makefile.kbuild)
1252  AC_CONFIG_LINKS(base/ipc/shm/Makefile:base/ipc/shm/Makefile.kbuild)
1253  AC_CONFIG_LINKS(base/posix/Makefile:base/posix/Makefile.kbuild)
1254  AC_CONFIG_LINKS(base/malloc/Makefile:base/malloc/Makefile.kbuild)
1255  AC_CONFIG_LINKS(base/tasklets/Makefile:base/tasklets/Makefile.kbuild)
1256  AC_CONFIG_LINKS(base/math/Makefile:base/math/Makefile.kbuild)
1257  AC_CONFIG_LINKS(base/sched/Makefile:base/sched/Makefile.kbuild)
1258  AC_CONFIG_LINKS(addons/rtdm/Makefile:addons/rtdm/Makefile.kbuild)
1259  
1260  dnl
1261  dnl POSIX wraps
1262  dnl
1263  RTAI_POSIX_WRAP=`for f in \`cat "${srcdir}/base/posix/POSIX_WRAPS"\`; do echo -n " -Wl,--wrap -Wl,$f" ; done`
1264  
1265  RTAI_USER_CFLAGS="-I$LINUX_KERNELSRC/include $RTAI_REAL_USER_CFLAGS"
1266  
1267  dnl
1268  dnl Build the Makefiles
1269  dnl
1270  
1271  AC_SUBST(RTAI_BUILD_STRING)
1272  AC_SUBST(RTAI_HOST_STRING)
1273  AC_SUBST(RTAI_TARGET_SUBARCH)
1274  AC_SUBST(RTAI_BUILTIN_MODLIST)
1275  AC_SUBST(RTAI_KMOD_CFLAGS)
1276  AC_SUBST(RTAI_KMOD_CXXFLAGS)
1277  AC_SUBST(RTAI_COMPAT_CPPFLAGS)
1278  AC_SUBST(RTAI_USER_CFLAGS)
1279  AC_SUBST(RTAI_REAL_USER_CFLAGS)
1280  AC_SUBST(RTAI_KMOD_APP_CFLAGS)
1281  AC_SUBST(RTAI_KMOD_APP_CXXFLAGS)
1282  AC_SUBST(RTAI_USER_APP_CFLAGS)
1283  AC_SUBST(RTAI_LXRT_LDADD)
1284  AC_SUBST(RTAI_FP_CFLAGS)
1285  AC_SUBST(RTAI_LINUX_DIR)
1286  AC_SUBST(RTAI_LINUX_VERSION)
1287  AC_SUBST(RTAI_MODULE_DIR)
1288  AC_SUBST(RTAI_MODULE_EXT)
1289  AC_SUBST(RTAI_KBUILD_ENV)
1290  AC_SUBST(RTAI_KBUILD_TOP)
1291  AC_SUBST(RTAI_KBUILD_BOTTOM)
1292  AC_SUBST(RTAI_KBUILD_CMD)
1293  AC_SUBST(RTAI_KBUILD_CLEAN)
1294  AC_SUBST(RTAI_KBUILD_DISTCLEAN)
1295  AC_SUBST(RTAI_POSIX_WRAP)
1296  
1297  AC_SUBST(CONFIG_RTAI_LINUXDIR)
1298  
1299  AC_CONFIG_FILES([ \
1300  	GNUmakefile \
1301  	base/GNUmakefile \
1302  	base/arch/GNUmakefile \
1303  	base/include/GNUmakefile \
1304  	base/ipc/GNUmakefile \
1305  	base/sched/GNUmakefile \
1306  	base/sched/liblxrt/GNUmakefile \
1307  	base/scripts/GNUmakefile \
1308  	base/scripts/rtai-config \
1309  	base/scripts/rtai-load \
1310  	base/arch/x86/GNUmakefile \
1311  	base/arch/x86/hal/GNUmakefile \
1312  	base/arch/x86/calibration/GNUmakefile \
1313  	base/arch/x86/calibration/setsmi \
1314  	base/include/asm-x86/GNUmakefile \
1315     	base/ipc/bits/GNUmakefile \
1316  	base/ipc/fifos/GNUmakefile \
1317  	base/ipc/netrpc/GNUmakefile \
1318  	base/ipc/shm/GNUmakefile \
1319  	base/ipc/sem/GNUmakefile \
1320  	base/ipc/msg/GNUmakefile \
1321  	base/ipc/mbx/GNUmakefile \
1322  	base/ipc/tbx/GNUmakefile \
1323  	base/ipc/mq/GNUmakefile \
1324  	base/math/GNUmakefile \
1325  	base/malloc/GNUmakefile \
1326  	base/tasklets/GNUmakefile \
1327  	base/trace/GNUmakefile \
1328  	base/posix/GNUmakefile \
1329  	addons/GNUmakefile \
1330  	addons/rtdm/GNUmakefile \
1331  	addons/rtdm/lib/GNUmakefile
1332  	])
1333  
1334  AC_OUTPUT