configure
changeset 400 7d845f5d730c
parent 398 c928fd8cb759
child 403 57d5da3b6228
equal deleted inserted replaced
399:8d22c323fe0f 400:7d845f5d730c
   255 fi
   255 fi
   256 
   256 
   257 ###########################################################################
   257 ###########################################################################
   258 #                      DEFAULT TARGET/DRIVERS GUESSING                    #
   258 #                      DEFAULT TARGET/DRIVERS GUESSING                    #
   259 ###########################################################################
   259 ###########################################################################
   260 # If target not specified, try to gess one
   260 # If target not specified, try to guess one
   261 if [ "$SUB_TARGET" = "" ]; then
   261 if [ "$SUB_TARGET" = "" ]; then
   262 	if [ "$SUB_OS_NAME" = "CYGWIN" ]; then
   262 	if [ "$SUB_OS_NAME" = "CYGWIN" ]; then
   263 		echo "Choosing unix (cygwin) target"
   263 		echo "Choosing unix (cygwin) target"
   264 		SUB_TARGET=unix
   264 		SUB_TARGET=unix
   265 	fi
   265 	fi
   271 		echo "Choosing windows target"
   271 		echo "Choosing windows target"
   272 		SUB_TARGET=win32
   272 		SUB_TARGET=win32
   273 	fi
   273 	fi
   274 fi
   274 fi
   275 
   275 
   276 # Try to gess can
   276 # Try to guess can
   277 if [ "$SUB_CAN_DRIVER" = "" ]; then
   277 if [ "$SUB_CAN_DRIVER" = "" ]; then
   278 	if [ "$SUB_TARGET" = "unix" ]; then
   278 	if [ "$SUB_TARGET" = "unix" ]; then
   279 		if [ -e /usr/lib/libpcan.so ]; then 
   279 		if [ -e /usr/lib/libpcan.so ]; then 
   280 			echo "Choosing installed Peak driver as CAN driver."
   280 			echo "Choosing installed Peak driver as CAN driver."
   281 			SUB_CAN_DRIVER=peak_linux
   281 			SUB_CAN_DRIVER=peak_linux
   282 		elif [ "$SUB_OS_NAME" = "CYGWIN" -a "PCAN_LIB" != "" ]; then
   282 		elif [ "$SUB_OS_NAME" = "CYGWIN" -a "PCAN_LIB" != "" ]; then
   283 			echo "Choosing installed Peak driver as CAN driver."
   283 			echo "Choosing installed Peak driver as CAN driver."
   284 			SUB_CAN_DRIVER=peak_win32		
   284 			SUB_CAN_DRIVER=peak_win32		
       
   285 		elif [ -e /usr/lib/libcanlib.so ]; then 
       
   286 			echo "Choosing installed Kvaser driver as CAN driver. (unix)"
       
   287 			SUB_CAN_DRIVER=kvaser
       
   288 		elif [ "$SUB_OS_NAME" = "CYGWIN" -a "$KVASER_DLL_PATH" != "" ]; then
       
   289 			echo "Choosing installed Kvaser driver as CAN driver. (cygwin)"
       
   290 			SUB_CAN_DRIVER=kvaser
   285 		else
   291 		else
   286 			echo "Choosing virtual CAN driver."
   292 			echo "Choosing virtual CAN driver."
   287 			SUB_CAN_DRIVER=virtual
   293 			SUB_CAN_DRIVER=virtual
   288 		fi
   294 		fi
   289 	fi
   295 	fi
   304 # Warn for unstalled peak driver if choosen
   310 # Warn for unstalled peak driver if choosen
   305 if [ "$SUB_CAN_DRIVER" = "peak" ]; then
   311 if [ "$SUB_CAN_DRIVER" = "peak" ]; then
   306 	if [ ! -e /usr/lib/libpcan.so ]; then 
   312 	if [ ! -e /usr/lib/libpcan.so ]; then 
   307 		echo "Peak driver hasn't been installed !"
   313 		echo "Peak driver hasn't been installed !"
   308 		exit -1
   314 		exit -1
       
   315 	fi
       
   316 fi
       
   317 
       
   318 # Warn for unstalled kvaser driver if choosen
       
   319 if [ "$SUB_CAN_DRIVER" = "kvaser" ]; then
       
   320 	if [ "$SUB_OS_NAME" = "CYGWIN" ]; then
       
   321         if [ ! -e "$KVASER_DLL_PATH/canlib32.dll" ]; then 
       
   322             echo "Kvaser driver hasn't been installed (cygwin)"
       
   323             exit -1
       
   324         fi
       
   325     elif  [ "$SUB_OS_NAME" = "LINUX" ]; then
       
   326         if [ ! -e /usr/lib/libcanlib.so ]; then 
       
   327             echo "Kvaser driver hasn't been installed (unix)"
       
   328             exit -1
       
   329         fi
   309 	fi
   330 	fi
   310 fi
   331 fi
   311 
   332 
   312 ###########################################################################
   333 ###########################################################################
   313 #              TARGET/DRIVER SPECIFIC CFLAGS and OPTIONS                  #
   334 #              TARGET/DRIVER SPECIFIC CFLAGS and OPTIONS                  #
   334 	fi
   355 	fi
   335 fi	
   356 fi	
   336 
   357 
   337 #### CAN_DRIVER ####
   358 #### CAN_DRIVER ####
   338 
   359 
       
   360 if [ "$SUB_CAN_DRIVER" = "kvaser" ]; then
       
   361 	if [ "$SUB_TARGET" = "unix" ]; then
       
   362         if  [ "$SUB_OS_NAME" = "LINUX" ]; then
       
   363             SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lcanlib
       
   364 		elif [ "$SUB_OS_NAME" = "CYGWIN" ]; then
       
   365 	        if [ "$KVASER_INCLUDE_PATH" = "" -o "$KVASER_DLL_PATH" = "" ]; then
       
   366 		        echo "!!! ERROR !!! Please set KVASER_DLL_PATH and KVASER_INCLUDE_PATH to appropriate paths ! "
       
   367             else
       
   368                 SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -L$KVASER_DLL_PATH\ -lcanlib32
       
   369                 SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -I$KVASER_INCLUDE_PATH
       
   370             fi
       
   371         fi
       
   372     fi        
       
   373 fi
       
   374 
   339 if [ "$SUB_CAN_DRIVER" = "peak_linux" ]; then
   375 if [ "$SUB_CAN_DRIVER" = "peak_linux" ]; then
   340     SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lpcan
   376     SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lpcan
   341 fi
   377 fi
   342 
   378 
   343 PW32DIR=drivers/can_peak_win32
   379 PW32DIR=drivers/can_peak_win32
   344 if [ "$SUB_CAN_DRIVER" = "peak_win32" ]; then
   380 if [ "$SUB_CAN_DRIVER" = "peak_win32" ]; then
   345 	if [ "$PCAN_HEADER" = "" -o "PCAN_LIB" = "" ]; then
   381 	if [ "$PCAN_HEADER" = "" -o "$PCAN_LIB" = "" ]; then
   346 		echo "!!! ERROR !!! Please set PCAN_LIB PCAN_HEADER [PCAN_INCLUDE] to appropriate paths ! "
   382 		echo "!!! ERROR !!! Please set PCAN_LIB PCAN_HEADER [PCAN_INCLUDE] to appropriate paths ! "
   347 	fi
   383 	fi
   348    	SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -liberty\ \'$PCAN_LIB\'
   384    	SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -liberty\ \'$PCAN_LIB\'
   349 	echo "Converting PcanLib header files for gcc -> $PW32DIR/cancfg.h"
   385 	echo "Converting PcanLib header files for gcc -> $PW32DIR/cancfg.h"
   350 	cat $PW32DIR/cancfg.h.head $PCAN_INCLUDE/$PCAN_HEADER > $PW32DIR/cancfg.h
   386 	cat $PW32DIR/cancfg.h.head $PCAN_INCLUDE/$PCAN_HEADER > $PW32DIR/cancfg.h
   691 
   727 
   692 elif [ "$SUB_TARGET" = "unix" ]; then
   728 elif [ "$SUB_TARGET" = "unix" ]; then
   693 	MAKEFILES=$MAKEFILES\
   729 	MAKEFILES=$MAKEFILES\
   694 \	examples/TestMasterSlave/Makefile.in\
   730 \	examples/TestMasterSlave/Makefile.in\
   695 \	examples/TestMasterSlaveLSS/Makefile.in\
   731 \	examples/TestMasterSlaveLSS/Makefile.in\
       
   732 \	examples/SillySlave/Makefile.in\
   696 \	examples/TestMasterMicroMod/Makefile.in
   733 \	examples/TestMasterMicroMod/Makefile.in
   697 fi
   734 fi
   698 
   735 
   699 if [ "$SUB_TARGET" = "win32" ]; then
   736 if [ "$SUB_TARGET" = "win32" ]; then
   700 	MAKEFILES=$MAKEFILES\
   737 	MAKEFILES=$MAKEFILES\
   701 \	examples/TestMasterSlave/Makefile.in\
   738 \	examples/TestMasterSlave/Makefile.in\
   702 \	examples/TestMasterSlaveLSS/Makefile.in\
   739 \	examples/TestMasterSlaveLSS/Makefile.in\
       
   740 \	examples/SillySlave/Makefile.in\
   703 \	examples/TestMasterMicroMod/Makefile.in
   741 \	examples/TestMasterMicroMod/Makefile.in
   704 fi
   742 fi
   705 
   743 
   706 if [ "$SUB_WX" = "1" ]; then
   744 if [ "$SUB_WX" = "1" ]; then
   707 	MAKEFILES=$MAKEFILES\
   745 	MAKEFILES=$MAKEFILES\