4 # Copyright (C) 2004 Edouard TISSERRANT, Laurent BESSARD
5 # Based on Gabriel Gerhardsson's cacheprobe configure script.
7 # This file is part of CanFestival, a library implementing CanOpen Stack.
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 ###########################################################################
25 # DEFAULT CANFESTIVAL DEFINES #
26 ###########################################################################
28 # Number of can bus to use
31 # max bytes to transmit by SDO Put 4 if you only support expedited transfert.
32 #For a normal transfert, (usually for a string), put the maximum string size to transfer.
33 SDO_MAX_LENGTH_TRANSFERT=32
35 # Number of SDO from differents nodes that the node can manage concurrently.
36 #for a slave node, usually put 1.
37 SDO_MAX_SIMULTANEOUS_TRANSFERTS=4
39 # Used for NMTable[bus][nodeId]
40 # You can put less of 128 if on the netwo
41 # are connected only smaller nodeId node.
44 #Timeout in milliseconds for SDO.
45 # Comment the #define if not used (infinite wait for SDO response message)
50 # Generic timers declaration defaults
55 # Default to little-endian
58 # Max number of active errors managed in error_data structure.
61 #Timeout in milliseconds for LSS.
63 #Timeout in milliseconds for LSS FastScan.
66 ###########################################################################
67 # DEFAULT BUILD OPTIONS #
68 ###########################################################################
73 # First compiler option - we will check if it exists
75 # Second compiler option - we will check if it exists
81 # Used for C compiler test/detection
86 if [ "$XENO_CONFIG" = "" ]; then
87 XENO_CONFIG=/usr/xenomai/bin/xeno-config
90 if [ "$RTAI_CONFIG" = "" ]; then
91 RTAI_CONFIG=/usr/realtime/bin/rtai-config
94 ###########################################################################
96 ###########################################################################
97 while [ $# -ge 1 ]; do
98 optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
102 --cxx=*) CXX=$optarg;;
104 --binutils=*) BINUTILS_PREFIX=$optarg;;
105 --arch=*) SUB_ARCH_NAME=$optarg;;
106 --os=*) SUB_OS_NAME=$optarg;;
107 --kerneldir=*) SUB_KERNELDIR=$optarg;;
108 --prefix=*) SUB_PREFIX=$optarg;;
109 --target=*) SUB_TARGET=$optarg;;
110 --can=*) SUB_CAN_DRIVER=$optarg;;
111 --timers=*) SUB_TIMERS_DRIVER=$optarg;;
112 --wx=*) SUB_WX=$optarg;
113 echo "Forced wx detection to $optarg";;
114 --disable-Ox) DISABLE_OPT=1;
115 echo "On user request: Won't optimize with \"-Ox\"";;
116 --disable-dll) DISABLE_DLL=1;
117 echo "On user request: Won't create and link to dll";;
118 --enable-lss) ENABLE_LSS=1;
119 echo "On user request: LSS services enabled";;
120 --enable-lss-fs) ENABLE_LSS_FS=1;
121 echo "On user request: LSS FastScan service enabled";;
122 --debug=*) DEBUG=$optarg;;
123 --MAX_CAN_BUS_ID=*) MAX_CAN_BUS_ID=$optarg;;
124 --SDO_MAX_LENGTH_TRANSFERT=*) SDO_MAX_LENGTH_TRANSFERT=$optarg;;
125 --SDO_MAX_SIMULTANEOUS_TRANSFERTS=*) SDO_MAX_SIMULTANEOUS_TRANSFERTS=$optarg;;
126 --NMT_MAX_NODE_ID=*) NMT_MAX_NODE_ID=$optarg;;
127 --SDO_TIMEOUT_MS=*) SDO_TIMEOUT_MS=$optarg;;
128 --CANOPEN_BIG_ENDIAN=*) CANOPEN_BIG_ENDIAN=$optarg;;
129 --MAX_NB_TIMER=*) MAX_NB_TIMER=$optarg;;
130 --EMCY_MAX_ERRORS=*) EMCY_MAX_ERRORS=$optarg;;
131 --LSS_TIMEOUT_MS=*) LSS_TIMEOUT_MS=$optarg;;
132 --LSS_FS_TIMEOUT_MS=*) LSS_FS_TIMEOUT_MS=$optarg;;
134 echo "Usage: ./configure [options]"
136 echo " --cc=foo Use C compiler 'foo' instead of defaults ${CC1} or ${CC2}."
137 echo " --cxx=foo Use C++ compiler 'foo' instead of defaults g++."
138 echo " --ld=foo Use linker 'foo' instead of ld."
139 echo " --arch=foo Use architecture 'foo' instead of trying to autodetect."
140 echo " --os=foo Use operative system 'foo' instead of trying to autodetect."
141 echo " --kerneldir=foo Use 'foo' as kernel source directory instead of default"
142 echo " --prefix=foo Use prefix 'foo' instead of default ${SUB_PREFIX}."
143 echo " --target=foo Use 'foo' as build target."
144 echo " \"unix\" for unix-like systems (Linux, Cygwin)"
145 echo " \"win32\" for win32 systems (native, mingw or VC++)"
146 echo " \"hcs12\" for HCS12 micro-controller"
147 echo " --can=foo Use 'foo' as CAN driver"
148 echo " \"peak_linux\" use Linux build host installed Peak driver and library"
149 echo " see http://www.peak-system.com/linux/"
150 echo " \"peak_win32\" use win32 PcanLight Peak driver and library with Cygwin"
151 echo " see http://www.peak-system.com/themen/download_gb.html"
152 echo " \"virtual\" use unix pipe based virtual can driver"
153 echo " \"virtual_kernel\" use kernel module virtual can driver"
154 echo " \"socket\" use socket-can "
155 echo " see http://developer.berlios.de/projects/socketcan/"
156 echo " \"lincan\" lincan driver"
157 echo " see http://www.ocera.org/download/components/WP7/lincan-0.3.3.html"
158 echo " \"can4linux\" can4linux driver"
159 echo " see http://www.port.de/engl/canprod/hw_can4linux.html"
160 echo " --timers=foo Use 'foo' as TIMERS driver (can be 'unix', 'xeno', 'rtai' or 'kernel')"
161 echo " --wx=foo Force result of WxWidgets detection (0 or 1)"
162 echo " --binutils=path Override binutils path detection (as regards \$CC content)"
163 echo " --disable-dll Disable run-time dynamic linking of can, led and nvram drivers"
164 echo " --enable-lss Enable the LSS services"
165 echo " --enable-lss-fs Enable the LSS FastScan service"
166 echo " --disable-Ox Disable gcc \"-Ox\" optimizations."
167 echo " --debug=foo,foo,.. Enable debug messages, ERR -> only errors, WAR)."
168 echo " \"PDO\" send errors and warnings through PDO messages"
169 echo " \"ERR\" print errors only, to stdout"
170 echo " \"WAR\" print errors and warnings, to stdout"
171 echo " \"MSG\" print messages content, to stdout"
173 echo "Stack compilation constants"
174 echo " --MAX_CAN_BUS_ID [=1] Number of can bus to use"
175 echo " --SDO_MAX_LENGTH_TRANSFERT [=32] max bytes to transmit by SDO"
176 echo " --SDO_MAX_SIMULTANEOUS_TRANSFERTS [=4] Number of SDO that the node can manage concurrently"
177 echo " --NMT_MAX_NODE_ID [=128] can be reduced to gain memory on small network"
178 echo " --SDO_TIMEOUT_MS [=3000] Timeout in milliseconds for SDO (None to disable the feature)"
179 echo " --EMCY_MAX_ERRORS [=8] Max number of active errors managed in error_data structure"
180 echo " --LSS_TIMEOUT_MS [=1000] Timeout in milliseconds for LSS services."
181 echo " LSS must be enabled with \"--enable-lss\""
182 echo " --LSS_FS_TIMEOUT_MS [=100] Timeout in milliseconds for LSS FastScan service."
183 echo " LSS FastScan must be enabled with \"--enable-lss-fs\""
185 *) echo "Unknown argument ${1}"; exit -1;;
191 ###########################################################################
193 ###########################################################################
195 if [ "$SUB_OS_NAME" = "" ]; then
196 SUB_OS_NAME="`(uname -s | sed \"s/\//-/\" | sed \"s/_/-/\" \
197 | sed \"s/-.*//g\") 2>&1`"
200 if [ "$SUB_ARCH_NAME" = "" ]; then
201 if [ "$CC" = "" ]; then
202 A_NAME="`(uname -m) 2>&1`"
204 A_NAME="`$CC -dumpmachine | sed 's:-.*::'`"
209 if [ "$A_NAME" = "i386" -o "$A_NAME" = "i486" -o "$A_NAME" = "i586" -o "$A_NAME" = "i686" -o "$A_NAME" = "x86" ]; then
214 if [ "$A_NAME" = "x86_64" ]; then
219 if [ "$A_NAME" = "powerpc" ]; then
224 if [ "$A_NAME" = "powerpc64" ]; then
229 if [ "$A_NAME" = "arm" ]; then
234 if [ "$A_NAME" = "mingw32" ]; then
235 SUB_ARCH_NAME=mingw32
238 if [ "$SUB_ARCH_NAME" = "" ]; then
239 echo "Error: could not detect what architecture this system is running!"
240 echo "Please supply manually instead with \"--arch=foo\""
244 echo "Host OS: ${SUB_OS_NAME}"
245 echo "Host arch: ${SUB_ARCH_NAME}"
247 if [ "$SUB_ARCH_NAME" = "x86_64" -a "$CC" = "gcc" ]; then
248 # Only if we are on x86_64 and using gcc
249 # For shared library generation, it needs this
250 SUB_PROG_CFLAGS=-fPIC
253 if [ "$SUB_ARCH_NAME" = "ppc" -o "$SUB_ARCH_NAME" = "powerpc" ]; then
254 # PowerPC uses big endian format
258 ###########################################################################
259 # DEFAULT TARGET/DRIVERS GUESSING #
260 ###########################################################################
261 # If target not specified, try to guess one
262 if [ "$SUB_TARGET" = "" ]; then
263 if [ "$SUB_OS_NAME" = "CYGWIN" ]; then
264 echo "Choosing unix (cygwin) target"
267 if [ "$SUB_OS_NAME" = "Linux" ]; then
268 echo "Choosing unix target"
271 if [ "$SUB_OS_NAME" = "MINGW32" ]; then
272 echo "Choosing windows target"
278 if [ "$SUB_CAN_DRIVER" = "" ]; then
279 if [ "$SUB_TARGET" = "unix" ]; then
280 if [ -e /usr/lib/libpcan.so ]; then
281 echo "Choosing installed Peak driver as CAN driver."
282 SUB_CAN_DRIVER=peak_linux
283 elif [ "$SUB_OS_NAME" = "CYGWIN" -a "PCAN_LIB" != "" ]; then
284 echo "Choosing installed Peak driver as CAN driver."
285 SUB_CAN_DRIVER=peak_win32
286 elif [ -e /usr/lib/libcanlib.so ]; then
287 echo "Choosing installed Kvaser driver as CAN driver. (unix)"
288 SUB_CAN_DRIVER=kvaser
289 elif [ "$SUB_OS_NAME" = "CYGWIN" -a "$KVASER_DLL_PATH" != "" ]; then
290 echo "Choosing installed Kvaser driver as CAN driver. (cygwin)"
291 SUB_CAN_DRIVER=kvaser
293 echo "Choosing virtual CAN driver."
294 SUB_CAN_DRIVER=virtual
299 # If target is unix, default timers also
300 if [ "$SUB_TARGET" = "unix" -a "$SUB_TIMERS_DRIVER" = "" ]; then
301 echo "Choosing unix timers driver."
302 SUB_TIMERS_DRIVER=unix
305 # If target is windows, default timers also
306 if [ "$SUB_TARGET" = "win32" -a "$SUB_TIMERS_DRIVER" = "" ]; then
307 echo "Choosing windows timers driver."
308 SUB_TIMERS_DRIVER=win32
311 # Warn for unstalled peak driver if choosen
312 if [ "$SUB_CAN_DRIVER" = "peak" ]; then
313 if [ ! -e /usr/lib/libpcan.so ]; then
314 echo "Peak driver hasn't been installed !"
319 # Warn for unstalled kvaser driver if choosen
320 if [ "$SUB_CAN_DRIVER" = "kvaser" ]; then
321 if [ "$SUB_OS_NAME" = "CYGWIN" ]; then
322 if [ ! -e "$KVASER_DLL_PATH/canlib32.dll" ]; then
323 echo "Kvaser driver hasn't been installed (cygwin)"
326 elif [ "$SUB_OS_NAME" = "LINUX" ]; then
327 if [ ! -e /usr/lib/libcanlib.so ]; then
328 echo "Kvaser driver hasn't been installed (unix)"
334 ###########################################################################
335 # TARGET/DRIVER SPECIFIC CFLAGS and OPTIONS #
336 ###########################################################################
337 if [ "$SUB_TARGET" = "hcs12" ]; then
338 # Only if we want to compile for a C HCS12
339 # it is a big endian architecture.
341 # search for gcc hcs12 compiler m6811-elf-gcc or m68hc12-gcc ?
342 if [ "$CC" = "" ]; then
343 which m6811-elf-gcc >/dev/null 2>&1
345 which m68hc12-gcc >/dev/null 2>&1
347 echo "Please use --cc flag to specify compiler"
354 SUB_PROG_CFLAGS=-m68hc12
361 if [ "$SUB_CAN_DRIVER" = "kvaser" ]; then
362 if [ "$SUB_TARGET" = "unix" ]; then
363 if [ "$SUB_OS_NAME" = "LINUX" ]; then
364 SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lcanlib
365 elif [ "$SUB_OS_NAME" = "CYGWIN" ]; then
366 if [ "$KVASER_INCLUDE_PATH" = "" -o "$KVASER_DLL_PATH" = "" ]; then
367 echo "!!! ERROR !!! Please set KVASER_DLL_PATH and KVASER_INCLUDE_PATH to appropriate paths ! "
369 SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -L$KVASER_DLL_PATH\ -lcanlib32
370 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -I$KVASER_INCLUDE_PATH
376 if [ "$SUB_CAN_DRIVER" = "peak_linux" ]; then
377 SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lpcan
380 if [ "$SUB_CAN_DRIVER" = "vscom" ]; then
381 SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lvs_can_api
384 PW32DIR=drivers/can_peak_win32
385 if [ "$SUB_CAN_DRIVER" = "peak_win32" ]; then
386 if [ "$PCAN_HEADER" = "" -o "$PCAN_LIB" = "" ]; then
387 echo "!!! ERROR !!! Please set PCAN_LIB PCAN_HEADER [PCAN_INCLUDE] to appropriate paths ! "
389 SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -liberty\ \'$PCAN_LIB\'
390 echo "Converting PcanLib header files for gcc -> $PW32DIR/cancfg.h"
391 cat $PW32DIR/cancfg.h.head $PCAN_INCLUDE/$PCAN_HEADER > $PW32DIR/cancfg.h
392 echo >> $PW32DIR/cancfg.h
393 # second port handling
394 if [ "$PCAN2_HEADER" != "" ]; then
395 echo "Stripping down second Pcan Light header "
396 echo >> $PW32DIR/cancfg.h
397 echo "// Stripped PcanLight header to prevent typedef conflicts ">> $PW32DIR/cancfg.h
398 echo >> $PW32DIR/cancfg.h
399 grep __stdcall $PCAN_INCLUDE/$PCAN2_HEADER >> $PW32DIR/cancfg.h
400 echo '#define PCAN2_HEADER_' >> $PW32DIR/cancfg.h
401 SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ \'$PCAN2_LIB\'
403 if grep -q CANHwType $PW32DIR/cancfg.h ; then
404 echo "Peak Init HwType, IO_Port and IRQ will be passed in environment :"
405 echo " PCANHwType PCANIO_Port PCANInterupt"
406 echo '#define extra_PCAN_init_params' >> $PW32DIR/cancfg.h
408 if ! grep -q CAN_Init $PW32DIR/cancfg.h ; then
409 echo "Pcan Light header/lib is for second port of device only"
410 echo "CAN_* calls redefined to CAN2_* "
411 echo '#define CAN_Init CAN2_Init' >> $PW32DIR/cancfg.h
412 echo '#define CAN_Read CAN2_Read' >> $PW32DIR/cancfg.h
413 echo '#define CAN_Write CAN2_Write' >> $PW32DIR/cancfg.h
414 echo '#define CAN_Close CAN2_Close' >> $PW32DIR/cancfg.h
416 cat $PW32DIR/cancfg.h.tail >> $PW32DIR/cancfg.h
419 if [ "$SUB_CAN_DRIVER" = "none" ]; then
423 #### TIMERS_DRIVER ####
425 if [ "$SUB_TIMERS_DRIVER" = "unix" ]; then
426 if [ "$SUB_OS_NAME" != "CYGWIN" ]; then
427 SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lpthread\ -lrt
431 if [ "$SUB_TIMERS_DRIVER" = "xeno" ]; then
432 RT_LIB_DIR=`$XENO_CONFIG --library-dir`\ -Wl,-rpath\ `$XENO_CONFIG --library-dir`
433 SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ `$XENO_CONFIG --xeno-ldflags`\ -L$RT_LIB_DIR\ -lnative\ -lrtdm
434 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DUSE_XENO\ `$XENO_CONFIG --xeno-cflags`
438 if [ "$SUB_TIMERS_DRIVER" = "rtai" ]; then
439 RT_LIB_DIR=`$RTAI_CONFIG --library-dir`\ -Wl,-rpath\ `$RTAI_CONFIG --library-dir`
440 SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ `$RTAI_CONFIG --lxrt-ldflags`\ -L$RT_LIB_DIR\ -llxrt\ -lrtdm
441 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DUSE_RTAI\ `$RTAI_CONFIG --lxrt-cflags`
445 if [ "$SUB_TIMERS_DRIVER" = "kernel" ]; then
447 if [ "$SUB_KERNELDIR" = "" ]; then
448 # use directory of current kernel
449 SUB_KERNELDIR=/lib/modules/$(uname -r)/build
453 if [ "$SUB_TIMERS_DRIVER" = "none" ]; then
457 ###########################################################################
459 ###########################################################################
460 # If CC is empty, the user wanted automatic detection
461 if [ "$CC" = "" ]; then
462 # Check for second compiler, CC2
464 int main() { return 0; }
466 if test "`($CC2 -c $CFLAGS $test.c) 2>&1`" = ""; then
468 echo "Checking for ${CC2}... Yes."
470 echo "Checking for ${CC2}... No."
472 rm -f $test.c $test.o
474 # Check for first compiler, CC1
476 int main() { return 0; }
478 if test "`($CC1 -c $CFLAGS $test.c) 2>&1`" = ""; then
480 echo "Checking for ${CC1}... Yes."
482 echo "Checking for ${CC1}... No."
484 rm -f $test.c $test.o
487 # Check if we decided on a compiler after all
488 if [ "$CC" = "" ]; then
489 echo "Error: Could not find a C compiler"
490 echo "Please supply the wanted compiler"
494 echo "Using ${CC} as a C compiler"
496 if [ "$BINUTILS_PREFIX" = "" ]; then
497 SUB_BINUTILS_PREFIX=`echo "$CC" | sed 's/gcc$//'`
499 SUB_BINUTILS_PREFIX=$BINUTILS_PREFIX
502 if [ "$CXX" = "" ]; then
503 CXX=${SUB_BINUTILS_PREFIX}g++
506 echo "Using ${CXX} as a C++ compiler"
508 if [ "$SUB_TARGET" = "win32" ]; then
509 # on cygwin/mingw, choose g++ as a linker for native target
510 if [ "$LD" = "" ]; then
513 if [ "$SUB_OS_NAME" = "CYGWIN" ]; then
514 SUB_PROG_CFLAGS="-mno-cygwin"
518 if [ "$SUB_TARGET" = "unix" ]; then
519 if [ "$LD" = "" ]; then
524 echo "Using ${LD} as a linker"
526 # Guess prefix as regard cross compiling target machine
527 if [ "$SUB_PREFIX" = "" ]; then
528 $CC -dumpspecs |grep -A 1 'cross_compile'|grep -q 1
530 SUB_PREFIX=/usr/local
531 echo "Not cross-compiling. Will install in $SUB_PREFIX";
533 SUB_PREFIX=/usr/`$CC -dumpmachine`
534 echo "This is a cross-compiler. Will install in $SUB_PREFIX";
538 echo "Using prefix: ${SUB_PREFIX}"
540 ###########################################################################
541 # GUESS DEPENDENCIES #
542 ###########################################################################
544 if [ "$SUB_WX" = "" ]; then
545 if which wx-config >/dev/null 2>&1; then
546 echo -n "Testing wxWidgets compiles ... "
547 cat > /tmp/wx_test.cpp <<EOF
549 class MyApp : public wxApp
554 if $CXX /tmp/wx_test.cpp `wx-config --cxxflags` `wx-config --libs` -o /tmp/wx_test >/dev/null 2>&1 ; then
564 echo "No wxWidgets available"
567 ###########################################################################
568 # CANFESTIVAL DEFINES --> config.h #
569 ###########################################################################
570 # Some CONSTANTS preparation
572 # Create include/config.h with the relevant contents
573 rm -f include/config.h
574 echo "/* !!!!!!!!!! FILE GENERATED by configure. DO NOT EDIT !!!!!!!!!!*/" >> include/config.h
575 echo "" >> include/config.h
576 echo "/*"\ >> include/config.h
577 echo "This file is part of CanFestival, a library implementing CanOpen Stack." >> include/config.h
578 echo "" >> include/config.h
579 echo "Copyright (C): Edouard TISSERANT and Francis DUPIN" >> include/config.h
580 echo "See COPYING file for copyrights details." >> include/config.h
581 echo "" >> include/config.h
582 echo "This library is free software; you can redistribute it and/or" >> include/config.h
583 echo "modify it under the terms of the GNU Lesser General Public" >> include/config.h
584 echo "License as published by the Free Software Foundation; either" >> include/config.h
585 echo "version 2.1 of the License, or (at your option) any later version." >> include/config.h
586 echo "" >> include/config.h
587 echo "This library is distributed in the hope that it will be useful," >> include/config.h
588 echo "but WITHOUT ANY WARRANTY; without even the implied warranty of" >> include/config.h
589 echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU" >> include/config.h
590 echo "Lesser General Public License for more details." >> include/config.h
591 echo "" >> include/config.h
592 echo "You should have received a copy of the GNU Lesser General Public" >> include/config.h
593 echo "License along with this library; if not, write to the Free Software" >> include/config.h
594 echo "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA" >> include/config.h
595 echo "*/" >> include/config.h
596 echo "" >> include/config.h
597 echo "#ifndef _CONFIG_H_" >> include/config.h
598 echo "#define _CONFIG_H_" >> include/config.h
599 echo "" >> include/config.h
602 SDO_MAX_LENGTH_TRANSFERT\
603 SDO_MAX_SIMULTANEOUS_TRANSFERTS\
608 US_TO_TIMEVAL_FACTOR\
614 LSS_FS_TIMEOUT_MS; do
615 if [ "${!i}" = "" ]; then
616 echo "/* $i is not defined */" >> include/config.h
618 echo "#define $i ${!i}" >> include/config.h
621 echo "" >> include/config.h
624 SDO_MAX_SIMULTANEOUS_TRANSFERTS\
627 echo "#define REPEAT_"$i"_TIMES(repeat)\\">> include/config.h
630 for (( j=0; j<times; j++ ));do
631 result="$result repeat"
633 echo $result >> include/config.h
636 echo "#endif /* _CONFIG_H_ */" >> include/config.h
638 ###########################################################################
639 # DEBUG DEFINES/CFLAGS #
640 ###########################################################################
642 save_ifs="$IFS"; IFS=','
644 for DEBUG_METHOD in $DEBUG;
647 case $DEBUG_METHOD in
651 PDO)PDO=1;WAR=1;ERR=1;;
653 echo "$DEBUG_METHOD is not a valid debug's method"
654 echo "Possible Debug's methods are : \"ERR\", \"WAR\", \"MSG\", \"PDO\""
661 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_WAR_CONSOLE_ON;
665 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_ERR_CONSOLE_ON;
669 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_MSG_CONSOLE_ON;
673 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_PDO_CONSOLE_ON;
677 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -g
682 if [ "$DISABLE_OPT" = "1" ]; then
685 SUB_OPT_CFLAGS=\$\(OPT_CFLAGS\)
688 if [ "$DISABLE_DLL" = "1" ]; then
689 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DNOT_USE_DYNAMIC_LOADING
690 SUB_ENABLE_DLL_DRIVERS=0
692 SUB_ENABLE_DLL_DRIVERS=1
693 if [ "$SUB_TARGET" = "win32" ]; then
694 SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS
696 SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -ldl
702 if [ "$DISABLE_DLL" = "1" ]; then
703 SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ $SUB_CAN_DLL_CFLAGS
706 if [ $ENABLE_LSS ]; then
707 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DCO_ENABLE_LSS;
709 if [ $ENABLE_LSS_FS ]; then
710 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DCO_ENABLE_LSS_FS;
716 ###########################################################################
718 ###########################################################################
720 MAKEFILES=Makefile.in\
722 \ drivers/Makefile.in\
723 \ objdictgen/Makefile.in\
724 \ examples/Makefile.in\
725 \ objdictgen/canfestival_config.py.in
727 # Drivers dependent Makefiles
728 if [ "$SUB_TIMERS_DRIVER" != "" ]; then
729 MAKEFILES=$MAKEFILES\
730 \ drivers/timers_$SUB_TIMERS_DRIVER/Makefile.in
733 if [ "$SUB_CAN_DRIVER" != "" ]; then
734 MAKEFILES=$MAKEFILES\
735 \ drivers/can_$SUB_CAN_DRIVER/Makefile.in
738 # Target dependent Makefiles
739 MAKEFILES=$MAKEFILES\ drivers/$SUB_TARGET/Makefile.in
741 if [ "$SUB_TARGET" = "unix" -a "$SUB_TIMERS_DRIVER" = "kernel" ]; then
742 MAKEFILES=$MAKEFILES\
743 \ examples/kerneltest/Makefile.in
745 elif [ "$SUB_TARGET" = "unix" ]; then
746 MAKEFILES=$MAKEFILES\
747 \ examples/TestMasterSlave/Makefile.in\
748 \ examples/TestMasterSlaveLSS/Makefile.in\
749 \ examples/SillySlave/Makefile.in\
750 \ examples/TestMasterMicroMod/Makefile.in
753 if [ "$SUB_TARGET" = "win32" ]; then
754 MAKEFILES=$MAKEFILES\
755 \ examples/TestMasterSlave/Makefile.in\
756 \ examples/TestMasterSlaveLSS/Makefile.in\
757 \ examples/SillySlave/Makefile.in\
758 \ examples/TestMasterMicroMod/Makefile.in
761 if [ "$SUB_WX" = "1" ]; then
762 MAKEFILES=$MAKEFILES\
763 \ examples/DS401_Master/Makefile.in\
764 \ examples/DS401_Slave_Gui/Makefile.in
767 if [ "$SUB_TARGET" = "hcs12" ]; then
768 MAKEFILES=$MAKEFILES\
769 \ examples/gene_SYNC_HCS12/Makefile.in
772 for makefile_in in $MAKEFILES; do
773 makefile=`echo $makefile_in | sed 's:.in$::'`
774 echo "Creating $makefile"
779 s:SUB_PROG_CFLAGS:${SUB_PROG_CFLAGS}:
780 s:SUB_EXE_CFLAGS:${SUB_EXE_CFLAGS}:
781 s:SUB_KERNELDIR:${SUB_KERNELDIR}:
782 s:SUB_PREFIX:${SUB_PREFIX}:
783 s:SUB_OS_NAME:${SUB_OS_NAME}:
784 s:SUB_ARCH_NAME:${SUB_ARCH_NAME}:
785 s:SUB_OPT_CFLAGS:${SUB_OPT_CFLAGS}:
786 s:SUB_TARGET:${SUB_TARGET}:
787 s:SUB_BINUTILS_PREFIX:${SUB_BINUTILS_PREFIX}:
788 s:SUB_TIMERS_DRIVER:timers_${SUB_TIMERS_DRIVER}:
789 s:SUB_CAN_DRIVER:can_${SUB_CAN_DRIVER}:
790 s:SUB_CAN_DLL_CFLAGS:${SUB_CAN_DLL_CFLAGS}:
791 s:SUB_ENABLE_DLL_DRIVERS:${SUB_ENABLE_DLL_DRIVERS}:
792 s:SUB_ENABLE_LSS:${SUB_ENABLE_LSS}: