configure
changeset 145 e747d2e26af0
parent 93 16c8ceea8f18
child 166 b6fbc1c59a44
equal deleted inserted replaced
144:3ebf16150b2e 145:e747d2e26af0
    72 CC2=cc
    72 CC2=cc
    73 
    73 
    74 # Install prefix
    74 # Install prefix
    75 SUB_PREFIX=
    75 SUB_PREFIX=
    76 
    76 
    77 SUB_TIMERS_ENABLE=YES
       
    78 
       
    79 # Used for C compiler test/detection 
    77 # Used for C compiler test/detection 
    80 CFLAGS=
    78 CFLAGS=
    81 test=conftest
    79 test=conftest
    82 rm -f $test $test.c
    80 rm -f $test $test.c
    83 
    81 
    97 	--target=*)	SUB_TARGET=$optarg;;
    95 	--target=*)	SUB_TARGET=$optarg;;
    98 	--can=*)	SUB_CAN_DRIVER=$optarg;;
    96 	--can=*)	SUB_CAN_DRIVER=$optarg;;
    99 	--timers=*)	SUB_TIMERS_DRIVER=$optarg;;
    97 	--timers=*)	SUB_TIMERS_DRIVER=$optarg;;
   100 	--disable-Ox)	DISABLE_OPT=1;
    98 	--disable-Ox)	DISABLE_OPT=1;
   101 			echo "On user request: Won't optimize with \"-Ox\"";;
    99 			echo "On user request: Won't optimize with \"-Ox\"";;
       
   100 	--disable-dll)	DISABLE_DLL=1;
       
   101 			echo "On user request: Won't create and link to dll";;
   102 	--debug)	DEBUG=1;
   102 	--debug)	DEBUG=1;
   103 			echo "Debug messages enabled !!";;
   103 			echo "Debug messages enabled !!";;
   104 	--debugPDO)	DEBUG=PDO;
   104 	--debugPDO)	DEBUG=PDO;
   105 			echo "Debug messages (PDO) enabled !!";;
   105 			echo "Debug messages (PDO) enabled !!";;
   106 	--desable-timers)	SUB_TIMERS_ENABLE=NO;
       
   107 			echo "On user request: Will enable built-in timer dispatch Feature";;
       
   108 	--MAX_CAN_BUS_ID=*)	MAX_CAN_BUS_ID=$1;;
   106 	--MAX_CAN_BUS_ID=*)	MAX_CAN_BUS_ID=$1;;
   109 	--SDO_MAX_LENGTH_TRANSFERT=*)	SDO_MAX_LENGTH_TRANSFERT=$1;;
   107 	--SDO_MAX_LENGTH_TRANSFERT=*)	SDO_MAX_LENGTH_TRANSFERT=$1;;
   110 	--SDO_MAX_SIMULTANEOUS_TRANSFERTS=*)	SDO_MAX_SIMULTANEOUS_TRANSFERTS=$1;;
   108 	--SDO_MAX_SIMULTANEOUS_TRANSFERTS=*)	SDO_MAX_SIMULTANEOUS_TRANSFERTS=$1;;
   111 	--NMT_MAX_NODE_ID=*)	NMT_MAX_NODE_ID=$1;;
   109 	--NMT_MAX_NODE_ID=*)	NMT_MAX_NODE_ID=$1;;
   112 	--SDO_TIMEOUT_MS=*)	SDO_TIMEOUT_MS=$1;;
   110 	--SDO_TIMEOUT_MS=*)	SDO_TIMEOUT_MS=$1;;
   113 	--CANOPEN_BIG_ENDIAN=*)	CANOPEN_BIG_ENDIAN=$1;;
   111 	--CANOPEN_BIG_ENDIAN=*)	CANOPEN_BIG_ENDIAN=$1;;
   114 	--MAX_NB_TIMER=*) MAX_NB_TIMER=$1;;
   112 	--MAX_NB_TIMER=*) MAX_NB_TIMER=$1;;
   115 	--help)	echo	"Usage: ./configure [options]"
   113 	--help)	echo	"Usage: ./configure [options]"
   116     		echo	"Options:"
   114     		echo	"Options:"
   117     		echo 	" --cc=foo	Use compiler 'foo' instead of defaults ${CC1} or ${CC2}."
   115     		echo 	" --cc=foo      Use compiler 'foo' instead of defaults ${CC1} or ${CC2}."
   118 		echo 	" --arch=foo	Use architecture 'foo' instead of trying to autodetect."
   116 		echo 	" --arch=foo    Use architecture 'foo' instead of trying to autodetect."
   119 		echo 	" --os=foo	Use operative system 'foo' instead of trying to autodetect."
   117 		echo 	" --os=foo      Use operative system 'foo' instead of trying to autodetect."
   120 		echo 	" --prefix=foo	Use prefix 'foo' instead of default ${SUB_PREFIX}."
   118 		echo 	" --prefix=foo  Use prefix 'foo' instead of default ${SUB_PREFIX}."
   121 		echo 	" --target=foo	Use 'foo' as build target."
   119 		echo 	" --target=foo  Use 'foo' as build target."
   122 		echo	"		\"generic\" for have independant CAN and TIMERS driver"
   120 		echo	"               \"generic\" for have independant CAN and TIMERS driver"
   123 		echo	"		\"unix\" for unix-like systems"
   121 		echo	"               \"unix\" for unix-like systems"
   124 		echo	"		\"win32\" for win32 systems"
   122 		echo	"               \"win32\" for win32 systems"
   125 		echo	"		\"hcs12\" for HCS12 micro-controller"
   123 		echo	"               \"hcs12\" for HCS12 micro-controller"
   126 		echo 	" --can=foo	Use 'foo' as CAN driver (can be either 'peak', 'lincan' or 'virtual')"
   124 		echo	"               \"ecos_lpc2138_sja1000\" for eCOS + Philips ARM LPC21381 + Philips SJA1000" 
   127 		echo 	" --timers=foo	Use 'foo' as TIMERS driver (can be either 'unix' or 'xeno')"
   125 		echo 	" --can=foo	Use 'foo' as CAN driver"
   128 		echo	" --disable-Ox	Disable gcc \"-Ox\" optimizations."
   126 		echo	"               \"peak_linux\" use Linux build host installed Peak driver and library"
   129 		echo	" --debug	Enable debug messages."
   127 		echo	"                                please see http://www.peak-system.com/linux/"
   130 		echo	" --debugPDO	Enable debug messages, using PDO."
   128 		echo	"               \"peak_win32\" use win32 PcanLight Peak driver and library with Cygwin" 
       
   129 		echo	"                                please see http://www.peak-system.com/themen/download_gb.html"
       
   130 		echo	"               \"virtual\" use unix pipe based virtual can driver"
       
   131 		echo	"               \"socket\" use socket-can  "
       
   132 		echo	"                                please see http://developer.berlios.de/projects/socketcan/"
       
   133 		echo	"               \"lincan\" for HCS12 micro-controller"
       
   134 		echo	"                                please see http://www.ocera.org/download/components/WP7/lincan-0.3.3.html"
       
   135 		echo 	" --timers=foo  Use 'foo' as TIMERS driver (can be either 'unix' or 'xeno')"
       
   136 		echo 	" --disable-dll Disable run-time dynamic linking of can, led and nvram drivers"
       
   137 		echo	" --disable-Ox  Disable gcc \"-Ox\" optimizations."
       
   138 		echo	" --debug       Enable debug messages."
       
   139 		echo	" --debugPDO    Enable debug messages, using PDO."
   131 		echo
   140 		echo
   132 		echo	"Stack compilation constants"
   141 		echo	"Stack compilation constants"
   133 		echo	" --MAX_CAN_BUS_ID [=1] Number of can bus to use"
   142 		echo	" --MAX_CAN_BUS_ID [=1] Number of can bus to use"
   134 		echo	" --SDO_MAX_LENGTH_TRANSFERT [=32] max bytes to transmit by SDO"
   143 		echo	" --SDO_MAX_LENGTH_TRANSFERT [=32] max bytes to transmit by SDO"
   135 		echo	" --SDO_MAX_SIMULTANEOUS_TRANSFERTS [=4] Number of SDO that the node can manage concurrently"
   144 		echo	" --SDO_MAX_SIMULTANEOUS_TRANSFERTS [=4] Number of SDO that the node can manage concurrently"
   215 # sparc64
   224 # sparc64
   216 if [ "$A_NAME" = "sparc64" ]; then
   225 if [ "$A_NAME" = "sparc64" ]; then
   217 	SUB_ARCH_NAME=sparc64
   226 	SUB_ARCH_NAME=sparc64
   218 fi
   227 fi
   219 
   228 
   220 
       
   221 #
       
   222 # The following has not been verified
       
   223 #
       
   224 
       
   225 # ppc
   229 # ppc
   226 if [ "$A_NAME" = "powerpc" ]; then
   230 if [ "$A_NAME" = "powerpc" ]; then
   227 	SUB_ARCH_NAME=ppc
   231 	SUB_ARCH_NAME=ppc
   228 fi
   232 fi
   229 
   233 
   333 # Try to gess can
   337 # Try to gess can
   334 if [ "$SUB_CAN_DRIVER" = "" ]; then
   338 if [ "$SUB_CAN_DRIVER" = "" ]; then
   335 	if [ "$SUB_TARGET" = "unix" ]; then
   339 	if [ "$SUB_TARGET" = "unix" ]; then
   336 		if [ -e /usr/lib/libpcan.so ]; then 
   340 		if [ -e /usr/lib/libpcan.so ]; then 
   337 			echo "Choosing installed Peak driver as CAN driver."
   341 			echo "Choosing installed Peak driver as CAN driver."
   338 			SUB_CAN_DRIVER=peak
   342 			SUB_CAN_DRIVER=peak_linux
       
   343 		elif [ "$SUB_OS_NAME" = "CYGWIN" -a "PCAN_LIB" != "" ]; then
       
   344 			echo "Choosing installed Peak driver as CAN driver."
       
   345 			SUB_CAN_DRIVER=peak_win32		
   339 		else
   346 		else
   340 			echo "Choosing virtual CAN driver."
   347 			echo "Choosing virtual CAN driver."
   341 			SUB_CAN_DRIVER=virtual
   348 			SUB_CAN_DRIVER=virtual
   342 		fi
   349 		fi
   343 	fi
       
   344 	if [ "$SUB_TARGET" = "win32" ]; then
       
   345 		echo "CAN driver for windows --Not Implemented--"
       
   346 	fi
   350 	fi
   347 fi
   351 fi
   348 
   352 
   349 # If target is unix, default timers also
   353 # If target is unix, default timers also
   350 if [ "$SUB_TARGET" = "unix" -a "$SUB_TIMERS_DRIVER" = "" ]; then
   354 if [ "$SUB_TARGET" = "unix" -a "$SUB_TIMERS_DRIVER" = "" ]; then
   397 	fi
   401 	fi
   398 fi	
   402 fi	
   399 
   403 
   400 #### CAN_DRIVER ####
   404 #### CAN_DRIVER ####
   401 
   405 
   402 if [ "$SUB_CAN_DRIVER" = "peak" ]; then
   406 if [ "$SUB_CAN_DRIVER" = "peak_linux" ]; then
   403     if [ "$SUB_TIMERS_DRIVER" = "xeno" ]; then
   407     SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lpcan
   404     	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lrtdm
   408 fi
   405     fi
   409 
   406     SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lpcan
   410 PW32DIR=drivers/can_peak_win32
   407 fi
       
   408 
       
   409 if [ "$SUB_CAN_DRIVER" = "peak_win32" ]; then
   411 if [ "$SUB_CAN_DRIVER" = "peak_win32" ]; then
   410 	if [ "$PCAN_HEADER" = "" -o "PCAN_LIB" = "" ]; then
   412 	if [ "$PCAN_HEADER" = "" -o "PCAN_LIB" = "" ]; then
   411 		echo "!!! ERROR !!! Please set PCAN_LIB PCAN_HEADER [PCAN_INCLUDE] to appropriate paths ! "
   413 		echo "!!! ERROR !!! Please set PCAN_LIB PCAN_HEADER [PCAN_INCLUDE] to appropriate paths ! "
   412 	fi
   414 	fi
   413    	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -liberty\ \'$PCAN_LIB\'
   415    	SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -liberty\ \'$PCAN_LIB\'
   414 	echo "Converting PcanLib header files for gcc -> /drivers/can_peak_win32/cancfg.h"
   416 	echo "Converting PcanLib header files for gcc -> $PW32DIR/cancfg.h"
   415 	cat include/can_peak_win32/cancfg.h.head $PCAN_INCLUDE/$PCAN_HEADER > include/can_peak_win32/cancfg.h
   417 	cat $PW32DIR/cancfg.h.head $PCAN_INCLUDE/$PCAN_HEADER > $PW32DIR/cancfg.h
   416 	# second port handling
   418 	# second port handling
   417 	if [ "$PCAN2_HEADER" != "" ]; then
   419 	if [ "$PCAN2_HEADER" != "" ]; then
   418 		echo "Stripping down second Pcan Light header "
   420 		echo "Stripping down second Pcan Light header "
   419 		echo >> include/can_peak_win32/cancfg.h
   421 		echo >> $PW32DIR/cancfg.h
   420 		echo "// Stripped PcanLight header to prevent typedef conflicts ">> include/can_peak_win32/cancfg.h
   422 		echo "// Stripped PcanLight header to prevent typedef conflicts ">> $PW32DIR/cancfg.h
   421 		echo >> include/can_peak_win32/cancfg.h
   423 		echo >> $PW32DIR/cancfg.h
   422 		grep __stdcall $PCAN_INCLUDE/$PCAN2_HEADER >> include/can_peak_win32/cancfg.h
   424 		grep __stdcall $PCAN_INCLUDE/$PCAN2_HEADER >> $PW32DIR/cancfg.h
   423 	   	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ \'$PCAN2_LIB\'
   425 		echo '#define PCAN2_HEADER_' >> $PW32DIR/cancfg.h
   424 		echo '#define PCAN2_HEADER_' >> include/can_peak_win32/cancfg.h
   426 	   	SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ \'$PCAN2_LIB\'
   425 	fi
   427 	fi
   426 	if grep -q CANHwType include/can_peak_win32/cancfg.h ; then
   428 	if grep -q CANHwType $PW32DIR/cancfg.h ; then
   427 		echo "Peak Init HwType, IO_Port and IRQ will be passed in environment :"
   429 		echo "Peak Init HwType, IO_Port and IRQ will be passed in environment :"
   428 		echo "	PCANHwType PCANIO_Port PCANInterupt"
   430 		echo "	PCANHwType PCANIO_Port PCANInterupt"
   429 		echo '#define extra_PCAN_init_params' >> include/can_peak_win32/cancfg.h
   431 		echo '#define extra_PCAN_init_params' >> $PW32DIR/cancfg.h
   430 	fi
   432 	fi
   431 	cat include/can_peak_win32/cancfg.h.tail >> include/can_peak_win32/cancfg.h
   433 	cat $PW32DIR/cancfg.h.tail >> $PW32DIR/cancfg.h
   432 fi
   434 fi
   433 
   435 
   434 if [ "$SUB_CAN_DRIVER" = "none" ]; then
   436 if [ "$SUB_CAN_DRIVER" = "none" ]; then
   435 	SUB_CAN_DRIVER=
   437 	SUB_CAN_DRIVER=
   436 fi
   438 fi
   601 	SUB_OPT_CFLAGS=
   603 	SUB_OPT_CFLAGS=
   602 else
   604 else
   603 	SUB_OPT_CFLAGS=\$\(OPT_CFLAGS\)
   605 	SUB_OPT_CFLAGS=\$\(OPT_CFLAGS\)
   604 fi
   606 fi
   605 
   607 
       
   608 if [ "$DISABLE_DLL" = "1" ]; then
       
   609 	SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DNOT_USE_DYNAMIC_LOADING
       
   610 	SUB_ENABLE_DLL_DRIVERS=0
       
   611 else
       
   612 	SUB_ENABLE_DLL_DRIVERS=1
       
   613 	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -ldl
       
   614 fi
       
   615 
       
   616 
       
   617 if [ "$DISABLE_DLL" = "1" ]; then
       
   618 	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ $SUB_CAN_DLL_CFLAGS
       
   619 fi
       
   620 
   606 ###########################################################################
   621 ###########################################################################
   607 #                              CREATE MAKEFILES                           #
   622 #                              CREATE MAKEFILES                           #
   608 ###########################################################################
   623 ###########################################################################
   609 # General Makefiles
   624 # General Makefiles
   610 MAKEFILES=Makefile.in\
   625 MAKEFILES=Makefile.in\
   648 	s:SUB_OS_NAME:${SUB_OS_NAME}:
   663 	s:SUB_OS_NAME:${SUB_OS_NAME}:
   649 	s:SUB_ARCH_NAME:${SUB_ARCH_NAME}:
   664 	s:SUB_ARCH_NAME:${SUB_ARCH_NAME}:
   650 	s:SUB_OPT_CFLAGS:${SUB_OPT_CFLAGS}:
   665 	s:SUB_OPT_CFLAGS:${SUB_OPT_CFLAGS}:
   651 	s:SUB_TARGET:${SUB_TARGET}:
   666 	s:SUB_TARGET:${SUB_TARGET}:
   652 	s:SUB_BINUTILS_PREFIX:${SUB_BINUTILS_PREFIX}:
   667 	s:SUB_BINUTILS_PREFIX:${SUB_BINUTILS_PREFIX}:
   653 	s:SUB_TIMERS_ENABLE:${SUB_TIMERS_ENABLE}:
       
   654 	s:SUB_TIMERS_DRIVER:timers_${SUB_TIMERS_DRIVER}:
   668 	s:SUB_TIMERS_DRIVER:timers_${SUB_TIMERS_DRIVER}:
   655 	s:SUB_CAN_DRIVER:can_${SUB_CAN_DRIVER}:
   669 	s:SUB_CAN_DRIVER:can_${SUB_CAN_DRIVER}:
       
   670 	s:SUB_CAN_DLL_CFLAGS:${SUB_CAN_DLL_CFLAGS}:
       
   671 	s:SUB_ENABLE_DLL_DRIVERS:${SUB_ENABLE_DLL_DRIVERS}:
   656 	" > $makefile
   672 	" > $makefile
   657 done
   673 done
   658 
   674 
   659 echo "All done."
   675 echo "All done."