[go: up one dir, main page]

Menu

[r62]: / trunk / configure.in  Maximize  Restore  History

Download this file

146 lines (122 with data), 4.6 kB

# This file is part of mdcore.
# Coypright (c) 2010 Pedro Gonnet (gonnet@maths.ox.ac.uk)
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# init the project
AC_INIT(src/engine.c)
VERSION="0.0.1"
AC_SUBST(VERSION)
AM_INIT_AUTOMAKE(mdcore,VERSION)
AC_PROG_LIBTOOL

# generate header file
AM_CONFIG_HEADER(config.h)

# compiler settings
CFLAGS="-Wall -g $CFLAGS"

# find and test the compiler
AM_PROG_CC_C_O
AC_LANG_C
AX_CC_MAXOPT
AX_FUNC_POSIX_MEMALIGN
AX_GCC_ARCHFLAG([no])
AX_EXT

# autoconf stuff
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_HEADER_STDC

# check for the libraries we will need
AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR(something is wrong with the math library!))


# Check for pthreads
ACX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    CC="$PTHREAD_CC" LDFLAGS="$PTHREAD_LIBS $LIBS"],
    AC_MSG_ERROR([Could not find a working version of
    the pthread library. Make sure you have the library and header files installed
    or use CPPFLAGS and LDFLAGS if the library is installed in a
    non-standard location.]))
    
    
# Check for pthread_setaffinity_np
AC_USE_SYSTEM_EXTENSIONS
AC_CHECK_FUNC( pthread_setaffinity_np , AC_DEFINE([HAVE_SETAFFINITY],[true],
    [Defined if pthread_setaffinity_np exists.]) )


# Check for OpenMP
AX_OPENMP
AC_SUBST(OPENMP_CFLAGS)

    
# Check for metis
AC_ARG_WITH([metis],
    [AS_HELP_STRING([--with-metis=PATH],[prefix where the metis library is installed @<:@default=/opt/cell@:>@])],
    [if test "x$with_metis" != "xno"
     then
        if test "x$with_metis" != "xyes"
        then
            METIS_LDFLAGS="-L$with_metis -lmetis"
        else
            METIS_LDFLAGS="-lmetis"
        fi
        AC_CHECK_LIB([metis],[METIS_PartGraphVKway],,AC_MSG_ERROR(something is wrong with the metis library!),$METIS_LDFLAGS)
        AC_DEFINE([HAVE_METIS],[true],[The metis library appears to be present.])
     fi])
AC_SUBST(METIS_LDFLAGS)
AM_CONDITIONAL([HAVEMETIS],[test -n "$METIS_LDFLAGS"])



# Check for CUDA
AC_ARG_WITH([cuda],
    [AS_HELP_STRING([--with-cuda=PATH],[prefix where cuda is installed @<:@default=auto@:>@])],
    [if test "x$with_cuda" != "xno"
     then
        if test "x$with_cuda" != "xyes"
        then
            CUDA_CFLAGS="-I$with_cuda/include"
            CUDA_LIBS="-L$with_cuda/lib -lcuda -lcudart"
            NVCC="$with_cuda/bin/nvcc"
        else
            AC_CHECK_PROG([NVCC],nvcc)
            if test -n "$NVCC"
            then
                CUDA_CFLAGS="-I/usr/local/cuda/include"
                CUDA_LIBS="-L/usr/local/cuda/lib -lcuda -lcudart"
            fi
        fi
        if test -n "$NVCC"; then
            AC_DEFINE([HAVE_CUDA],[true],[The cuda compiler is installed.])
        fi
    fi])
AC_SUBST(CUDA_CFLAGS)
AC_SUBST(CUDA_LIBS)
AC_SUBST(NVCC)


# Check for CELL
AC_ARG_WITH([cell],
    [AS_HELP_STRING([--with-cell=PATH],[prefix where the IBM Cell-SDK and toolchain are installed @<:@default=/opt/cell@:>@])],
    [if test "x$with_cell" != "xno"
     then
        if test "x$with_cell" != "xyes"
        then
            CELLTOP="$with_cell"
        else
            CELLTOP="/opt/cell"
        fi
        AC_CHECK_PROG([PPUGCC],ppu-gcc,$CELLTOP/toolchain/bin/ppu-gcc,[],[$CELLTOP/toolchain/bin])
        AC_CHECK_PROG([SPUGCC],spu-gcc,$CELLTOP/toolchain/bin/spu-gcc,[],[$CELLTOP/toolchain/bin])
        if test x"$PPUGCC" == "x"; then
            AC_ERROR([Could not find the ppu-gcc compiler in $CELLTOP/toolchain/bin/])
        fi
        if test x"$SPUGCC" == "x"; then
            AC_ERROR([Could not find the spu-gcc compiler in $CELLTOP/toolchain/bin/])
        fi
        AC_DEFINE([HAVE_CELL],[true],[The Cell/BE Toolchain appears to be present.])
     fi])
AC_SUBST(CELLTOP)
AC_SUBST(PPUGCC)
AC_SUBST(SPUGCC)
AM_CONDITIONAL([HAVECELL],[test -n "$CELLTOP"])

# make the documentation
DX_INIT_DOXYGEN(mdcore,doc/Doxyfile,doc/)

# generate the Makefiles
AC_OUTPUT(Makefile src/Makefile src/Makefile_cell src/spu/Makefile examples/Makefile examples/Makefile_cell doc/Makefile)