Services and Modeling for Embedded Software Development
Embecosm divider strip
Prev  Next

5.5.1.  configure.in for the BSP

The configure.in for the OpenRISC 1000  is closely based on the version in libnosys.

The initial declarations just need modifying to change the name of the package.

AC_PREREQ(2.59)
AC_INIT(libor32.a,0.2.0)
AC_CONFIG_HEADER(config.h)
	  

There is then code to print a warning if the user has asked for shared library support (not available) and to locate the auxiliary tools for autoconf.

The script makes use of AC_CANONICAL_SYSTEM to determine the system type and set appropriate variables. This is now obsolete, and is replaced by AC_CANONICAL_TARGET in the OpenRISC 1000  version. The installed program names may be changed (for example by --prefix), so we need AC_ARG_PROGRAM and we locate the install program.

AC_CANONICAL_TARGET

AC_ARG_PROGRAM
AC_PROG_INSTALL
	  

The assumption is made that we are using GNU ld, so we define HAVE_GNU_LD. The script in libnosys does this in an obsolete way, which is fixed in the OpenRISC 1000  script.

AC_DEFINE(HAVE_GNU_LD, 1, [Using GNU ld])
	  

The standard script tests the canonical target name to determine if this is an ELF target. For OpenRISC 1000  this is always the case, so the test can be replaced by a simple declaration.

AC_DEFINE(HAVE_ELF, 1, [Using ELF format])
	  

The script in libnosys then tests for the presence of various features. Most of those are not relevant to OpenRISC 1000  so can be left out. However we do need to determine what the symbol prefix is. We could just define this as being '_', but instead we let the script work it out, using the standard script's code.

AC_CACHE_CHECK([for symbol prefix], libc_symbol_prefix, [dnl
cat > conftest.c <<\EOF
foo () { }
EOF

libc_symbol_prefix=none
if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null]);
then
  libc_symbol_prefix='$'
else
  if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep "_foo" > /dev/null]);
  then
    libc_symbol_prefix=_
  fi
fi
rm -f conftest* ])
if test $libc_symbol_prefix != none; then
  AC_DEFINE_UNQUOTED(__SYMBOL_PREFIX, "$libc_symbol_prefix", [symbol prefix])
else
  AC_DEFINE(__SYMBOL_PREFIX, "", [symbol prefix])
fi
	  

The code to define the various host tools used is standard. However it will expect to find an aclocal.m4 file in the directory. This can be regenerated, or simply copied from the libnosys directory. The variable host_makefile_frag refers to standard make script defining how compilation is carried out for the various source files.

Finally the new Makefile can be generated in a suitably initialized environment.

AC_CONFIG_FILES(Makefile,
                ac_file=Makefile . ${libgloss_topdir}/config-ml.in,
                srcdir=${srcdir}
                target=${target}
                with_multisubdir=${with_multisubdir}
                ac_configure_args="${ac_configure_args} --enable-multilib"
                CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
                libgloss_topdir=${libgloss_topdir}
)
AC_OUTPUT
	  
Embecosm divider strip