configure
changeset 341 7ff01f109bbc
parent 331 da55aa2f9e64
child 342 66f007300c10
equal deleted inserted replaced
340:60e1eb89455e 341:7ff01f109bbc
    93 while [ $# -ge 1 ]; do
    93 while [ $# -ge 1 ]; do
    94 	optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
    94 	optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
    95 	
    95 	
    96 	case $1 in
    96 	case $1 in
    97 	--cc=*)		CC=$optarg;;
    97 	--cc=*)		CC=$optarg;;
       
    98 	--cxx=*)	CXX=$optarg;;
       
    99 	--ld=*)		LD=$optarg;;
    98 	--arch=*)	SUB_ARCH_NAME=$optarg;;
   100 	--arch=*)	SUB_ARCH_NAME=$optarg;;
    99 	--os=*)		SUB_OS_NAME=$optarg;;
   101 	--os=*)		SUB_OS_NAME=$optarg;;
   100 	--prefix=*)	SUB_PREFIX=$optarg;;
   102 	--prefix=*)	SUB_PREFIX=$optarg;;
   101 	--target=*)	SUB_TARGET=$optarg;;
   103 	--target=*)	SUB_TARGET=$optarg;;
   102 	--can=*)	SUB_CAN_DRIVER=$optarg;;
   104 	--can=*)	SUB_CAN_DRIVER=$optarg;;
   112 	--NMT_MAX_NODE_ID=*)	NMT_MAX_NODE_ID=$1;;
   114 	--NMT_MAX_NODE_ID=*)	NMT_MAX_NODE_ID=$1;;
   113 	--SDO_TIMEOUT_MS=*)	SDO_TIMEOUT_MS=$1;;
   115 	--SDO_TIMEOUT_MS=*)	SDO_TIMEOUT_MS=$1;;
   114 	--CANOPEN_BIG_ENDIAN=*)	CANOPEN_BIG_ENDIAN=$1;;
   116 	--CANOPEN_BIG_ENDIAN=*)	CANOPEN_BIG_ENDIAN=$1;;
   115 	--MAX_NB_TIMER=*) MAX_NB_TIMER=$1;;
   117 	--MAX_NB_TIMER=*) MAX_NB_TIMER=$1;;
   116 	--EMCY_MAX_ERRORS=*) EMCY_MAX_ERRORS=$1;;
   118 	--EMCY_MAX_ERRORS=*) EMCY_MAX_ERRORS=$1;;
   117 	--help)	echo	"Usage: ./configure [options]"
   119 	--help)
   118     		echo	"Options:"
   120 		echo	"Usage: ./configure [options]"
   119     		echo 	" --cc=foo      Use compiler 'foo' instead of defaults ${CC1} or ${CC2}."
   121 		echo	"Options:"
       
   122 		echo 	" --cc=foo      Use C compiler 'foo' instead of defaults ${CC1} or ${CC2}."
       
   123 		echo 	" --cxx=foo     Use C++ compiler 'foo' instead of defaults g++."
       
   124 		echo 	" --ld=foo      Use linker 'foo' instead of ld."
   120 		echo 	" --arch=foo    Use architecture 'foo' instead of trying to autodetect."
   125 		echo 	" --arch=foo    Use architecture 'foo' instead of trying to autodetect."
   121 		echo 	" --os=foo      Use operative system 'foo' instead of trying to autodetect."
   126 		echo 	" --os=foo      Use operative system 'foo' instead of trying to autodetect."
   122 		echo 	" --prefix=foo  Use prefix 'foo' instead of default ${SUB_PREFIX}."
   127 		echo 	" --prefix=foo  Use prefix 'foo' instead of default ${SUB_PREFIX}."
   123 		echo 	" --target=foo  Use 'foo' as build target."
   128 		echo 	" --target=foo  Use 'foo' as build target."
   124 		echo	"               \"generic\" for have independant CAN and TIMERS driver"
   129 		echo	"               \"unix\" for unix-like systems (Linux, Cygwin)"
   125 		echo	"               \"unix\" for unix-like systems"
   130 		echo	"               \"win32\" for win32 systems (native, mingw or VC++)"
   126 		echo	"               \"win32\" for win32 systems"
       
   127 		echo	"               \"hcs12\" for HCS12 micro-controller"
   131 		echo	"               \"hcs12\" for HCS12 micro-controller"
   128 		echo 	" --can=foo	Use 'foo' as CAN driver"
   132 		echo 	" --can=foo	Use 'foo' as CAN driver"
   129 		echo	"               \"peak_linux\" use Linux build host installed Peak driver and library"
   133 		echo	"               \"peak_linux\" use Linux build host installed Peak driver and library"
   130 		echo	"                                please see http://www.peak-system.com/linux/"
   134 		echo	"                 see http://www.peak-system.com/linux/"
   131 		echo	"               \"peak_win32\" use win32 PcanLight Peak driver and library with Cygwin" 
   135 		echo	"               \"peak_win32\" use win32 PcanLight Peak driver and library with Cygwin" 
   132 		echo	"                                please see http://www.peak-system.com/themen/download_gb.html"
   136 		echo	"                 see http://www.peak-system.com/themen/download_gb.html"
   133 		echo	"               \"virtual\" use unix pipe based virtual can driver"
   137 		echo	"               \"virtual\" use unix pipe based virtual can driver"
   134 		echo	"               \"socket\" use socket-can  "
   138 		echo	"               \"socket\" use socket-can  "
   135 		echo	"                                please see http://developer.berlios.de/projects/socketcan/"
   139 		echo	"                 see http://developer.berlios.de/projects/socketcan/"
   136 		echo	"               \"lincan\" for HCS12 micro-controller"
   140 		echo	"               \"lincan\" lincan driver"
   137 		echo	"                                please see http://www.ocera.org/download/components/WP7/lincan-0.3.3.html"
   141 		echo	"                 see http://www.ocera.org/download/components/WP7/lincan-0.3.3.html"
   138 		echo 	" --timers=foo  Use 'foo' as TIMERS driver (can be either 'unix' or 'xeno')"
   142 		echo 	" --timers=foo  Use 'foo' as TIMERS driver (can be either 'unix' or 'xeno')"
   139 		echo 	" --disable-dll Disable run-time dynamic linking of can, led and nvram drivers"
   143 		echo 	" --disable-dll Disable run-time dynamic linking of can, led and nvram drivers"
   140 		echo	" --disable-Ox  Disable gcc \"-Ox\" optimizations."
   144 		echo	" --disable-Ox  Disable gcc \"-Ox\" optimizations."
   141 		echo	" --debug=foo,foo,..   Enable debug messages, ERR -> only errors, WAR)."
   145 		echo	" --debug=foo,foo,..   Enable debug messages, ERR -> only errors, WAR)."
   142 		echo	"                 \"PDO\" send errors and warnings through PDO messages"
   146 		echo	"               \"PDO\" send errors and warnings through PDO messages"
   143 		echo	"                 \"ERR\" print errors only, to stdout"
   147 		echo	"               \"ERR\" print errors only, to stdout"
   144 		echo	"                 \"WAR\" print errors and warnings, to stdout"
   148 		echo	"               \"WAR\" print errors and warnings, to stdout"
   145 		echo	"                 \"MSG\" print messages content, to stdout"
   149 		echo	"               \"MSG\" print messages content, to stdout"
   146 		echo
   150 		echo
   147 		echo	"Stack compilation constants"
   151 		echo	"Stack compilation constants"
   148 		echo	" --MAX_CAN_BUS_ID [=1] Number of can bus to use"
   152 		echo	" --MAX_CAN_BUS_ID [=1] Number of can bus to use"
   149 		echo	" --SDO_MAX_LENGTH_TRANSFERT [=32] max bytes to transmit by SDO"
   153 		echo	" --SDO_MAX_LENGTH_TRANSFERT [=32] max bytes to transmit by SDO"
   150 		echo	" --SDO_MAX_SIMULTANEOUS_TRANSFERTS [=4] Number of SDO that the node can manage concurrently"
   154 		echo	" --SDO_MAX_SIMULTANEOUS_TRANSFERTS [=4] Number of SDO that the node can manage concurrently"
   164 
   168 
   165 if [ "$SUB_OS_NAME" = "" ]; then
   169 if [ "$SUB_OS_NAME" = "" ]; then
   166 	SUB_OS_NAME="`(uname -s | sed \"s/\//-/\" | sed \"s/_/-/\" \
   170 	SUB_OS_NAME="`(uname -s | sed \"s/\//-/\" | sed \"s/_/-/\" \
   167 			| sed \"s/-.*//g\") 2>&1`"
   171 			| sed \"s/-.*//g\") 2>&1`"
   168 fi
   172 fi
   169 if [ "$SUB_OS_NAME" = "HP" -o "$SUB_OS_NAME" = "HP-UX" ]; then
       
   170 	SUB_OS_NAME=HPUX
       
   171 fi
       
   172 
   173 
   173 if [ "$SUB_ARCH_NAME" = "" ]; then
   174 if [ "$SUB_ARCH_NAME" = "" ]; then
   174 	if [ "$CC" = "" ]; then
   175 	if [ "$CC" = "" ]; then
   175 		A_NAME="`(uname -m) 2>&1`"
   176 		A_NAME="`(uname -m) 2>&1`"
   176 	else
   177 	else
   177 		A_NAME="`$CC -dumpmachine | sed 's:-.*::'`"
   178 		A_NAME="`$CC -dumpmachine | sed 's:-.*::'`"
   178 	fi
   179 	fi
   179 fi
   180 fi
   180 
   181 
   181 # x86
   182 # x86
   182 if [ "$A_NAME" = "i386" ]; then
   183 if [ "$A_NAME" = "i386" -o "$A_NAME" = "i486" -o "$A_NAME" = "i586" -o "$A_NAME" = "i686" -o "$A_NAME" = "x86" ]; then
   183 	SUB_ARCH_NAME=x86
       
   184 fi
       
   185 if [ "$A_NAME" = "i486" ]; then
       
   186 	SUB_ARCH_NAME=x86
       
   187 fi
       
   188 if [ "$A_NAME" = "i586" ]; then
       
   189 	SUB_ARCH_NAME=x86
       
   190 fi
       
   191 if [ "$A_NAME" = "i686" ]; then
       
   192 	SUB_ARCH_NAME=x86
       
   193 fi
       
   194 if [ "$A_NAME" = "x86" ]; then
       
   195 	SUB_ARCH_NAME=x86
   184 	SUB_ARCH_NAME=x86
   196 fi
   185 fi
   197 
   186 
   198 # x86_64
   187 # x86_64
   199 if [ "$A_NAME" = "x86_64" ]; then
   188 if [ "$A_NAME" = "x86_64" ]; then
   200 	SUB_ARCH_NAME=x86_64
   189 	SUB_ARCH_NAME=x86_64
   201 fi
   190 fi
   202 
   191 
   203 # ia64
       
   204 if [ "$A_NAME" = "ia64" ]; then
       
   205 	SUB_ARCH_NAME=ia64
       
   206 fi
       
   207 
       
   208 # alpha
       
   209 if [ "$A_NAME" = "alpha" ]; then
       
   210 	SUB_ARCH_NAME=alpha
       
   211 fi
       
   212 
       
   213 # parisc
       
   214 if [ "$A_NAME" = "parisc" ]; then
       
   215 	SUB_ARCH_NAME=parisc
       
   216 fi
       
   217 if [ "$SUB_OS_NAME" = "HPUX" -a "$A_NAME" != "ia64" ]; then
       
   218 	# If we're on HP-UX and the architecture is *not* ia64,
       
   219 	# it's most likely parisc
       
   220 	SUB_ARCH_NAME=parisc
       
   221 fi
       
   222 
       
   223 # sparc
       
   224 if [ "$A_NAME" = "sparc" ]; then
       
   225 	SUB_ARCH_NAME=sparc
       
   226 fi
       
   227 if [ "$A_NAME" = "sun4u" ]; then
       
   228 	SUB_ARCH_NAME=sparc
       
   229 fi
       
   230 
       
   231 # sparc64
       
   232 if [ "$A_NAME" = "sparc64" ]; then
       
   233 	SUB_ARCH_NAME=sparc64
       
   234 fi
       
   235 
       
   236 # ppc
   192 # ppc
   237 if [ "$A_NAME" = "powerpc" ]; then
   193 if [ "$A_NAME" = "powerpc" ]; then
   238 	SUB_ARCH_NAME=ppc
   194 	SUB_ARCH_NAME=ppc
   239 fi
   195 fi
   240 
   196 
   245 
   201 
   246 # arm
   202 # arm
   247 if [ "$A_NAME" = "arm" ]; then
   203 if [ "$A_NAME" = "arm" ]; then
   248 	SUB_ARCH_NAME=arm
   204 	SUB_ARCH_NAME=arm
   249 fi
   205 fi
   250 
       
   251 # mips3
       
   252 if [ "$A_NAME" = "ip32" ]; then		# IRIX
       
   253 	SUB_ARCH_NAME=mips3
       
   254 fi
       
   255 if [ "$A_NAME" = "ip35" ]; then		# IRIX
       
   256 	SUB_ARCH_NAME=mips3
       
   257 fi
       
   258 
       
   259 # mips32
       
   260 if [ "$A_NAME" = "mips32" ]; then
       
   261 	SUB_ARCH_NAME=mips32
       
   262 fi
       
   263 if [ "$A_NAME" = "mips" ]; then
       
   264 	SUB_ARCH_NAME=mips32
       
   265 fi
       
   266 if [ "$A_NAME" = "MIPS" ]; then
       
   267 	SUB_ARCH_NAME=mips32
       
   268 fi
       
   269 if [ "$A_NAME" = "RISC" ]; then		# MIPS Ultrix
       
   270 	SUB_ARCH_NAME=mips32
       
   271 fi
       
   272 
       
   273 # mips64
       
   274 if [ "$A_NAME" = "mips64" ]; then
       
   275 	SUB_ARCH_NAME=mips64
       
   276 fi
       
   277 if [ "$A_NAME" = "MIPS64" ]; then
       
   278 	SUB_ARCH_NAME=mips64
       
   279 fi
       
   280 if [ "$A_NAME" = "IP64" ]; then		# IRIX
       
   281 	SUB_ARCH_NAME=mips64
       
   282 fi
       
   283 
       
   284 # power
       
   285 if [ "$A_NAME" = "power" ]; then	# Manual
       
   286 	SUB_ARCH_NAME=power
       
   287 fi
       
   288 
       
   289 echo "Using OS: ${SUB_OS_NAME}"
       
   290 echo "Using architecture: ${SUB_ARCH_NAME}"
       
   291 
   206 
   292 if [ "$SUB_ARCH_NAME" = "" ]; then
   207 if [ "$SUB_ARCH_NAME" = "" ]; then
   293 	echo "Error: could not detect what architecture this system is running!"
   208 	echo "Error: could not detect what architecture this system is running!"
   294 	echo "Please supply manually instead with \"--arch=foo\""
   209 	echo "Please supply manually instead with \"--arch=foo\""
   295 	exit -1
   210 	exit -1
   296 fi
   211 fi
   297 
   212 
   298 if [ "$SUB_OS_NAME" = "HPUX" -a "$CC" = "gcc" ]; then
   213 echo "Using OS: ${SUB_OS_NAME}"
   299 	# Only if we are on HP-UX, ia64 and using gcc
   214 echo "Using architecture: ${SUB_ARCH_NAME}"
   300 	SUB_PROG_CFLAGS=-mlp64
       
   301 fi
       
   302 
       
   303 if [ "$SUB_OS_NAME" = "SunOS" -a "$SUB_ARCH_NAME" = "sparc" -a "$CC" = "gcc" ]; then
       
   304 	# Only if we are on SunOS, sparc and using gcc
       
   305 	# Tells the assembler that we are dealing with a v8plusa arch sparc
       
   306 	# and -mimpure-text is needed for shared library linking
       
   307 	SUB_PROG_CFLAGS="-Wa,-xarch=v8plusa -mimpure-text"
       
   308 fi
       
   309 
       
   310 if [ "$SUB_OS_NAME" = "AIX" -a "$SUB_ARCH_NAME" = "power" -a "$CC" = "gcc" ]; then
       
   311 	# Only if we are on AIX, power and using gcc
       
   312 	# The assembler may default to generating Power and PowerPC compatible
       
   313 	# code. We need to override that.
       
   314 	SUB_PROG_CFLAGS=-Wa,-mpwr
       
   315 fi
       
   316 
       
   317 if [ "$SUB_OS_NAME" = "AIX" -a "$SUB_ARCH_NAME" = "ppc" -a "$CC" = "gcc" ]; then
       
   318 	# Only if we are on AIX, ppc and using gcc
       
   319 	# The assembler may default to generating Power and PowerPC compatible
       
   320 	# code. We need to override that.
       
   321 	SUB_PROG_CFLAGS=-Wa,-mppc
       
   322 fi
       
   323 
   215 
   324 if [ "$SUB_ARCH_NAME" = "x86_64" -a "$CC" = "gcc" ]; then
   216 if [ "$SUB_ARCH_NAME" = "x86_64" -a "$CC" = "gcc" ]; then
   325 	# Only if we are on x86_64 and using gcc
   217 	# Only if we are on x86_64 and using gcc
   326 	# For shared library generation, it needs this
   218 	# For shared library generation, it needs this
   327 	SUB_PROG_CFLAGS=-fPIC
   219 	SUB_PROG_CFLAGS=-fPIC
   388 fi
   280 fi
   389 
   281 
   390 ###########################################################################
   282 ###########################################################################
   391 #              TARGET/DRIVER SPECIFIC CFLAGS and OPTIONS                  #
   283 #              TARGET/DRIVER SPECIFIC CFLAGS and OPTIONS                  #
   392 ###########################################################################
   284 ###########################################################################
   393 if [ "$SUB_TARGET" = "generic" ]; then
       
   394 	if [ "$US_TO_TIMEVAL_FACTOR" = "" ]; then
       
   395 		US_TO_TIMEVAL_FACTOR=1
       
   396 	fi
       
   397 	if [ "$TIMEVAL" = "" ]; then
       
   398 		TIMEVAL=UNS64
       
   399 	fi
       
   400 	if [ "$TIMEVAL_MAX" = "" ]; then
       
   401 		TIMEVAL_MAX=0xffffffffffffffff
       
   402 	fi
       
   403 fi
       
   404 
       
   405 if [ "$SUB_TARGET" = "hcs12" ]; then
   285 if [ "$SUB_TARGET" = "hcs12" ]; then
   406 	# Only if we want to compile for a µC HCS12
   286 	# Only if we want to compile for a µC HCS12
   407        # it is a big endian architecture.
   287        # it is a big endian architecture.
   408        CANOPEN_BIG_ENDIAN=1
   288        CANOPEN_BIG_ENDIAN=1
   409 	# search for gcc hcs12 compiler m6811-elf-gcc or m68hc12-gcc ?
   289 	# search for gcc hcs12 compiler m6811-elf-gcc or m68hc12-gcc ?
   481 	   SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lpthread\ -lrt
   361 	   SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lpthread\ -lrt
   482 	fi
   362 	fi
   483 fi
   363 fi
   484 
   364 
   485 if [ "$SUB_TIMERS_DRIVER" = "xeno" ]; then
   365 if [ "$SUB_TIMERS_DRIVER" = "xeno" ]; then
   486 	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lnative\ -lrtdm\
   366 	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lnative\ -lrtdm\ -L`$XENO_CONFIG --library-dir`
   487 \	-L`$XENO_CONFIG --library-dir`
       
   488 	SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ `$XENO_CONFIG --xeno-cflags`
   367 	SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ `$XENO_CONFIG --xeno-cflags`
   489 	RTCAN_SOCKET=1
   368 	RTCAN_SOCKET=1
   490 fi
   369 fi
   491 
   370 
   492 if [ "$SUB_TIMERS_DRIVER" = "none" ]; then
   371 if [ "$SUB_TIMERS_DRIVER" = "none" ]; then