1 #!/bin/bash |
1 #!/bin/bash |
2 |
2 |
3 # |
3 # |
4 # Copyright (C) 2004 Edouard TISSERRANT, Laurent BESSARD |
4 # Copyright (C) 2004 Edouard TISSERRANT, Laurent BESSARD |
5 # Based on Gabriel Gerhardsson's cacheprobe configure script. |
5 # Based on Gabriel Gerhardsson's cacheprobe configure script. |
6 # |
6 # |
7 # This file is part of CanFestival, a library implementing CanOpen Stack. |
7 # This file is part of CanFestival, a library implementing CanOpen Stack. |
8 # |
8 # |
9 # This library is free software; you can redistribute it and/or |
9 # This library is free software; you can redistribute it and/or |
10 # modify it under the terms of the GNU Lesser General Public |
10 # modify it under the terms of the GNU Lesser General Public |
11 # License as published by the Free Software Foundation; either |
11 # License as published by the Free Software Foundation; either |
12 # version 2.1 of the License, or (at your option) any later version. |
12 # version 2.1 of the License, or (at your option) any later version. |
13 # |
13 # |
14 # This library is distributed in the hope that it will be useful, |
14 # This library is distributed in the hope that it will be useful, |
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 # Lesser General Public License for more details. |
17 # Lesser General Public License for more details. |
18 # |
18 # |
19 # You should have received a copy of the GNU Lesser General Public |
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 |
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 |
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 # |
22 # |
23 |
23 |
24 ########################################################################### |
24 ########################################################################### |
25 # DEFAULT CANFESTIVAL DEFINES # |
25 # DEFAULT CANFESTIVAL DEFINES # |
26 ########################################################################### |
26 ########################################################################### |
27 |
27 |
28 # Number of can bus to use |
28 # Number of can bus to use |
29 MAX_CAN_BUS_ID=1 |
29 MAX_CAN_BUS_ID=1 |
30 |
30 |
31 # max bytes to transmit by SDO Put 4 if you only support expedited transfert. |
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. |
32 #For a normal transfert, (usually for a string), put the maximum string size to transfer. |
33 SDO_MAX_LENGTH_TRANSFERT=32 |
33 SDO_MAX_LENGTH_TRANSFERT=32 |
34 |
34 |
35 # Number of SDO from differents nodes that the node can manage concurrently. |
35 # Number of SDO from differents nodes that the node can manage concurrently. |
36 #for a slave node, usually put 1. |
36 #for a slave node, usually put 1. |
37 SDO_MAX_SIMULTANEOUS_TRANSFERTS=4 |
37 SDO_MAX_SIMULTANEOUS_TRANSFERTS=4 |
38 |
38 |
39 # Used for NMTable[bus][nodeId] |
39 # Used for NMTable[bus][nodeId] |
40 # You can put less of 128 if on the netwo |
40 # You can put less of 128 if on the netwo |
41 # are connected only smaller nodeId node. |
41 # are connected only smaller nodeId node. |
42 NMT_MAX_NODE_ID=128 |
42 NMT_MAX_NODE_ID=128 |
43 |
43 |
44 #Timeout in milliseconds for SDO. |
44 #Timeout in milliseconds for SDO. |
143 echo " --target=foo Use 'foo' as build target." |
143 echo " --target=foo Use 'foo' as build target." |
144 echo " \"unix\" for unix-like systems (Linux, Cygwin)" |
144 echo " \"unix\" for unix-like systems (Linux, Cygwin)" |
145 echo " \"win32\" for win32 systems (native, mingw or VC++)" |
145 echo " \"win32\" for win32 systems (native, mingw or VC++)" |
146 echo " \"hcs12\" for HCS12 micro-controller" |
146 echo " \"hcs12\" for HCS12 micro-controller" |
147 echo " --can=foo Use 'foo' as CAN driver" |
147 echo " --can=foo Use 'foo' as CAN driver" |
148 echo " \"anagate_linux\" use AnaGate CAN(duo) driver for linux" |
148 echo " \"anagate_linux\" use AnaGate CAN(duo) driver for linux" |
149 echo " \"anagate_win32\" use AnaGate CAN(duo) driver for win32" |
149 echo " \"anagate_win32\" use AnaGate CAN(duo) driver for win32" |
150 echo " \"peak_linux\" use Linux build host installed Peak driver and library" |
150 echo " \"peak_linux\" use Linux build host installed Peak driver and library" |
151 echo " see http://www.peak-system.com/linux/" |
151 echo " see http://www.peak-system.com/linux/" |
152 echo " \"peak_win32\" use win32 PcanLight Peak driver and library with Cygwin" |
152 echo " \"peak_win32\" use win32 PcanLight Peak driver and library with Cygwin" |
153 echo " see http://www.peak-system.com/themen/download_gb.html" |
153 echo " see http://www.peak-system.com/themen/download_gb.html" |
154 echo " \"virtual\" use unix pipe based virtual can driver" |
154 echo " \"virtual\" use unix pipe based virtual can driver" |
155 echo " \"virtual_kernel\" use kernel module virtual can driver" |
155 echo " \"virtual_kernel\" use kernel module virtual can driver" |
156 echo " \"socket\" use socket-can " |
156 echo " \"socket\" use socket-can " |
157 echo " see http://developer.berlios.de/projects/socketcan/" |
157 echo " see http://developer.berlios.de/projects/socketcan/" |
158 echo " \"lincan\" lincan driver" |
158 echo " \"lincan\" lincan driver" |
159 echo " see http://www.ocera.org/download/components/WP7/lincan-0.3.3.html" |
159 echo " see http://www.ocera.org/download/components/WP7/lincan-0.3.3.html" |
160 echo " \"can4linux\" can4linux driver" |
160 echo " \"can4linux\" can4linux driver" |
161 echo " see http://www.port.de/engl/canprod/hw_can4linux.html" |
161 echo " see http://www.port.de/engl/canprod/hw_can4linux.html" |
162 echo " --timers=foo Use 'foo' as TIMERS driver (can be 'unix', 'xeno', 'rtai' or 'kernel')" |
162 echo " \"copcican_linux\" user space driver interface for CO-PCICAN card" |
|
163 echo " see http://www.cosateq.com/" |
|
164 echo " \"copcican_comedi\" COMEDI driver interface for CO-PCICAN card" |
|
165 echo " see http://www.cosateq.com/" |
|
166 echo " --timers=foo Use 'foo' as TIMERS driver (can be 'unix', 'xeno', 'rtai', 'kernel' or 'kernel_xeno')" |
163 echo " --wx=foo Force result of WxWidgets detection (0 or 1)" |
167 echo " --wx=foo Force result of WxWidgets detection (0 or 1)" |
164 echo " --binutils=path Override binutils path detection (as regards \$CC content)" |
168 echo " --binutils=path Override binutils path detection (as regards \$CC content)" |
165 echo " --disable-dll Disable run-time dynamic linking of can, led and nvram drivers" |
169 echo " --disable-dll Disable run-time dynamic linking of can, led and nvram drivers" |
166 echo " --enable-lss Enable the LSS services" |
170 echo " --enable-lss Enable the LSS services" |
167 echo " --enable-lss-fs Enable the LSS FastScan service" |
171 echo " --enable-lss-fs Enable the LSS FastScan service" |
271 fi |
275 fi |
272 |
276 |
273 # Try to guess can |
277 # Try to guess can |
274 if [ "$SUB_CAN_DRIVER" = "" ]; then |
278 if [ "$SUB_CAN_DRIVER" = "" ]; then |
275 if [ "$SUB_TARGET" = "unix" ]; then |
279 if [ "$SUB_TARGET" = "unix" ]; then |
276 if [ -e /usr/lib/libpcan.so ]; then |
280 if [ -e /usr/lib/libpcan.so ]; then |
277 echo "Choosing installed Peak driver as CAN driver." |
281 echo "Choosing installed Peak driver as CAN driver." |
278 SUB_CAN_DRIVER=peak_linux |
282 SUB_CAN_DRIVER=peak_linux |
279 elif [ "$SUB_OS_NAME" = "CYGWIN" -a "PCAN_LIB" != "" ]; then |
283 elif [ "$SUB_OS_NAME" = "CYGWIN" -a "PCAN_LIB" != "" ]; then |
280 echo "Choosing installed Peak driver as CAN driver." |
284 echo "Choosing installed Peak driver as CAN driver." |
281 SUB_CAN_DRIVER=peak_win32 |
285 SUB_CAN_DRIVER=peak_win32 |
282 elif [ -e /usr/lib/libcanlib.so ]; then |
286 elif [ -e /usr/lib/libcanlib.so ]; then |
283 echo "Choosing installed Kvaser driver as CAN driver. (unix)" |
287 echo "Choosing installed Kvaser driver as CAN driver. (unix)" |
284 SUB_CAN_DRIVER=kvaser |
288 SUB_CAN_DRIVER=kvaser |
285 elif [ -e /usr/local/lib/libAnaGateAPIDLL.so ]; then |
289 elif [ -e /usr/local/lib/libAnaGateAPIDLL.so ]; then |
286 echo "Choosing installed AnaGate driver as CAN driver. (unix)" |
290 echo "Choosing installed AnaGate driver as CAN driver. (unix)" |
287 SUB_CAN_DRIVER=anagate_linux |
291 SUB_CAN_DRIVER=anagate_linux |
|
292 elif [ -e /usr/local/lib/libcanfestival_can_copcican_linux.so ]; then |
|
293 echo "Choosing installed CO-PCICAN driver as CAN driver. (unix)" |
|
294 SUB_CAN_DRIVER=copcican_linux |
|
295 elif [ -e /usr/local/lib/libcanfestival_can_copcican_comedi.so ]; then |
|
296 echo "Choosing installed CO-PCICAN driver as CAN driver. (unix)" |
|
297 SUB_CAN_DRIVER=copcican_comedi |
288 elif [ "$SUB_OS_NAME" = "CYGWIN" -a "$KVASER_DLL_PATH" != "" ]; then |
298 elif [ "$SUB_OS_NAME" = "CYGWIN" -a "$KVASER_DLL_PATH" != "" ]; then |
289 echo "Choosing installed Kvaser driver as CAN driver. (cygwin)" |
299 echo "Choosing installed Kvaser driver as CAN driver. (cygwin)" |
290 SUB_CAN_DRIVER=kvaser |
300 SUB_CAN_DRIVER=kvaser |
291 else |
301 else |
292 echo "Choosing virtual CAN driver." |
302 echo "Choosing virtual CAN driver." |
307 SUB_TIMERS_DRIVER=win32 |
317 SUB_TIMERS_DRIVER=win32 |
308 fi |
318 fi |
309 |
319 |
310 # Warn for unstalled peak driver if choosen |
320 # Warn for unstalled peak driver if choosen |
311 if [ "$SUB_CAN_DRIVER" = "peak" ]; then |
321 if [ "$SUB_CAN_DRIVER" = "peak" ]; then |
312 if [ ! -e /usr/lib/libpcan.so ]; then |
322 if [ ! -e /usr/lib/libpcan.so ]; then |
313 echo "Peak driver hasn't been installed !" |
323 echo "Peak driver hasn't been installed !" |
314 exit -1 |
324 exit -1 |
315 fi |
325 fi |
316 fi |
326 fi |
317 |
327 |
318 # Warn for unstalled peak driver if choosen |
328 # Warn for unstalled peak driver if choosen |
319 if [ "$SUB_CAN_DRIVER" = "anagate_linux" ]; then |
329 if [ "$SUB_CAN_DRIVER" = "anagate_linux" ]; then |
320 if [ ! -e /usr/local/lib/libAnaGateAPIDLL.so ]; then |
330 if [ ! -e /usr/local/lib/libAnaGateAPIDLL.so ]; then |
321 echo "AnaGateCAN driver hasn't been installed !" |
331 echo "AnaGateCAN driver hasn't been installed !" |
|
332 exit -1 |
|
333 fi |
|
334 fi |
|
335 |
|
336 # Warn for unstalled CO-PCICAN driver if choosen |
|
337 if [ "$SUB_CAN_DRIVER" = "copcican_linux" ]; then |
|
338 if [ ! -e /usr/local/lib/libcanfestival_can_copcican_linux.so ]; then |
|
339 echo "CO-PCICAN driver hasn't been installed !" |
322 exit -1 |
340 exit -1 |
323 fi |
341 fi |
324 fi |
342 fi |
325 |
343 |
326 # Warn for unstalled kvaser driver if choosen |
344 # Warn for unstalled kvaser driver if choosen |
327 if [ "$SUB_CAN_DRIVER" = "kvaser" ]; then |
345 if [ "$SUB_CAN_DRIVER" = "kvaser" ]; then |
328 if [ "$SUB_OS_NAME" = "CYGWIN" ]; then |
346 if [ "$SUB_OS_NAME" = "CYGWIN" ]; then |
329 if [ ! -e "$KVASER_DLL_PATH/canlib32.dll" ]; then |
347 if [ ! -e "$KVASER_DLL_PATH/canlib32.dll" ]; then |
330 echo "Kvaser driver hasn't been installed (cygwin)" |
348 echo "Kvaser driver hasn't been installed (cygwin)" |
331 exit -1 |
349 exit -1 |
332 fi |
350 fi |
333 elif [ "$SUB_OS_NAME" = "LINUX" ]; then |
351 elif [ "$SUB_OS_NAME" = "LINUX" ]; then |
334 if [ ! -e /usr/lib/libcanlib.so ]; then |
352 if [ ! -e /usr/lib/libcanlib.so ]; then |
335 echo "Kvaser driver hasn't been installed (unix)" |
353 echo "Kvaser driver hasn't been installed (unix)" |
336 exit -1 |
354 exit -1 |
337 fi |
355 fi |
338 fi |
356 fi |
339 fi |
357 fi |
346 # it is a big endian architecture. |
364 # it is a big endian architecture. |
347 CANOPEN_BIG_ENDIAN=1 |
365 CANOPEN_BIG_ENDIAN=1 |
348 # search for gcc hcs12 compiler m6811-elf-gcc or m68hc12-gcc ? |
366 # search for gcc hcs12 compiler m6811-elf-gcc or m68hc12-gcc ? |
349 if [ "$CC" = "" ]; then |
367 if [ "$CC" = "" ]; then |
350 which m6811-elf-gcc >/dev/null 2>&1 |
368 which m6811-elf-gcc >/dev/null 2>&1 |
351 if (( $? )); then |
369 if (( $? )); then |
352 which m68hc12-gcc >/dev/null 2>&1 |
370 which m68hc12-gcc >/dev/null 2>&1 |
353 if (( $? )); then |
371 if (( $? )); then |
354 echo "Please use --cc flag to specify compiler" |
372 echo "Please use --cc flag to specify compiler" |
355 exit 0 |
373 exit 0 |
356 else |
374 else |
357 CC=m68hc12-gcc |
375 CC=m68hc12-gcc |
358 fi |
376 fi |
359 else |
377 else |
360 CC=m6811-elf-gcc |
378 CC=m6811-elf-gcc |
361 SUB_PROG_CFLAGS=-m68hc12 |
379 SUB_PROG_CFLAGS=-m68hc12 |
362 fi |
380 fi |
363 fi |
381 fi |
364 fi |
382 fi |
365 |
383 |
366 #### CAN_DRIVER #### |
384 #### CAN_DRIVER #### |
367 |
385 |
368 if [ "$SUB_CAN_DRIVER" = "kvaser" ]; then |
386 if [ "$SUB_CAN_DRIVER" = "kvaser" ]; then |
369 if [ "$SUB_TARGET" = "unix" ]; then |
387 if [ "$SUB_TARGET" = "unix" ]; then |
467 # use directory of current kernel |
485 # use directory of current kernel |
468 SUB_KERNELDIR=/lib/modules/$(uname -r)/build |
486 SUB_KERNELDIR=/lib/modules/$(uname -r)/build |
469 fi |
487 fi |
470 fi |
488 fi |
471 |
489 |
|
490 if [ "$SUB_TIMERS_DRIVER" = "kernel_xeno" ]; then |
|
491 DISABLE_DLL=1 |
|
492 if [ "$SUB_KERNELDIR" = "" ]; then |
|
493 # use directory of current kernel |
|
494 SUB_KERNELDIR=/lib/modules/$(uname -r)/build |
|
495 fi |
|
496 |
|
497 # Also get the xenomai config |
|
498 RT_LIB_DIR=`$XENO_CONFIG --library-dir`\ -Wl,-rpath\ `$XENO_CONFIG --library-dir` |
|
499 SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ `$XENO_CONFIG --xeno-ldflags`\ -L$RT_LIB_DIR\ -lnative\ -lrtdm |
|
500 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DUSE_XENO\ `$XENO_CONFIG --xeno-cflags` |
|
501 RTCAN_SOCKET=1 |
|
502 fi |
|
503 |
472 if [ "$SUB_TIMERS_DRIVER" = "none" ]; then |
504 if [ "$SUB_TIMERS_DRIVER" = "none" ]; then |
473 SUB_TIMERS_DRIVER= |
505 SUB_TIMERS_DRIVER= |
474 fi |
506 fi |
475 |
507 |
476 ########################################################################### |
508 ########################################################################### |
549 echo "Using ${LD} as a linker" |
581 echo "Using ${LD} as a linker" |
550 |
582 |
551 # Guess prefix as regard cross compiling target machine |
583 # Guess prefix as regard cross compiling target machine |
552 if [ "$SUB_PREFIX" = "" ]; then |
584 if [ "$SUB_PREFIX" = "" ]; then |
553 $CC -dumpspecs |grep -A 1 'cross_compile'|grep -q 1 |
585 $CC -dumpspecs |grep -A 1 'cross_compile'|grep -q 1 |
554 if (( $? )); then |
586 if (( $? )); then |
555 SUB_PREFIX=/usr/local |
587 SUB_PREFIX=/usr/local |
556 echo "Not cross-compiling. Will install in $SUB_PREFIX"; |
588 echo "Not cross-compiling. Will install in $SUB_PREFIX"; |
557 else |
589 else |
558 SUB_PREFIX=/usr/`$CC -dumpmachine | tr -d '\r\n'` |
590 SUB_PREFIX=/usr/`$CC -dumpmachine | tr -d '\r\n'` |
559 echo "This is a cross-compiler. Will install in $SUB_PREFIX"; |
591 echo "This is a cross-compiler. Will install in $SUB_PREFIX"; |
560 fi |
592 fi |
561 fi |
593 fi |
562 |
594 |
563 echo "Using prefix: ${SUB_PREFIX}" |
595 echo "Using prefix: ${SUB_PREFIX}" |
564 |
596 |
765 MAKEFILES=$MAKEFILES\ drivers/$SUB_TARGET/Makefile.in |
797 MAKEFILES=$MAKEFILES\ drivers/$SUB_TARGET/Makefile.in |
766 fi |
798 fi |
767 |
799 |
768 if [ "$SUB_TARGET" = "unix" -a "$SUB_TIMERS_DRIVER" = "kernel" ]; then |
800 if [ "$SUB_TARGET" = "unix" -a "$SUB_TIMERS_DRIVER" = "kernel" ]; then |
769 MAKEFILES=$MAKEFILES\ |
801 MAKEFILES=$MAKEFILES\ |
770 \ examples/kerneltest/Makefile.in |
802 \ examples/kerneltest/Makefile.in\ |
|
803 \ examples/test_copcican_comedi/Makefile.in |
|
804 |
|
805 elif [ "$SUB_TARGET" = "unix" -a "$SUB_TIMERS_DRIVER" = "kernel_xeno" ]; then |
|
806 MAKEFILES=$MAKEFILES\ |
|
807 \ examples/kerneltest/Makefile.in\ |
|
808 \ examples/test_copcican_comedi/Makefile.in |
771 |
809 |
772 elif [ "$SUB_TARGET" = "unix" ]; then |
810 elif [ "$SUB_TARGET" = "unix" ]; then |
773 MAKEFILES=$MAKEFILES\ |
811 MAKEFILES=$MAKEFILES\ |
774 \ examples/CANOpenShell/Makefile.in\ |
812 \ examples/CANOpenShell/Makefile.in\ |
775 \ examples/TestMasterSlave/Makefile.in\ |
813 \ examples/TestMasterSlave/Makefile.in\ |
776 \ examples/TestMasterSlaveLSS/Makefile.in\ |
814 \ examples/TestMasterSlaveLSS/Makefile.in\ |
777 \ examples/SillySlave/Makefile.in\ |
815 \ examples/SillySlave/Makefile.in\ |
778 \ examples/TestMasterMicroMod/Makefile.in |
816 \ examples/TestMasterMicroMod/Makefile.in\ |
|
817 \ examples/test_copcican_linux/Makefile.in |
779 fi |
818 fi |
780 |
819 |
781 if [ "$SUB_TARGET" = "win32" ]; then |
820 if [ "$SUB_TARGET" = "win32" ]; then |
782 MAKEFILES=$MAKEFILES\ |
821 MAKEFILES=$MAKEFILES\ |
783 \ examples/CANOpenShell/Makefile.in\ |
822 \ examples/CANOpenShell/Makefile.in\ |