Home My Page Projects Code Snippets Project Openings 3D graphics for Standard ML
Summary Activity SCM

SCM Repository

[sml3d] View of /trunk/sml3d/configure.ac
ViewVC logotype

View of /trunk/sml3d/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1312 - (download) (annotate)
Tue Sep 17 15:01:36 2013 UTC (5 years, 9 months ago) by jhr
File size: 26685 byte(s)
  remove documentation configuration rules, since the doc tree has its own configure.ac file.
dnl Process this file with autoconf to produce a configure script.
dnl
dnl COPYRIGHT (c) 2013 The SML3d Project (http://sml3d.cs.uchicago.edu)
dnl All rights reserved.
dnl
dnl This the configuration script for autoconf version 2.60+.  The
dnl file configure.in is for older versions.

AC_INIT(sml3d,0.1,sml3d@mailman.cs.uchicago.edu)

AC_PREREQ(2.60)
AC_COPYRIGHT([[COPYRIGHT (c) 2011 John Reppy (http://cs.uchicago.edu/~jhr)]])
AC_CONFIG_SRCDIR(src/base/sml3d_mlb.in)
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
 
dnl
dnl include additional macros
dnl
dnl sinclude(config/ax_check_gl.m4)
dnl sinclude(config/ax_check_glu.m4)
dnl sinclude(config/ax_check_glut.m4)
sinclude(config/acx_pthread.m4)
sinclude(config/ax_lang_compiler_ms.m4)
sinclude(config/ax_check_framework.m4)
sinclude(config/ax_check_macports.m4)
sinclude(config/ax_check_local_lib.m4)
sinclude(config/ax_check_lib_stdcall.m4)
sinclude(config/check_smlnj.m4)
sinclude(config/check_smlnj_heap_suffix.m4)

dnl
dnl get host information
dnl
AC_CANONICAL_HOST

dnl check for standard programs
dnl
AC_PROG_CC_C99
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_MAKE_SET

dnl
dnl ******************** OS related configuration ********************
dnl
dnl
dnl directory paths for the OpenGL glue code and other OS-specific
dnl configuration
dnl
case "$host_os" in
  mingw32)
    ROOT_DIR=`pwd -W`
    OPENGL_ABI=glee-abi
    EXE_SUFFIX=".exe"
  ;;
  *)
    ROOT_DIR=`pwd`
    OPENGL_ABI=c-abi
    EXE_SUFFIX=""
  ;;
esac
DOC_DIR=$ROOT_DIR/doc
SRC_DIR=$ROOT_DIR/src
BIN_DIR=$ROOT_DIR/bin
LIB_DIR=$ROOT_DIR/lib
MK_DIR=$ROOT_DIR/mk

AC_SUBST(ROOT_DIR)
AC_SUBST(DOC_DIR)
AC_SUBST(SRC_DIR)
AC_SUBST(BIN_DIR)
AC_SUBST(LIB_DIR)
AC_SUBST(MK_DIR)
AC_SUBST(OPENGL_ABI)
AC_SUBST(EXE_SUFFIX)

dnl a path to search for executables
dnl
EXE_PATH=$PATH$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR/usr/local/bin

dnl
dnl If we are on Mac OS X, check for the presence of macports and/or fink
dnl
NEEDS_MACPORTS=no
NEEDS_FINK=no
case "$host_os" in
  darwin*) # On Mac OS X we check for installed frameworks
    if test -x /opt/local/bin/port ; then
      HAS_MACPORTS=yes
      EXE_PATH=$EXE_PATH$PATH_SEPARATOR/opt/local/bin
    else
      HAS_MACPORTS=no
    fi
    if test -x /sw/bin/fink ; then
      HAS_FINK=yes
      EXE_PATH=$EXE_PATH$PATH_SEPARATOR/sw/bin
    else
      HAS_FINK=no
    fi
  ;;
esac

dnl
dnl ******************** MLton related configuration ********************
dnl

dnl check for mlton
dnl
AC_ARG_WITH(mlton,
  AC_HELP_STRING([--with-mlton=<path>], [specify path to mlton executable]),
  [ac_cv_use_mlton=$withval], [ac_cv_use_mlton=no])
if test x"$ac_cv_use_mlton" = xno ; then
  # look for mlton in the path
  AC_PATH_PROG([MLTON], [mlton], [none], [$EXE_PATH])
else
  AC_MSG_CHECKING([path to mlton ($ac_cv_use_mlton)])
  case $ac_cv_use_mlton in
    /*) ;;
    *) AC_MSG_ERROR([path to mlton must be absolute]) ;;
  esac
  if test -x $ac_cv_use_mlton ; then
    MLTON=$ac_cv_use_mlton
  AC_MSG_RESULT([ okay])
  else
    MLTON=none
  AC_MSG_RESULT([ invalid])
  fi
fi
if test x"$MLTON" = xnone ; then
  AC_MSG_ERROR([unable to find mlton])
fi
AC_SUBST(MLTON)

dnl determine the native size for mlton (32 or 64 bits)
dnl
AC_MSG_CHECKING([native size of mlton executables])
MLTON_OBJPTR_REP=`$MLTON -show path-map | grep OBJPTR_REP | sed -e s/OBJPTR_REP// | sed -e s/\.sml//`
case x"$MLTON_OBJPTR_REP" in
  *rep32)
    AC_MSG_RESULT([32 bit])
    CFLAGS="$CFLAGS -m32"
    AC_DEFINE([WORDS_32], [], [Define to 1 if system is 32 bit])
  ;;
  *rep64)
    AC_MSG_RESULT([64 bit])
    CFLAGS="$CFLAGS -m64"
    AC_DEFINE([WORDS_64], [], [Define to 1 if system is 64 bit])
  ;;
  *) AC_MSG_ERROR([unable to determine mlton's word size]) ;;
esac

dnl check to see if we have a version of MLton that includes the C_Pointer module, which
dnl was added in revision 7407.
dnl
AC_MSG_CHECKING([for C_Pointer structure])
ac_cv_mlb_file=conftest.mlb
cat - > $ac_cv_mlb_file <<_ACEOF
local
  \$(SML_LIB)/basis/c-types.mlb
in
structure CPtr = C_Pointer
end
_ACEOF
$MLTON -stop tc $ac_cv_mlb_file >/dev/null 2>&1
if test $? -eq 0 ; then
  ac_cv_mlton_has_c_pointer=yes
else
  ac_cv_mlton_has_c_pointer=no
fi
AC_MSG_RESULT([$ac_cv_mlton_has_c_pointer])

dnl
dnl ******************** developer related configuration ********************
dnl
dnl for sml3d developers (as opposed to users), we need some additional
dnl software.
dnl

AC_ARG_ENABLE([dev],
  [AS_HELP_STRING([--enable-dev], [extra configuration to support SML3d developers])],
  [DEV_SUPPORT=yes],
  [DEV_SUPPORT=no])

if test x"$DEV_SUPPORT" = xyes ; then

  MLTON_PATH=`dirname $MLTON`
  #
  # check for MLton version of mlulex or ml-ulex
  #
  AC_PATH_PROGS([ML_ULEX], [mlulex ml-ulex], [none],
    [$EXE_PATH$PATH_SEPARATOR$MLTON_PATH])
  #
  # check for MLton version of mlantlr or ml-antlr
  #
  AC_PATH_PROGS([ML_ANTLR], [mlantlr ml-antlr], [none],
    [$EXE_PATH$PATH_SEPARATOR$MLTON_PATH])
  #
  # check that we have a compatible version of SML/NJ
  #
  CHECK_SMLNJ([AC_MSG_ERROR([unable to find SML/NJ installation; check your PATH or set SMLNJ_CMD])])
  if test $SMLNJ_MAJOR_VERSION -lt 110 \
    -o $SMLNJ_MINOR_VERSION -lt 73
  then
    AC_MSG_ERROR([installation requires SML/NJ version 110.73+])
  fi
  AC_SUBST(SMLNJ_VERSION)
  #
  # determine the heap-image suffix
  #
  CHECK_SMLNJ_HEAP_SUFFIX([
    AC_MSG_ERROR([unsupported configuration ${host_cpu}-${host_os}])])
  #
  # look for ml-makedepend
  #
  AC_MSG_CHECKING([for ml-makedepend])
  tmpPATH="$SMLNJ_PATH:$PATH"
  AC_PATH_PROG(ML_MAKEDEPEND, ml-makedepend, ":", $tmpPATH)
  if test $ML_MAKEDEPEND = none ; then
    AC_MSG_ERROR([ml-makedepend not found])
  else
    AC_MSG_RESULT([$ML_MAKEDEPEND])
  fi
  AC_SUBST(ML_MAKEDEPEND)
  #
  # look for ml-build
  #
  tmpPATH="$SMLNJ_PATH:$PATH"
  AC_PATH_PROG(ML_BUILD, ml-build, none, $tmpPATH)
  if test $ML_BUILD = none ; then
    AC_MSG_ERROR([ml-build not found])
  fi
  AC_SUBST(ML_BUILD)

  INSTALL_SMLNJ_WRAPPER=$BIN_DIR/install-sml-wrapper.sh
  AC_SUBST(INSTALL_SMLNJ_WRAPPER)

else
  ML_ULEX=none
  ML_ANTLR=none
fi
AC_SUBST(ML_ULEX)
AC_SUBST(ML_ANTLR)


dnl
dnl ******************** optional packages ********************
dnl
dnl initialize the command-line options to support the various optional packages
dnl
OPENGL_OPTION="none"
GLUT_OPTION="none"
GLFW_OPTION="none"
SDL_OPTION="none"
SDL_TTF_OPTION="none"
SDL_IMAGE_OPTION="none"
SDL_MIXER_OPTION="none"
OPENAL_OPTION="none"
DDS_OPTION="none"
PNG_OPTION="none"
TIFF_OPTION="none"
GLEE_OBJ=""
OPENCL_OPTION="none"

case "$host_os" in
  darwin*) # On Mac OS X we check for installed frameworks
    OPENGL_OPTION="-framework OpenGL -lobjc"
    OPENGL_INCLUDE="#include <OpenGL/gl.h>"
    GLUT_OPTION="-framework GLUT"
    AC_CHECK_LIB([glfw], [glfwInit], [GLFW_OPTION="-lglfw"], [GLFW_OPTION="none"],
      [-framework Cocoa -framework OpenGL])
    AX_CHECK_FRAMEWORK([SDL], [SDL_OPTION="-framework SDL"], [])
    AX_CHECK_FRAMEWORK([SDL_ttf], [SDL_TTF_OPTION="-framework SDL_ttf"], [])
    AX_CHECK_FRAMEWORK([SDL_image], [SDL_IMAGE_OPTION="-framework SDL_image"], [])
    AX_CHECK_FRAMEWORK([SDL_mixer], [SDL_MIXER_OPTION="-framework SDL_mixer"], [])
    AX_CHECK_FRAMEWORK([OpenCL], [OPENCL_OPTION="-framework OpenCL"; OPENCL_INCLUDE="#include <OpenCL/cl.h>"], [])
    OPENAL_OPTION="-framework OpenAL"
dnl
dnl check macports and fink for libraries
dnl
    AX_CHECK_MACPORTS_LIB([png], [png_access_version_number],
      [PNG_OPTION="-lpng"; NEEDS_MACPORTS=yes],
      [])
    AX_CHECK_MACPORTS_LIB([tiff], [TIFFOpen],
      [TIFF_OPTION="-ltiff"; NEEDS_MACPORTS=yes],
      [])
  ;;
  mingw32) # on windows the linker options are different
dnl    AC_SEARCH_LIBS([__stdcall glEnd], [opengl32], [OPENGL_OPTION="-lglu32 -lopengl32"], [OPENGL_OPTION="none"])
    AX_CHECK_LIB_STDCALL([opengl32], [glEnd], [OPENGL_OPTION="-lglu32 -lopengl32"], [OPENGL_OPTION="none"])
    OPENGL_INCLUDE="#include <GL/gl.h>"
    AX_CHECK_LIB_STDCALL([glut], [glutInit], [GLUT_OPTION="-lglut"], [GLUT_OPTION="none"])
    #
    # if we don't find glut, use the one from the sml3d distribution
    #
    if test x"$GLUT_OPTION" = xnone ; then
      AC_MSG_NOTICE([using glut from $ROOT_DIR/windows])
      LDFLAGS="$LDFLAGS -L$ROOT_DIR/windows/lib"
      CPPFLAGS="-I$ROOT_DIR/windows/include"
      GLUT_OPTION="-L$ROOT_DIR/windows/lib -lglut32"
    fi
    SDL_OPTION="none"
    SDL_TTF_OPTION="none"
    SDL_IMAGE_OPTION="none"
    SDL_MIXER_OPTION="none"
    OPENAL_OPTION="none"
    PNG_OPTION="none"
    TIFF_OPTION="none"
    GLEE_OBJ="$ROOT_DIR/windows/lib/GLee.o"
  ;;
  *) # on other operating systems, check for libraries
    AC_CHECK_LIB([GL], [glEnd], [OPENGL_OPTION="-lGL -lGLU"], [OPENGL_OPTION="none"])
    OPENGL_INCLUDE="#include <GL/gl.h>"
    AC_CHECK_LIB([glut], [glutInit], [GLUT_OPTION="-lglut"], [GLUT_OPTION="none"])
    AC_CHECK_LIB([glfw], [glfwInit], [GLFW_OPTION="-lglfw"], [GLFW_OPTION="none"], [-lGL])
    AC_CHECK_LIB([OpenCL],[clGetPlatformIDs],[OPENCL_OPTION="-lOpenCL"; OPENCL_INCLUDE="#include <CL/cl.h>"])
    AC_CHECK_LIB([SDL], [SDL_Linked_Version], [SDL_OPTION="-lSDL"], [])
    AC_CHECK_LIB([SDL_ttf], [TTF_Linked_Version], [SDL_TTF_OPTION="-lSDL_ttf"], [])
    AC_CHECK_LIB([SDL_image], [IMG_Linked_Version], [SDL_IMAGE_OPTION="-lSDL_image"], [])
    AC_CHECK_LIB([SDL_mixer], [Mix_Linked_Version], [SDL_MIXER_OPTION="-lSDL_mixer"], [])
    AC_CHECK_LIB([openal], [alcOpenDevice], [OPENAL_OPTION="-lopenal"], [])
    AC_CHECK_LIB([png], [png_access_version_number], [PNG_OPTION="-lpng"], [])
    AC_CHECK_LIB([tiff], [TIFFOpen], [TIFF_OPTION="-ltiff"], [])
  ;;
esac

if test x"$OPENGL_OPTION" = xnone ; then
  AC_ERROR([no OpenGL library found])
fi

dnl
dnl check that GLFW is at least version 3.0
dnl
if test x"$GLFW_OPTION" != xnone ; then
  AC_CHECK_HEADER([GLFW/glfw3.h],
    [],
    [GLFW_OPTION=none])
fi

dnl
dnl command-line options to support the various optional packages
dnl
AC_SUBST(OPENGL_OPTION)
AC_SUBST(OPENCL_OPTION)
AC_SUBST(GLUT_OPTION)
AC_SUBST(GLFW_OPTION)
AC_SUBST(SDL_OPTION)
AC_SUBST(SDL_TTF_OPTION)
AC_SUBST(SDL_IMAGE_OPTION)
AC_SUBST(SDL_MIXER_OPTION)
AC_SUBST(OPENAL_OPTION)
AC_SUBST(PNG_OPTION)
AC_SUBST(TIFF_OPTION)
AC_SUBST(GLEE_OBJ)

dnl
dnl OpenCL configuration to support OpenGL hooks
dnl
if test x"$OPENCL_OPTION" != xnone ; then
  OPENCL_LIB="\$(SML3D_LIB)/opencl.mlb"
  OPENCL_SML3D_MLB="../base/sml3d.mlb"
  OPENCL_GL_SML="gl.sml"
  OPENCL_WITH_GL_SML="cl-with-gl.sml"
  OPENCL_WITH_GL_CPPFLAGS="-DOPENCL_WITH_OPENGL"
else
  # no OpenCL support
  #
  OPENCL_LIB=""
fi
AC_SUBST(OPENCL_LIB)
AC_SUBST(OPENCL_SML3D_MLB)
AC_SUBST(OPENCL_GL_SML)
AC_SUBST(OPENCL_WITH_GL_SML)
AC_SUBST(OPENCL_WITH_GL_CPPFLAGS)

if test x"$GLUT_OPTION" != xnone ; then
  BUILD_GLUT="true"
else
  BUILD_GLUT="false"
fi
AC_SUBST(BUILD_GLUT)
if test x"$GLFW_OPTION" != xnone ; then
  BUILD_GLFW="true"
else
  BUILD_GLFW="false"
fi
AC_SUBST(BUILD_SDL)
if test x"$SDL_OPTION" != xnone ; then
  BUILD_SDL="true"
else
  BUILD_SDL="false"
fi
AC_SUBST(BUILD_SDL)

dnl
dnl substitutions for optional SDL components
dnl
if test x"$SDL_TTF_OPTION" != xnone ; then
  SDL_TTF_SML=sdl-text.sml
  STRUCTURE_SDL_TTF="structure SDLText"
fi
if test x"$SDL_IMG_OPTION" != xnone ; then
  SDL_IMG_SML=sdl-image.sml
  STRUCTURE_SDL_IMG="structure SDLImage"
fi
if test x"$SDL_MIXER_OPTION" != xnone ; then
  SDL_MIXER_SML=sdl-mixer.sml
  STRUCTURE_SDL_MIXER="structure SDLMixer"
fi
AC_SUBST(SDL_TTF_SML)
AC_SUBST(STRUCTURE_SDL_TTF)
AC_SUBST(SDL_IMG_SML)
AC_SUBST(STRUCTURE_SDL_IMG)
AC_SUBST(SDL_MIXER_SML)
AC_SUBST(STRUCTURE_SDL_MIXER)

dnl
dnl substitutions for Image IO glue
dnl
BUILD_IMAGE_IO_GLUE=false
SUPPORTED_IMAGE_FORMATS=""
if test x"$DDS_OPTION" != xnone ; then
  BUILD_IMAGE_IO_GLUE=true
  SUPPORTED_IMAGE_FORMATS="dds $SUPPORTED_IMAGE_FORMATS"
  DDS_ML_SRC=dds-file-io.sml
  DDS_ML_STRUCT="structure DDSFileIO"
fi
if test x"$PNG_OPTION" != xnone ; then
  BUILD_IMAGE_IO_GLUE=true
  SUPPORTED_IMAGE_FORMATS="png $SUPPORTED_IMAGE_FORMATS"
  PNG_ML_SRC=png-file-io.sml
  PNG_ML_STRUCT="structure PNGFileIO"
fi
#if test x"$TIFF_OPTION" != xnone ; then
#  BUILD_IMAGE_IO_GLUE=true
#  SUPPORTED_IMAGE_FORMATS="tiff $SUPPORTED_IMAGE_FORMATS"
#  TIFF_ML_SRC=tiff-file-io.sml
#  TIFF_ML_STRUCT="structure TIFFFileIO"
#fi
if test x"$BUILD_IMAGE_IO_GLUE" = xtrue ; then
  IMAGE_IO_GLUE=$LIB_DIR/image-io-glue.o
else
  IMAGE_IO_GLUE=
fi
AC_SUBST(BUILD_IMAGE_IO_GLUE)
AC_SUBST(SUPPORTED_IMAGE_FORMATS)
AC_SUBST(IMAGE_IO_GLUE)
AC_SUBST(DDS_ML_SRC)
AC_SUBST(DDS_ML_STRUCT)
AC_SUBST(PNG_ML_SRC)
AC_SUBST(PNG_ML_STRUCT)
AC_SUBST(TIFF_ML_SRC)
AC_SUBST(TIFF_ML_STRUCT)


dnl
dnl support for encoding movies using mencoder (http://www.mplayerhq.hu)
dnl

dnl first check for the mencoder program
dnl
AC_PATH_PROG([MENCODER], [mencoder], [none], [$EXE_PATH])
if test x"$MENCODER" = xnone ; then
  AC_MSG_WARN([did not find mencoder, so no movie generation support])
else
  AC_DEFINE([HAVE_MENCODER], [1], [system has mencoder installed])
fi
AC_SUBST(MENCODER)

dnl
dnl ******************** Check OpenGL info ********************
dnl
AC_CHECK_TYPE(GLenum,
  [AC_COMPUTE_INT(ac_cv_nbits, [8*sizeof(GLenum)], [$OPENGL_INCLUDE])],
  [ac_cv_nbits=0],
  [$OPENGL_INCLUDE])
GLENUM_STRUCT=Word$ac_cv_nbits
AC_SUBST(GLENUM_STRUCT)

AC_CHECK_TYPE(GLboolean,
  [AC_COMPUTE_INT(ac_cv_nbits, [8*sizeof(GLboolean)], [$OPENGL_INCLUDE])],
  [ac_cv_nbits=0],
  [$OPENGL_INCLUDE])
GLBOOLEAN_STRUCT=Word$ac_cv_nbits
AC_SUBST(GLBOOLEAN_STRUCT)

AC_CHECK_TYPE(GLbitfield,
  [AC_COMPUTE_INT(ac_cv_nbits, [8*sizeof(GLbitfield)], [$OPENGL_INCLUDE])],
  [ac_cv_nbits=0],
  [$OPENGL_INCLUDE])
GLBITFIELD_STRUCT=Word$ac_cv_nbits
AC_SUBST(GLBITFIELD_STRUCT)

AC_CHECK_TYPE(GLintptr,
  [AC_COMPUTE_INT(ac_cv_nbits, [8*sizeof(GLintptr)], [$OPENGL_INCLUDE])],
  [ac_cv_nbits=0],
  [$OPENGL_INCLUDE])
GLINTPTR_STRUCT=Int$ac_cv_nbits
AC_SUBST(GLINTPTR_STRUCT)

AC_CHECK_TYPE(GLsizeiptr,
  [AC_COMPUTE_INT(ac_cv_nbits, [8*sizeof(GLsizeiptr)], [$OPENGL_INCLUDE])],
  [ac_cv_nbits=0],
  [$OPENGL_INCLUDE])
GLSIZEIPTR_STRUCT=Int$ac_cv_nbits
AC_SUBST(GLSIZEIPTR_STRUCT)


dnl
dnl ******************** OpenCL sizes etc. ********************
dnl
if test x"$OPENCL_OPTION" != xnone ; then
  AC_CHECK_SIZEOF([cl_char], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_char2], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_char3], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_char4], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_char8], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_char16], [], [$OPENCL_INCLUDE])
  SIZEOF_CL_CHAR=$ac_cv_sizeof_cl_char
  SIZEOF_CL_CHAR2=$ac_cv_sizeof_cl_char2
  SIZEOF_CL_CHAR3=$ac_cv_sizeof_cl_char3
  SIZEOF_CL_CHAR4=$ac_cv_sizeof_cl_char4
  SIZEOF_CL_CHAR8=$ac_cv_sizeof_cl_char8
  SIZEOF_CL_CHAR16=$ac_cv_sizeof_cl_char16
  AC_CHECK_ALIGNOF([cl_char], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_char2], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_char3], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_char4], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_char8], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_char16], [$OPENCL_INCLUDE])
  ALIGNOF_CL_CHAR=$ac_cv_alignof_cl_char
  ALIGNOF_CL_CHAR2=$ac_cv_alignof_cl_char2
  ALIGNOF_CL_CHAR3=$ac_cv_alignof_cl_char3
  ALIGNOF_CL_CHAR4=$ac_cv_alignof_cl_char4
  ALIGNOF_CL_CHAR8=$ac_cv_alignof_cl_char8
  ALIGNOF_CL_CHAR16=$ac_cv_alignof_cl_char16
  # AS_VAR_ARITH([BITSOF_CL_CHAR], [8 * $SIZEOF_CL_CHAR])
  BITSOF_CL_CHAR=$(( 8 * $SIZEOF_CL_CHAR ))
  AC_SUBST(SIZEOF_CL_CHAR)
  AC_SUBST(SIZEOF_CL_CHAR2)
  AC_SUBST(SIZEOF_CL_CHAR3)
  AC_SUBST(SIZEOF_CL_CHAR4)
  AC_SUBST(SIZEOF_CL_CHAR8)
  AC_SUBST(SIZEOF_CL_CHAR16)
  AC_SUBST(ALIGNOF_CL_CHAR)
  AC_SUBST(ALIGNOF_CL_CHAR2)
  AC_SUBST(ALIGNOF_CL_CHAR3)
  AC_SUBST(ALIGNOF_CL_CHAR4)
  AC_SUBST(ALIGNOF_CL_CHAR8)
  AC_SUBST(ALIGNOF_CL_CHAR16)
  AC_SUBST(BITSOF_CL_CHAR)

  AC_CHECK_SIZEOF([cl_short], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_short2], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_short3], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_short4], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_short8], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_short16], [], [$OPENCL_INCLUDE])
  SIZEOF_CL_SHORT=$ac_cv_sizeof_cl_short
  SIZEOF_CL_SHORT2=$ac_cv_sizeof_cl_short2
  SIZEOF_CL_SHORT3=$ac_cv_sizeof_cl_short3
  SIZEOF_CL_SHORT4=$ac_cv_sizeof_cl_short4
  SIZEOF_CL_SHORT8=$ac_cv_sizeof_cl_short8
  SIZEOF_CL_SHORT16=$ac_cv_sizeof_cl_short16
  AC_CHECK_ALIGNOF([cl_short], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_short2], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_short3], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_short4], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_short8], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_short16], [$OPENCL_INCLUDE])
  ALIGNOF_CL_SHORT=$ac_cv_alignof_cl_short
  ALIGNOF_CL_SHORT2=$ac_cv_alignof_cl_short2
  ALIGNOF_CL_SHORT3=$ac_cv_alignof_cl_short3
  ALIGNOF_CL_SHORT4=$ac_cv_alignof_cl_short4
  ALIGNOF_CL_SHORT8=$ac_cv_alignof_cl_short8
  ALIGNOF_CL_SHORT16=$ac_cv_alignof_cl_short16
  # AS_VAR_ARITH([BITSOF_CL_SHORT], [8 * $SIZEOF_CL_SHORT])
  BITSOF_CL_SHORT=$(( 8 * $SIZEOF_CL_SHORT ))
  AC_SUBST(SIZEOF_CL_SHORT)
  AC_SUBST(SIZEOF_CL_SHORT2)
  AC_SUBST(SIZEOF_CL_SHORT3)
  AC_SUBST(SIZEOF_CL_SHORT4)
  AC_SUBST(SIZEOF_CL_SHORT8)
  AC_SUBST(SIZEOF_CL_SHORT16)
  AC_SUBST(ALIGNOF_CL_SHORT)
  AC_SUBST(ALIGNOF_CL_SHORT2)
  AC_SUBST(ALIGNOF_CL_SHORT3)
  AC_SUBST(ALIGNOF_CL_SHORT4)
  AC_SUBST(ALIGNOF_CL_SHORT8)
  AC_SUBST(ALIGNOF_CL_SHORT16)
  AC_SUBST(BITSOF_CL_SHORT)

  AC_CHECK_SIZEOF([cl_int], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_int2], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_int3], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_int4], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_int8], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_int16], [], [$OPENCL_INCLUDE])
  SIZEOF_CL_INT=$ac_cv_sizeof_cl_int
  SIZEOF_CL_INT2=$ac_cv_sizeof_cl_int2
  SIZEOF_CL_INT3=$ac_cv_sizeof_cl_int3
  SIZEOF_CL_INT4=$ac_cv_sizeof_cl_int4
  SIZEOF_CL_INT8=$ac_cv_sizeof_cl_int8
  SIZEOF_CL_INT16=$ac_cv_sizeof_cl_int16
  AC_CHECK_ALIGNOF([cl_int], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_int2], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_int3], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_int4], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_int8], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_int16], [$OPENCL_INCLUDE])
  ALIGNOF_CL_INT=$ac_cv_alignof_cl_int
  ALIGNOF_CL_INT2=$ac_cv_alignof_cl_int2
  ALIGNOF_CL_INT3=$ac_cv_alignof_cl_int3
  ALIGNOF_CL_INT4=$ac_cv_alignof_cl_int4
  ALIGNOF_CL_INT8=$ac_cv_alignof_cl_int8
  ALIGNOF_CL_INT16=$ac_cv_alignof_cl_int16
  # AS_VAR_ARITH([BITSOF_CL_INT], [8 * $SIZEOF_CL_INT])
  BITSOF_CL_INT=$(( 8 * $SIZEOF_CL_INT ))
  AC_SUBST(SIZEOF_CL_INT)
  AC_SUBST(SIZEOF_CL_INT2)
  AC_SUBST(SIZEOF_CL_INT3)
  AC_SUBST(SIZEOF_CL_INT4)
  AC_SUBST(SIZEOF_CL_INT8)
  AC_SUBST(SIZEOF_CL_INT16)
  AC_SUBST(ALIGNOF_CL_INT)
  AC_SUBST(ALIGNOF_CL_INT2)
  AC_SUBST(ALIGNOF_CL_INT3)
  AC_SUBST(ALIGNOF_CL_INT4)
  AC_SUBST(ALIGNOF_CL_INT8)
  AC_SUBST(ALIGNOF_CL_INT16)
  AC_SUBST(BITSOF_CL_INT)

  AC_CHECK_SIZEOF([cl_long], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_long2], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_long3], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_long4], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_long8], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_long16], [], [$OPENCL_INCLUDE])
  SIZEOF_CL_LONG=$ac_cv_sizeof_cl_long
  SIZEOF_CL_LONG2=$ac_cv_sizeof_cl_long2
  SIZEOF_CL_LONG3=$ac_cv_sizeof_cl_long3
  SIZEOF_CL_LONG4=$ac_cv_sizeof_cl_long4
  SIZEOF_CL_LONG8=$ac_cv_sizeof_cl_long8
  SIZEOF_CL_LONG16=$ac_cv_sizeof_cl_long16
  AC_CHECK_ALIGNOF([cl_long], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_long2], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_long3], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_long4], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_long8], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_long16], [$OPENCL_INCLUDE])
  ALIGNOF_CL_LONG=$ac_cv_alignof_cl_long
  ALIGNOF_CL_LONG2=$ac_cv_alignof_cl_long2
  ALIGNOF_CL_LONG3=$ac_cv_alignof_cl_long3
  ALIGNOF_CL_LONG4=$ac_cv_alignof_cl_long4
  ALIGNOF_CL_LONG8=$ac_cv_alignof_cl_long8
  ALIGNOF_CL_LONG16=$ac_cv_alignof_cl_long16
  # AS_VAR_ARITH([BITSOF_CL_LONG], [8 * $SIZEOF_CL_LONG])
  BITSOF_CL_LONG=$(( 8 * $SIZEOF_CL_LONG ))
  AC_SUBST(SIZEOF_CL_LONG)
  AC_SUBST(SIZEOF_CL_LONG2)
  AC_SUBST(SIZEOF_CL_LONG3)
  AC_SUBST(SIZEOF_CL_LONG4)
  AC_SUBST(SIZEOF_CL_LONG8)
  AC_SUBST(SIZEOF_CL_LONG16)
  AC_SUBST(ALIGNOF_CL_LONG)
  AC_SUBST(ALIGNOF_CL_LONG2)
  AC_SUBST(ALIGNOF_CL_LONG3)
  AC_SUBST(ALIGNOF_CL_LONG4)
  AC_SUBST(ALIGNOF_CL_LONG8)
  AC_SUBST(ALIGNOF_CL_LONG16)
  AC_SUBST(BITSOF_CL_LONG)

  AC_CHECK_SIZEOF([cl_float], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_float2], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_float3], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_float4], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_float8], [], [$OPENCL_INCLUDE])
  AC_CHECK_SIZEOF([cl_float16], [], [$OPENCL_INCLUDE])
  SIZEOF_CL_FLOAT=$ac_cv_sizeof_cl_float
  SIZEOF_CL_FLOAT2=$ac_cv_sizeof_cl_float2
  SIZEOF_CL_FLOAT3=$ac_cv_sizeof_cl_float3
  SIZEOF_CL_FLOAT4=$ac_cv_sizeof_cl_float4
  SIZEOF_CL_FLOAT8=$ac_cv_sizeof_cl_float8
  SIZEOF_CL_FLOAT16=$ac_cv_sizeof_cl_float16
  AC_CHECK_ALIGNOF([cl_float], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_float2], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_float3], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_float4], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_float8], [$OPENCL_INCLUDE])
  AC_CHECK_ALIGNOF([cl_float16], [$OPENCL_INCLUDE])
  ALIGNOF_CL_FLOAT=$ac_cv_alignof_cl_float
  ALIGNOF_CL_FLOAT2=$ac_cv_alignof_cl_float2
  ALIGNOF_CL_FLOAT3=$ac_cv_alignof_cl_float3
  ALIGNOF_CL_FLOAT4=$ac_cv_alignof_cl_float4
  ALIGNOF_CL_FLOAT8=$ac_cv_alignof_cl_float8
  ALIGNOF_CL_FLOAT16=$ac_cv_alignof_cl_float16
  # AS_VAR_ARITH([BITSOF_CL_FLOAT], [8 * $SIZEOF_CL_FLOAT])
  BITSOF_CL_FLOAT=$(( 8 * $SIZEOF_CL_FLOAT ))
  AC_SUBST(SIZEOF_CL_FLOAT)
  AC_SUBST(SIZEOF_CL_FLOAT2)
  AC_SUBST(SIZEOF_CL_FLOAT3)
  AC_SUBST(SIZEOF_CL_FLOAT4)
  AC_SUBST(SIZEOF_CL_FLOAT8)
  AC_SUBST(SIZEOF_CL_FLOAT16)
  AC_SUBST(ALIGNOF_CL_FLOAT)
  AC_SUBST(ALIGNOF_CL_FLOAT2)
  AC_SUBST(ALIGNOF_CL_FLOAT3)
  AC_SUBST(ALIGNOF_CL_FLOAT4)
  AC_SUBST(ALIGNOF_CL_FLOAT8)
  AC_SUBST(ALIGNOF_CL_FLOAT16)
  AC_SUBST(BITSOF_CL_FLOAT)
fi


dnl
dnl ******************** options for C glue code ********************
dnl
AC_C_BIGENDIAN

CPPFLAGS="$CPPFLAGS -I$SRC_DIR/include"

dnl
dnl sml3d-config.h stuff
AH_TOP([
/*
 * COPYRIGHT (c) 2011 John Reppy (http://cs.uchicago.edu/~jhr
 * All rights reserved.
 */

#ifndef _SML3D_CONFIG_H_
#define _SML3D_CONFIG_H_

#include <stdint.h>
#include <stdbool.h>
])

AH_BOTTOM([
#endif /* !_SML3D_CONFIG_H_ */
])


dnl
dnl ******************** write output ********************
dnl
AC_CONFIG_FILES(
dnl ***** Makefiles *****
  src/glut/config.gmk:src/glut/config_gmk.in
  mk/config.gmk:config/config_gmk.in
  Makefile
  gen/fi-gen/Makefile
  src/Makefile
  src/base/Makefile
  src/clang/Makefile
  src/glfw/Makefile
  src/glfw/test/Makefile
  src/glut/Makefile
  src/image-io/Makefile
  src/loaders/md5/Makefile
  src/loaders/obj/Makefile
  src/movie/Makefile
  src/openal/Makefile
  src/opencl/Makefile
  src/particles/Makefile
  src/sdl/Makefile
  src/tests/image-gen/Makefile
  src/tests/md5ld/Makefile
  src/tests/movie-gen/Makefile
  src/tests/objld/Makefile
  src/tests/ortho/Makefile
  src/tests/pixels/Makefile
  src/tests/quad-shader/Makefile
  examples/animation/Makefile
  examples/bounce/Makefile
  examples/brick/Makefile
  examples/bump-mapping/Makefile
  examples/cl-geyser/Makefile
  examples/delaunay/Makefile
  examples/gears/Makefile
  examples/geyser/Makefile
  examples/glinfo/Makefile
  examples/md3-viewer/Makefile
  examples/padl11-demo/Makefile
  examples/particle/Makefile
  examples/physics/ballistic/Makefile
  examples/steering/Makefile
  examples/triangle/Makefile
  examples/water/Makefile
dnl ***** Path maps *****
  lib/sml3d-path-map:config/sml3d-path-map.in
dnl MLB files
  src/base/sml3d.mlb:src/base/sml3d_mlb.in
dnl *****##### the following will replace src/base/sml3d.mlb at some point #####*****
  src/sml3d/sml3d.mlb:src/sml3d/sml3d_mlb.in
  src/image-io/image-io.mlb:src/image-io/image-io_mlb.in
  src/opencl/opencl.mlb:src/opencl/opencl_mlb.in
dnl **  src/sml3d/gl-types.mlb:src/sml3d/gl-types_mlb.in
  src/sdl/sdl.mlb:src/sdl/sdl_mlb.in
dnl C files
  src/movie/movie-glue.c:src/movie/movie-glue_c.in
dnl SML files
  src/base/common/sml3d-info.sml:src/base/common/sml3d-info_sml.in
dnl *****##### the following will replace src/base/sml3d.mlb at some point #####*****
  src/sml3d/base/sml3d-info.sml:src/sml3d/base/sml3d-info_sml.in
  src/opencl/cl-sizes.sml:src/opencl/cl-sizes_sml.in)

if test x"$DEV_SUPPORT" = xyes ; then
  AC_CONFIG_FILES(
    gen/spec-parser/gldb/Makefile
    gen/spec-parser/glgen/Makefile)
  AC_CONFIG_FILES([
    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in
  ], [chmod +x bin/install-sml-wrapper.sh])
fi

AC_CONFIG_HEADERS(src/include/sml3d-config.h:config/config_h.in)

dnl
dnl shell scripts
dnl
AC_CONFIG_FILES([
  bin/config-sml3d.sh:config/config-sml3d_sh.in
], [chmod +x bin/config-sml3d.sh])
AC_CONFIG_FILES([
  config/mk-mlb-files.sh:config/mk-mlb-files_sh.in
], [chmod +x config/mk-mlb-files.sh])

dnl
dnl run configuration commands
dnl
dnl FIXME: it may be sufficient to do (cd src; make build)
dnl
AC_CONFIG_COMMANDS(
  [src/base/opengl/config],
  [(cd src/base; make config)],
  [])
if test x"$GLEE_OBJ" != "x" ; then
AC_CONFIG_COMMANDS(
    [lib/GLee.o],
    [(cd windows/GLee5_21; ./mk.sh)],
    [])
fi
if test "$BUILD_GLUT" = true ; then
  AC_CONFIG_COMMANDS(
    [src/glut/config],
    [(cd src/glut; make config)],
    [])
fi
if test "$BUILD_GLFW" = true ; then
  AC_CONFIG_COMMANDS(
    [src/glfw/config],
    [(cd src/glfw; make config)],
    [])
fi
if test "$BUILD_SDL" = true ; then
  AC_CONFIG_COMMANDS(
    [src/sdl/config],
    [(cd src/sdl; make config)],
    [])
fi
if test "$BUILD_IMAGE_IO_GLUE" = true ; then
  AC_CONFIG_COMMANDS(
    [src/image-io/config],
    [(cd src/image-io; make config)],
    [])
fi
if test x"$OPENAL_OPTION" != xnone ; then
  AC_CONFIG_COMMANDS(
    [src/openal/config],
    [(cd src/openal; make config)],
    [])
fi
if test x"$OPENCL_OPTION" != xnone ; then
  AC_CONFIG_COMMANDS(
    [src/opencl/config],
    [(cd src/opencl; make config)],
    [])
fi
AC_CONFIG_COMMANDS(
  [src/movie/config],
  [(cd src/movie; make config)],
  [])
#
# create directory for shader programs
AC_CONFIG_COMMANDS(
  [lib/shaders],
  [(cd lib; if test ! -d data ; then mkdir shaders; fi)]
  [])
AC_CONFIG_COMMANDS(
  [src/particles],
  [(cd src/particles; make config)],
  [])

dnl
dnl generate wrapper MLB files
dnl
AC_CONFIG_COMMANDS(
    [make-mlb-files],
    [config/mk-mlb-files.sh],
    [])

AC_OUTPUT

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0