autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Autoconf support for VxWorks.


From: povey
Subject: Re: Autoconf support for VxWorks.
Date: Tue, 22 Jan 2002 07:29:00 +1000

On Mon, 21 Jan 2002 15:03:17 +0100, "Fredriksson, Johan" wrote: 
>Do I need to change the rules in autoconf.m4f and acspecific.m4 to get
>autoconf to support VxWorks. I have a package that I've built on Cygwin and
>Sun-Solaris, now I need to build it on VxWorks.
>

Hi Johan,

I did this recently and found it was quite easy, although it is unnatural 
way to build on VxWorks and you are probably much better in the long run, 
hacking up some Makefiles that Tornado can use.  You will need the latest 
config.sub (ftp from ftp.gnu.org), I also found that I had to set the 
cache variables directly for some tests, as linking and running programs 
which is how configure does a lot of its tests doesn't always work when 
building for vxWorks e.g.

# Check for platform specific settings
case $target in

  *-vxworks)
    AC_MSG_NOTICE([configuring for VXWORKS])

    #Stuff we have
    ac_cv_func_memcmp_working=yes
    ac_cv_func_gethostname=yes
    ac_cv_func_socket=yes
    ac_cv_func_strtoul=yes
    ac_cv_func_strerror=yes
    ac_cv_func_srand48=yes

    #Stuff we don't have
    ac_cv_lib_socket_connect=no
    ac_cv_lib_nsl_gethostbyname=no
    ac_cv_func_gethostbyname=no
    ac_cv_func_wait3=no
    ac_cv_func_getpid=no
    ac_cv_func_getppid=no
    ac_cv_func_getutent=no
    ac_cv_func_getutxent=no
    ac_cv_func_umask=no
    ac_cv_func_strcasecmp=no
    ac_cv_func_gettimeofday=no
    ac_cv_func_inet_pton=no
    ac_cv_func_inet_addr=no
    ac_cv_type_in_addr_t=no
    ac_cv_func_mrand48=no
    ac_cv_func_lrand48=no
    ac_cv_func_drand48=no
    ;;

    #other platform specific settings
    ...
esac


  You also need to call configure telling it what target you are compiling
for and where to find the correct CC, LD etc for your target.  I did this
with the wrapper script below, although you could probably do all of this 
in in your configure.ac if you chose.


#! /bin/sh
# configure for vxworks

################################################################################
#
# Set the following variable to the CPU type you are configuring for.
# This is the only configurable variable in this script.
#
################################################################################
#CPU="PPC603"
CPU="SIMSPARCSOLARIS"


################################################################################
#
# Check we have the required variables in the environment.
#
################################################################################
if [ x${WIND_BASE} = x ] || [ x${WIND_HOST_TYPE} = x ] ; then 
  echo "Must set WIND_BASE and WIND_HOST_TYPE environment variables" >&2
  exit 1
fi 

unset LD_LIBRARY_PATH


################################################################################
#
# Work out where configure script is (should be same dir as this script)
#
################################################################################
if [ x${configure} = x ]; then
  # see if $0 is a valid path
  if [ -f ${0} ]; then
    # compute dirname 
    dirname=`expr "x${0}" : 'x\(.*\)/[^/]*' \| . : '\(.\)'`
    configure="${dirname}/configure"
  fi
fi   


################################################################################
#
# Make sure configure is set, we assume it's in the PATH.
#
################################################################################
if [ x${configure} = x ]; then
  configure="configure"
fi


################################################################################
#
# Set the directory where host binaries are installed.
#
################################################################################
WIND_BIN="${WIND_BASE}/host/${WIND_HOST_TYPE}/bin"


################################################################################
#
# Set the compiler flags based on CPU type.  These are derived from the
# VxWorks Programmers Guide (5.4), Chapter 8 Configuration and Build,
# Table 8-5 Compiler invocation by architecture family (page 332.)
#
################################################################################
case ${CPU} in

SIMSPARCSOLARIS)

   # VxWorks Simulator on SPARC Solaris 
   #
   # Additions
   #   nostdlib - it just doesn't work without it
   #
   # Removals
   #   optimization - this is important for debugging.

   target="simso"

   CC="${WIND_BIN}/cc${target} \
       -ansi -nostdlib -nostdinc -fno-builtin -fvolatile \
       -DCPU=${CPU} -DRW_MULTI_THREAD -D_REENTRANT -DVXWORKS \
       -I${WIND_BASE}/target/h/"

   CMD="${configure} --host=${target}-wrs-vxworks \
        CC='${CC}' \
        AR='${WIND_BIN}/ar${target}' \
        RANLIB='${WIND_BIN}/ranlib${target}' \
        LD='${WIND_BIN}/ld${target}' \
        LDFLAGS=-r \
        OBJDUMP='${WIND_BIN}/objdump${target}' \
        --enable-split-main"

   break;;

PPC603)

   # PowerPC example 
   #
   # Additions
   #   nostdlib - it just doesn't work without it
   #
   # Removals
   #   optimization - this is important for debugging.

   target="ppc"

   CC="${WIND_BIN}/cc${target} \
       -mcpu=603 -nostdlib -nostdinc -fno-builtin -fno-for-scope \
       -DCPU=${CPU} -D_GNU_TOOL -DVXWORKS \
       -I${WIND_BASE}/target/h/"

   CMD="${configure} --host=${target}-wrs-vxworks \
        CC='${CC}' \
        AR='${WIND_BIN}/ar${target}' \
        RANLIB='${WIND_BIN}/ranlib${target}' \
        LD='${WIND_BIN}/ld${target}' \
        LDFLAGS=-r \
        OBJDUMP='${WIND_BIN}/objdump${target}' \
        --enable-split-main"

   break;;

*) echo "Unsupported target - ${CPU}"
   exit 1
   break;;

esac


################################################################################
#
# Print out the command we've created and execute it
#
################################################################################
echo $CMD $@
eval $CMD $@

--==_Exmh_-14354184520
Content-Type: text/plain; charset=us-ascii

Dean Povey,              |em: address@hidden|  JCSI: Java security toolkit
Senior S/W Developer     |ph:  +61 7 3864 5120    | uPKI: Embedded/C PKI toolkit
Wedgetail Communications |fax: +61 7 3864 1282    |       uASN.1: ASN.1 Compiler
Brisbane, Australia      |www: www.wedgetail.com  | XML Security: XML 
Signatures 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]