configure
changeset 354 396ac66670ad
parent 351 fb106ad03770
child 360 09af3515dd42
equal deleted inserted replaced
353:ee08ce0366a7 354:396ac66670ad
    62 #                             DEFAULT BUILD OPTIONS                       #
    62 #                             DEFAULT BUILD OPTIONS                       #
    63 ###########################################################################
    63 ###########################################################################
    64 
    64 
    65 # Leave empty for automatic detection
    65 # Leave empty for automatic detection
    66 CC=
    66 CC=
    67 CXX=g++
    67 CXX=
    68 LD=ld
    68 LD=
    69 
    69 
    70 #default target
    70 #default target
    71 SUB_TARGET=
    71 SUB_TARGET=
    72 
    72 
    73 # First compiler option - we will check if it exists
    73 # First compiler option - we will check if it exists
   305 			SUB_PROG_CFLAGS=-m68hc12
   305 			SUB_PROG_CFLAGS=-m68hc12
   306 		fi
   306 		fi
   307 	fi
   307 	fi
   308 fi	
   308 fi	
   309 
   309 
   310 if [ "$SUB_TARGET" = "win32" ]; then
       
   311 		LD=g++
       
   312 		SUB_PROG_CFLAGS="-mno-cygwin"
       
   313 fi	
       
   314 
       
   315 if [ "$SUB_TARGET" = "unix" ]; then
       
   316 		LD=gcc
       
   317 fi
       
   318 	
       
   319 #### CAN_DRIVER ####
   310 #### CAN_DRIVER ####
   320 
   311 
   321 if [ "$SUB_CAN_DRIVER" = "peak_linux" ]; then
   312 if [ "$SUB_CAN_DRIVER" = "peak_linux" ]; then
   322     SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lpcan
   313     SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lpcan
   323 fi
   314 fi
   378 if [ "$SUB_TIMERS_DRIVER" = "none" ]; then
   369 if [ "$SUB_TIMERS_DRIVER" = "none" ]; then
   379 	SUB_TIMERS_DRIVER=
   370 	SUB_TIMERS_DRIVER=
   380 fi
   371 fi
   381 
   372 
   382 ###########################################################################
   373 ###########################################################################
   383 #                              GUESS COMPILER                             #
   374 #                              GUESS TOOLCHAIN                            #
   384 ###########################################################################
   375 ###########################################################################
   385 # If CC is empty, the user wanted automatic detection
   376 # If CC is empty, the user wanted automatic detection
   386 if [ "$CC" = "" ]; then
   377 if [ "$CC" = "" ]; then
   387 	# Check for second compiler, CC2
   378 	# Check for second compiler, CC2
   388 	cat > $test.c <<EOF
   379 	cat > $test.c <<EOF
   414 	echo "Error: Could not find a C compiler"
   405 	echo "Error: Could not find a C compiler"
   415 	echo "Please supply the wanted compiler"
   406 	echo "Please supply the wanted compiler"
   416 	exit -1
   407 	exit -1
   417 fi
   408 fi
   418 
   409 
   419 echo "Using ${CC}"
   410 echo "Using ${CC} as a C compiler"
   420 
       
   421 ###########################################################################
       
   422 #                              GUESS PREFIX's                             #
       
   423 ###########################################################################
       
   424 
   411 
   425 SUB_BINUTILS_PREFIX=`echo "$CC" | sed 's/gcc$//'`
   412 SUB_BINUTILS_PREFIX=`echo "$CC" | sed 's/gcc$//'`
       
   413 
       
   414 if [ "$CXX" = "" ]; then
       
   415 	CXX=${SUB_BINUTILS_PREFIX}g++
       
   416 fi
       
   417 
       
   418 echo "Using ${CXX} as a C++ compiler"
       
   419 
       
   420 if [ "$SUB_TARGET" = "win32" ]; then
       
   421 	# on cygwin/mingw, choose  g++ as a linker for native target
       
   422 	if [ "$LD" = "" ]; then
       
   423 		LD=$CXX
       
   424 	fi
       
   425 	if [ "$SUB_OS_NAME" = "CYGWIN" ]; then
       
   426 		SUB_PROG_CFLAGS="-mno-cygwin"
       
   427 	fi
       
   428 fi	
       
   429 
       
   430 if [ "$SUB_TARGET" = "unix" ]; then
       
   431 	if [ "$LD" = "" ]; then
       
   432 		LD=$CC
       
   433 	fi
       
   434 fi
       
   435 
       
   436 echo "Using ${LD} as a linker"
   426 
   437 
   427 # Guess prefix as regard cross compiling target machine
   438 # Guess prefix as regard cross compiling target machine
   428 if [ "$SUB_PREFIX" = "" ]; then
   439 if [ "$SUB_PREFIX" = "" ]; then
   429 	$CC -dumpspecs |grep -A 1 'cross_compile'|grep -q 1
   440 	$CC -dumpspecs |grep -A 1 'cross_compile'|grep -q 1
   430 	if (( $? )); then 
   441 	if (( $? )); then 
   435 		echo "This is a cross-compiler. Will install in $SUB_PREFIX";			
   446 		echo "This is a cross-compiler. Will install in $SUB_PREFIX";			
   436 	fi
   447 	fi
   437 fi
   448 fi
   438 
   449 
   439 echo "Using prefix: ${SUB_PREFIX}"
   450 echo "Using prefix: ${SUB_PREFIX}"
       
   451 
       
   452 ###########################################################################
       
   453 #                           GUESS DEPENDENCIES                            #
       
   454 ###########################################################################
       
   455 
       
   456 if which wx-config >/dev/null 2>&1; then
       
   457 	echo -n "Testing wxWidgets compiles ... "
       
   458 	cat > /tmp/wx_test.cpp <<EOF
       
   459 #include "wx/wx.h"
       
   460 class MyApp : public wxApp
       
   461 {
       
   462 };
       
   463 IMPLEMENT_APP(MyApp)
       
   464 EOF
       
   465 	if $CXX /tmp/wx_test.cpp `wx-config --cxxflags` `wx-config --libs` -o /tmp/wx_test >/dev/null 2>&1 ; then
       
   466 		SUB_WX=1
       
   467 		echo "Yes"
       
   468 	else
       
   469 		SUB_WX=0
       
   470 		echo "No"
       
   471 	fi
       
   472 	rm -f /tmp/wx_test*
       
   473 else
       
   474 	SUB_WX=0
       
   475 	echo "No wxWidgets available"
       
   476 fi
   440 
   477 
   441 ###########################################################################
   478 ###########################################################################
   442 #                   CANFESTIVAL DEFINES --> config.h                      #
   479 #                   CANFESTIVAL DEFINES --> config.h                      #
   443 ###########################################################################
   480 ###########################################################################
   444 # Some CONSTANTS preparation
   481 # Some CONSTANTS preparation
   560 if [ "$DISABLE_DLL" = "1" ]; then
   597 if [ "$DISABLE_DLL" = "1" ]; then
   561 	SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DNOT_USE_DYNAMIC_LOADING
   598 	SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DNOT_USE_DYNAMIC_LOADING
   562 	SUB_ENABLE_DLL_DRIVERS=0
   599 	SUB_ENABLE_DLL_DRIVERS=0
   563 else
   600 else
   564 	SUB_ENABLE_DLL_DRIVERS=1
   601 	SUB_ENABLE_DLL_DRIVERS=1
   565 	if [ "$SUB_OS_NAME" = "MINGW32" ]; then
   602 	if [ "$SUB_TARGET" = "win32" ]; then
   566 		SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS
   603 		SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS
   567 	else
   604 	else
   568 		SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -ldl
   605 		SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -ldl
   569 	fi
   606 	fi
   570 	
   607 	
   612 \	examples/TestMasterSlave/Makefile.in
   649 \	examples/TestMasterSlave/Makefile.in
   613 fi
   650 fi
   614 
   651 
   615 if [ "$SUB_TARGET" = "unix" ]; then
   652 if [ "$SUB_TARGET" = "unix" ]; then
   616 	MAKEFILES=$MAKEFILES\
   653 	MAKEFILES=$MAKEFILES\
   617 \	examples/DS401_Master/Makefile.in\
       
   618 \	examples/DS401_Slave_Gui/Makefile.in\
       
   619 \	examples/TestMasterMicroMod/Makefile.in
   654 \	examples/TestMasterMicroMod/Makefile.in
   620 fi
   655 fi
   621 
   656 
   622 if [ "$SUB_TARGET" = "win32" ]; then
   657 if [ "$SUB_TARGET" = "win32" ]; then
   623 	MAKEFILES=$MAKEFILES\
   658 	MAKEFILES=$MAKEFILES\
   624 \	examples/TestMasterSlave/Makefile.in\
   659 \	examples/TestMasterSlave/Makefile.in\
   625 \	examples/TestMasterMicroMod/Makefile.in\
   660 \	examples/TestMasterMicroMod/Makefile.in
       
   661 fi
       
   662 
       
   663 if [ "$SUB_WX" = "1" ]; then
       
   664 	MAKEFILES=$MAKEFILES\
   626 \	examples/DS401_Master/Makefile.in\
   665 \	examples/DS401_Master/Makefile.in\
   627 \	examples/DS401_Slave_Gui/Makefile.in
   666 \	examples/DS401_Slave_Gui/Makefile.in
   628 fi
   667 fi
   629 
   668 
   630 if [ "$SUB_TARGET" = "hcs12" ]; then
   669 if [ "$SUB_TARGET" = "hcs12" ]; then
   650 	s:SUB_TIMERS_DRIVER:timers_${SUB_TIMERS_DRIVER}:
   689 	s:SUB_TIMERS_DRIVER:timers_${SUB_TIMERS_DRIVER}:
   651 	s:SUB_CAN_DRIVER:can_${SUB_CAN_DRIVER}:
   690 	s:SUB_CAN_DRIVER:can_${SUB_CAN_DRIVER}:
   652 	s:SUB_CAN_DLL_CFLAGS:${SUB_CAN_DLL_CFLAGS}:
   691 	s:SUB_CAN_DLL_CFLAGS:${SUB_CAN_DLL_CFLAGS}:
   653 	s:SUB_ENABLE_DLL_DRIVERS:${SUB_ENABLE_DLL_DRIVERS}:
   692 	s:SUB_ENABLE_DLL_DRIVERS:${SUB_ENABLE_DLL_DRIVERS}:
   654 	s:SUB_ENABLE_LSS:${SUB_ENABLE_LSS}:
   693 	s:SUB_ENABLE_LSS:${SUB_ENABLE_LSS}:
       
   694 	s:SUB_WX:${SUB_WX}:
   655 	" > $makefile
   695 	" > $makefile
   656 done
   696 done
   657 
   697 
   658 echo "All done."
   698 echo "All done."