dnl ################################################################### dnl dnl Copyright (C) 1999-2010, Karlsruhe University dnl Copyright (C) 2008-2009, Volkmar Uhlig, IBM Corporation dnl dnl File path: configure.in dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions dnl are met: dnl 1. Redistributions of source code must retain the above copyright dnl notice, this list of conditions and the following disclaimer. dnl 2. Redistributions in binary form must reproduce the above copyright dnl notice, this list of conditions and the following disclaimer in the dnl documentation and/or other materials provided with the distribution. dnl dnl THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND dnl ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE dnl ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS dnl OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT dnl LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF dnl SUCH DAMAGE. dnl dnl $Id: configure.in,v 1.66 2006/11/24 15:47:20 ud3 Exp $ dnl dnl ################################################################### dnl Process this file with autoconf to produce a configure script. AC_INIT(Pistachio, [0.4]) AC_CONFIG_SRCDIR([serv/sigma0/sigma0.cc]) if test "x$host_alias" != x; then # We do not necessarily need crt0 and friends when cross-compiling. LDFLAGS="-nostdlib $LDFLAGS" HOST=$host_alias else HOST=`(uname -m) 2>/dev/null || echo unknown` fi # Append /l4 to the libdir default case ${libdir} in \${exec_prefix}/lib) libdir='${exec_prefix}/lib/l4' ;; esac # Append /l4 to the libexecdir default case ${libexecdir} in \${exec_prefix}/libexec) libexecdir='${exec_prefix}/libexec/l4' ;; esac # Determine hardware architecture to build for. case $HOST in ia32|x86|i386*|i486*|i586*|i686*) ARCH=ia32 KERNEL=x86-kernel LIBGCCFLAGS=-m32 ;; powerpc64*|ppc64*) ARCH=powerpc64 KERNEL=$ARCH-kernel ;; powerpc*) ARCH=powerpc KERNEL=$ARCH-kernel ;; amd64*|x86_64*) ARCH=amd64 KERNEL=x86-kernel LIBGCCFLAGS=-m64 ;; *) AC_MSG_ERROR([Unknown hardware architecture: $HOST. Please specify hardware architecture using --host=ARCH.]) ;; esac # Try guessing the correct name of the C compiler and friends. If # compiling for build machine, let autoconf do the job instead. CROSSCC= if test "x$CC" = x -a "x$host_alias" != x; then if test "x$gcc_prefix" = x; then case $ARCH in ia32) gcc_prefix=i386 ;; amd64) gcc_prefix=x86_64 host_alias=amd64 ;; *) gcc_prefix=$ARCH ;; esac fi AC_CHECK_PROGS(CROSSCC, [$host_alias-gcc $gcc_prefix-elf-gcc $gcc_prefix-unknown-elf-gcc \ $gcc_prefix-linux-gcc $gcc_prefix-unknown-linux-gcc \ $gcc_prefix-unknown-linux-gnu-gcc $gcc_prefix-pc-linux-gnu-gcc]) fi if test "x$CROSSCC" != x; then CC=$CROSSCC fi dnl Autoheader stuff. AC_CONFIG_HEADERS([config.h]) dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_LN_S AC_PROG_AWK dnl Configure parameters AC_ARG_WITH([comport], [AC_HELP_STRING([--with-comport=PORT], [comport to user for serial I/O [[0]]])], [CONFIG_COMPORT=`echo $withval | sed 's/yes/0/'`], [CONFIG_COMPORT=0]) if test "x$CONFIG_COMPORT" != xno; then AC_DEFINE_UNQUOTED([CONFIG_COMPORT], [$CONFIG_COMPORT], [Define to the appropriate I/O comport (0-3).]) fi AC_ARG_WITH([comspeed], [AC_HELP_STRING([--with-comspeed=SPEED], [select speed for comport [[115200]]])], [COMSPEED=$withval], [COMSPEED=115200]) if test "x$CONFIG_COMPORT" != xno; then AC_DEFINE_UNQUOTED([CONFIG_COMSPEED], [$COMSPEED], [Baud rate for comport (typically 115200, 57600, or 38400).]) fi AC_ARG_WITH([kickstart-linkbase], [AC_HELP_STRING([--with-kickstart-linkbase=BASE], [link-base for kickstart [[architecture-dependent]]])], [KICKSTART_LINKBASE=$withval], [KICKSTART_LINKBASE=no]) AC_ARG_WITH([s0-linkbase], [AC_HELP_STRING([--with-s0-linkbase=BASE], [link-base for sigma0 [[architecture-dependent]]])], [SIGMA0_LINKBASE=$withval], [SIGMA0_LINKBASE=no]) AC_ARG_WITH([roottask-linkbase], [AC_HELP_STRING([--with-roottask-linkbase=BASE], [link-base for root task [[architecture-dependent]]])], [ROOTTASK_LINKBASE=$withval], [ROOTTASK_LINKBASE=no]) AC_ARG_WITH([kerneldir], [AC_HELP_STRING([--with-kerneldir=DIR], [build directory of kernel [[guess]]])], [kerneldir=$withval], [kerneldir=no]) dnl Find prefix to use for gcc/binutils programs. TOOLPREFIX=`echo $CC | sed 's,gcc[[^/]]*$,,'` AC_SUBST([TOOLPREFIX]) dnl Find location of libgcc.a AC_MSG_CHECKING([location of libgcc.a]) LIBGCC=`$CC $LIBGCCFLAGS -print-libgcc-file-name` LIBGCCDIR=`echo $LIBGCC | sed 's,/[[^/]]*$,,'` AC_MSG_RESULT([$LIBGCCDIR]) dnl Find location of stdarg.h include file AC_MSG_CHECKING([location of stdarg.h]) testdir=`echo $LIBGCC | sed 's,/[[^/]]*$,/include,'` if test -f "$testdir/stdarg.h"; then STDARGDIR=$testdir else testdir=`echo $LIBGCC | sed 's,/lib/[[^/]]*$,/include,'` STDARGDIR="\$(top_builddir)" rm -f "stdarg.h" if test -f "$testdir/stdarg.h"; then # If stdarg.h is self contained, use it. Copy file to avoid using # standard system include grep -q '#include' "$testdir/stdarg.h" || cp "$testdir/stdarg.h" . fi if test ! -f "stdarg.h"; then STDARGDIR="\$(top_srcdir)/../contrib/include" fi fi if test "x$STDARGDIR" != x; then AC_MSG_RESULT([$STDARGDIR]) else AC_MSG_ERROR([stdarg.h not found]) fi dnl Guess build directory of kernel AC_MSG_CHECKING([kernel build directory]) case $kerneldir in yes|no) my_builddir=`pwd` my_srcdir=`(cd $srcdir && pwd)` my_confname=`echo $my_builddir | sed s,.*/,,` # Relative to build directory if test -f $my_builddir/../kernel/$KERNEL; then kerneldir='$(top_builddir)'/../kernel elif test -f $my_builddir/../kernel-$ARCH/$KERNEL; then kerneldir='$(top_builddir)'/../kernel-$ARCH elif test -f $my_builddir/../pistachio-kernel/$KERNEL; then kerneldir='$(top_builddir)'/../pistachio-kernel elif test -f $my_builddir/../pistachio-$KERNEL/$KERNEL; then kerneldir='$(top_builddir)'/../pistachio-$KERNEL elif test -f $my_builddir/../pistachio-kernel-$ARCH/$KERNEL; then kerneldir='$(top_builddir)'/../pistachio-kernel-$ARCH elif test -f $my_builddir/../pistachio-$ARCH/$KERNEL; then kerneldir='$(top_builddir)'/../pistachio-$ARCH elif test -f $my_builddir/../build-kernel/$KERNEL; then kerneldir='$(top_builddir)'/../build-kernel elif test -f $my_builddir/../build-kernel-$ARCH/$KERNEL; then kerneldir='$(top_builddir)'/../build-kernel-$ARCH elif test -f $my_builddir/../build-$KERNEL/$KERNEL; then kerneldir='$(top_builddir)'/../build-$KERNEL elif test -f $my_builddir/../build-$ARCH/$KERNEL; then kerneldir='$(top_builddir)'/../build-$ARCH # Relative to source directory elif test -f $my_srcdir/../kernel/$my_confname/$KERNEL; then kerneldir='$(top_srcdir)'/../kernel/$my_confname elif test -f $my_srcdir/../kernel/$ARCH/$KERNEL; then kerneldir='$(top_srcdir)'/../kernel/$ARCH # Default else kerneldir='$(top_builddir)' fi ;; esac AC_MSG_RESULT([$kerneldir]) dnl Set compiler/linker flags. CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir) -I$STDARGDIR $CPPFLAGS" case $LDFLAGS in *-nostdlib*) ;; *) LDFLAGS="-nostdlib $LDFLAGS" ;; esac LDFLAGS="-N -L\$(top_builddir)/lib -L$LIBGCCDIR $LDFLAGS" CFLAGS="-nostdinc $CFLAGS" CXXFLAGS="-fno-exceptions $CXXFLAGS" CC_VERSION=`echo __GNUC__ | $CC -E - | grep -v "\#"` CC_SUBVERSION=`echo __GNUC_MINOR__ | $CC -E - | grep -v "\#"` if test "$CC_VERSION" = "4" -a "$CC_SUBVERSION" -ge "1"; then CFLAGS="-fno-stack-protector $CFLAGS" fi dnl Architecture dependent settings. case $ARCH in ia32) default_kickstart_linkbase=00800000 default_sigma0_linkbase=00020000 default_roottask_linkbase=00400000 ;; powerpc) default_kickstart_linkbase=00400000 default_sigma0_linkbase=00500000 default_roottask_linkbase=00600000 ;; powerpc64) default_sigma0_linkbase=00100000 default_roottask_linkbase=00300000 ;; amd64) default_kickstart_linkbase=00100000 default_sigma0_linkbase=00f00000 default_roottask_linkbase=01000000 ;; esac dnl Platform dependent settings. case $ARCH in ia32*) PLAT=amd64-pc99 CFLAGS="$CFLAGS -m32" LDFLAGS="$LDFLAGS -melf_i386" AC_SUBST([PLAT]) ;; amd64*) PLAT=amd64-pc99 CFLAGS="$CFLAGS -m64 -mno-red-zone" LDFLAGS="$LDFLAGS -melf_x86_64" AC_SUBST([PLAT]) ;; powerpc) CFLAGS="$CFLAGS -msoft-float -mno-regnames -meabi -msdata=none -mno-toc" ;; powerpc64*) CFLAGS="$CFLAGS -msoft-float -mminimal-toc" ;; esac case $KICKSTART_LINKBASE in yes|no) KICKSTART_LINKBASE=$default_kickstart_linkbase ;; esac case $SIGMA0_LINKBASE in yes|no) SIGMA0_LINKBASE=$default_sigma0_linkbase ;; esac case $ROOTTASK_LINKBASE in yes|no) ROOTTASK_LINKBASE=$default_roottask_linkbase ;; esac AC_SUBST([CXXFLAGS]) AC_SUBST([ARCH]) AC_SUBST([KERNEL]) AC_SUBST([KICKSTART_LINKBASE]) AC_SUBST([SIGMA0_LINKBASE]) AC_SUBST([ROOTTASK_LINKBASE]) AC_SUBST([kerneldir]) dnl Modified files. AC_CONFIG_FILES([ config.mk Makefile lib/Makefile lib/l4/Makefile lib/io/Makefile serv/Makefile serv/sigma0/Makefile apps/Makefile apps/bench/Makefile apps/bench/pingpong/Makefile apps/grabmem/Makefile apps/l4test/Makefile util/Makefile util/kickstart/Makefile util/grubdisk/Makefile util/piggybacker/Makefile util/piggybacker/ofppc/Makefile util/piggybacker/ofppc64/Makefile contrib/Makefile contrib/elf-loader/Makefile ]) AC_OUTPUT