Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis15/configure.ac
ViewVC logotype

Diff of /branches/vis15/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/vis12/configure.ac revision 1725, Mon Mar 12 21:18:01 2012 UTC branches/vis15/configure.ac revision 5571, Wed May 30 22:11:07 2018 UTC
# Line 1  Line 1 
1  dnl Process this file with autoconf to produce a configure script.  dnl Process this file with autoconf to produce a configure script.
2  dnl  dnl
3  dnl COPYRIGHT (c) 2010 The Diderot Project  dnl This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
4    dnl
5    dnl COPYRIGHT (c) 2017 The University of Chicago
6  dnl All rights reserved.  dnl All rights reserved.
7  dnl  dnl
8    
9  AC_INIT(diderot,0.1,)  AC_INIT(diderot,2.0,)
10    
11  AC_PREREQ(2.60)  AC_PREREQ(2.60)
12  AC_COPYRIGHT([[COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)]])  AC_COPYRIGHT([[COPYRIGHT (c) 2017 The University of Chicago]])
13  AC_CONFIG_SRCDIR(src/dnorm/dnorm.c)  AC_CONFIG_SRCDIR(src/compiler/options/ctl.sml)
14  AC_CONFIG_AUX_DIR(config)  AC_CONFIG_AUX_DIR(config)
15  AC_CONFIG_MACRO_DIR(config)  AC_CONFIG_MACRO_DIR(config)
16    
17  dnl  dnl
18    dnl set the following to the name of the branch
19    dnl
20    BRANCH="vis15"
21    AC_SUBST(BRANCH)
22    
23    dnl
24  dnl include additional macros  dnl include additional macros
25  dnl  dnl
26    sinclude(config/ax_check_compile_flag.m4)
27    sinclude(config/ax_gcc_func_attribute.m4)
28    sinclude(config/ax_gcc_x86_cpuid.m4)
29    sinclude(config/ax_gcc_x86_avx_xgetbv.m4)
30    sinclude(config/ax_ext.m4)
31  sinclude(config/acx_pthread.m4)  sinclude(config/acx_pthread.m4)
32  sinclude(config/check_smlnj.m4)  sinclude(config/check_smlnj.m4)
33  sinclude(config/check_smlnj_heap_suffix.m4)  sinclude(config/check_smlnj_heap_suffix.m4)
34  sinclude(config/ax_check_framework.m4)  sinclude(config/ax_check_framework.m4)
35    sinclude(config/ax_cxx_compile_stdcxx.m4)
36    
37  dnl  dnl
38  dnl get host information  dnl get host information
39  dnl  dnl
40  AC_CANONICAL_HOST  AC_CANONICAL_HOST
41    
42    #################### Paths configuration ####################
43    
44    DIDEROT_ROOT=`pwd`
45    DIDEROT_DOCDIR=$DIDEROT_ROOT/doc
46    DIDEROT_SRCDIR=$DIDEROT_ROOT/src
47    DIDEROT_LIBDIR=$DIDEROT_ROOT/lib
48    DIDEROT_BINDIR=$DIDEROT_ROOT/bin
49    DIDEROT_MKDIR=$DIDEROT_ROOT/mk
50    
51    AC_SUBST(DIDEROT_ROOT)
52    AC_SUBST(DIDEROT_DOCDIR)
53    AC_SUBST(DIDEROT_SRCDIR)
54    AC_SUBST(DIDEROT_LIBDIR)
55    AC_SUBST(DIDEROT_BINDIR)
56    AC_SUBST(DIDEROT_MKDIR)
57    
58    #################### end Paths configuration ####################
59    
60  dnl check for standard programs  dnl check for standard programs
61  dnl  dnl
 AC_PROG_CC([clang gcc cc])  
62  AC_PROG_CPP  AC_PROG_CPP
63    AC_PROG_CC([clang gcc cc])
64    AC_PROG_CXX([clang++ g++ c++])
65    AX_CXX_COMPILE_STDCXX(11,[],[mandatory])
66  AC_PROG_INSTALL  AC_PROG_INSTALL
67  AC_PROG_MAKE_SET  AC_PROG_MAKE_SET
68    
69  dnl FIXME: this works for now, but we should probably switch to libtool  dnl extra compiler options
70  dnl  dnl
71  AC_PATH_PROG(LD, [ld], [none])  CXXFLAGS_BASE="-Wreturn-type -Wuninitialized"
 if test x$LD = xnone ; then  
   AC_MSG_ERROR([cannot find ld command])  
 fi  
 AC_SUBST(LD)  
72    
73  dnl check for c99 support  AC_LANG_PUSH([C++])
74  dnl  AX_GCC_FUNC_ATTRIBUTE(noreturn)
75  AC_PROG_CC_C99  AC_LANG_POP([C++])
 if test x"$ac_cv_prog_cc_c99" = xno ; then  
   AC_MSG_ERROR([Diderot requires c99 support])  
 fi  
76    
77  dnl extra C compiler options  dnl check for SIMD support
78  dnl  dnl
79  CFLAGS=""  AX_EXT
80  CFLAG_M64="-m64"  
81  CFLAGS_BASE="-Wformat -Wreturn-type -Wuninitialized"  AC_ARG_ENABLE([32-bit],
82  AC_SUBST(CFLAG_M64)    AC_HELP_STRING([--enable-32-bit], [configure Diderot to produce 32-bit executables]),
83  AC_SUBST(CFLAGS_BASE)    [CXXFLAG_Mxx="-m32"],
84      [CXXFLAG_Mxx="-m64"])
85    
86    CXXFLAGS="$CXXFLAG_Mxx $CXXFLAGS_BASE"
87    AC_SUBST(CXXFLAG_Mxx)
88    AC_SUBST(CXXFLAGS_BASE)
89    
90  dnl  dnl
91  dnl check for pthreads support  dnl run the compiler tests in 64-bit mode
92  dnl  dnl
93  ACX_PTHREAD()  save_CFLAGS=$CFLAGS
94    CFLAGS="$CFLAGS $CXXFLAG_Mxx"
95    
 dnl check for doxygen  
 dnl  
 AC_ARG_WITH([doxygen],  
   [AS_HELP_STRING([--with-doxygen=PATH], [specify location of doxygen executable])],  
   [DOXYGEN=$with_doxygen],  
   [DOXYGEN=none])  
 if test x$DOXYGEN = xnone ; then  
   # see if we can find doxygen in the user's path  
   AC_PATH_PROG(DOXYGEN, [doxygen], [none])  
 fi  
 if test x$with_doxygen = xyes -o x$with_doxygen = xno ; then  
   AC_MSG_ERROR([--with-doxygen option must specify directory argument])  
 elif test x$DOXYGEN != xnone -a ! -x $DOXYGEN ; then  
   AC_MSG_ERROR([doxygen not found at $DOXYGEN])  
 elif test x$DOXYGEN != xnone ; then  
96  dnl  dnl
97  dnl verify that $DOXYGEN is an absolute path  dnl check for gcc builtin atomic operations
98  dnl  dnl
99    case $DOXYGEN in  AC_MSG_CHECKING([for builtin atomic operations])
100      /*) ;;  AC_LINK_IFELSE(
101      *) AC_MSG_ERROR([--with-doxygen path must be absolute]) ;;     [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
102    esac     AC_MSG_RESULT(yes)
103  fi     AC_DEFINE(
104  if test $DOXYGEN = xnone ; then      [HAVE_BUILTIN_ATOMIC_OPS], 1,
105    DOXYGEN=:      [Define to 1 if gcc compiler provides atomic operations.]),
106  fi     AC_MSG_RESULT(no))
 AC_SUBST(DOXYGEN)  
107    
108  dnl  dnl
109  dnl Look for NVIDIA's nvcc compiler  dnl check endianess
110  dnl  dnl
111  AC_MSG_NOTICE([checking for CUDA and nvcc])  AC_C_BIGENDIAN
112  AC_PATH_PROG(NVCC, nvcc, no, $PATH)  
113  if test x"$NVCC" = xno ; then  #
114    AC_MSG_WARN([nvcc not found])  # determine the sizes of the standard C types
115    CUDA_ENABLED=false  AC_CHECK_SIZEOF([int])
116    NVCC=":"  SIZEOF_C_INT=$ac_cv_sizeof_int
117  else  AC_CHECK_SIZEOF([long])
118    AC_MSG_RESULT([$NVCC])  SIZEOF_C_LONG=$ac_cv_sizeof_long
119    CUDA_ENABLED=true  AC_CHECK_SIZEOF([float])
120  fi  SIZEOF_C_FLOAT=$ac_cv_sizeof_float
121  AC_SUBST(NVCC)  AC_CHECK_SIZEOF([double])
122  AC_SUBST(CUDA_ENABLED)  SIZEOF_C_DOUBLE=$ac_cv_sizeof_double
123    
124    AC_SUBST(SIZEOF_C_INT)
125    AC_SUBST(SIZEOF_C_LONG)
126    AC_SUBST(SIZEOF_C_FLOAT)
127    AC_SUBST(SIZEOF_C_DOUBLE)
128    
129  dnl  dnl
130  dnl check for OpenCL support  dnl restore CFLAGS
131  dnl  dnl
132  CL_LIBS="none"  CFLAGS=$save_CFLAGS
133  case "$host_os" in  
   darwin*) # On Mac OS X we check for installed frameworks  
     AX_CHECK_FRAMEWORK([OpenCL], [CL_LIBS="-framework OpenCL"], [])  
   ;;  
   *)  
     AC_CHECK_LIB([OpenCL],[clGetPlatformIDs],[CL_LIBS="-lOpenCL"])  
   ;;  
 esac  
 if test x"$CL_LIBS" = xnone ; then  
   AC_MSG_WARN([no OpenCL library found])  
   CL_ENABLED=false  
   CL_VERSION=0  
 else  
   CL_ENABLED=true  
   AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h])  
   # check the cl.h header for which version of OpenCL is supported  
   AC_LANG([C])  
   AC_LINK_IFELSE([AC_LANG_PROGRAM([[  
 #include <stdio.h>  
 # ifdef HAVE_CL_CL_H  
 #   include <CL/cl.h>  
 # elif defined(HAVE_OPENCL_CL_H)  
 #   include <OpenCL/cl.h>  
 # else  
 #   error no cl.h  
 # endif]],  
 [[#if defined(CL_VERSION_1_1)  
   printf("11000\n");  
 #elif defined(CL_VERSION_1_0)  
   printf("10000\n");  
 #else  
   printf("0\n");  
 #endif  
     ]])],  
     [CL_VERSION=`./conftest$EXEEXT`], [CL_VERSION=0])  
134  dnl  dnl
135  dnl check to see how we access the host-side vector types.  For OpenCL 1.1,  dnl check for <stdbool.h>, which we use in the C API
 dnl the specification specifies the behavior, but it was unspecified in 1.0.  
136  dnl  dnl
137    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[  AC_HEADER_STDBOOL
138  # ifdef HAVE_CL_CL_H  
 #   include <CL/cl.h>  
 # elif defined(HAVE_OPENCL_CL_H)  
 #   include <OpenCL/cl.h>  
 # else  
 #   error no cl.h  
 # endif]],  
     [[cl_float4 x; x[0] = 0.0;]])],  
     [AC_DEFINE([CL_HOST_VECTORS_ARE_ARRAYS],[1],[host vector types are arrays])],  
139  dnl  dnl
140  dnl not arrays, so try the OpenCL 1.1 structure representation  dnl the C boolean type to use in generated library headers
141  dnl  dnl
142      [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[  if test x"$ac_cv_header_stdbool_h" = xyes ; then
143  # ifdef HAVE_CL_CL_H    BOOLTY="bool"
144  #   include <CL/cl.h>  elif test "x$ac_cv_type__Bool" = xyes; then
145  # elif defined(HAVE_OPENCL_CL_H)    BOOLTY="_Bool"
146  #   include <OpenCL/cl.h>  else
147  # else    BOOLTY="int"
 #   error no cl.h  
 # endif]],  
     [[cl_float4 x; x.s[0] = 0.0;]])],  
     [AC_DEFINE([CL_HOST_VECTORS_ARE_STRUCTS],[1],[host vector types are structs])],  
     [AC_MSG_ERROR([unable to figure out host types for OpenCL vectors])])])  
   # substitutions  
   AC_SUBST(CL_LIBS)  
148  fi  fi
149  AC_SUBST(CL_ENABLED)  AC_SUBST(BOOLTY)
150  AC_SUBST(CL_VERSION)  
151    dnl
152    dnl check for pthreads support
153    dnl
154    ACX_PTHREAD
155    
156  dnl  dnl
157  dnl check for various library routines etc.  dnl check for various library routines etc.
# Line 214  Line 190 
190  AC_CHECK_FUNCS(sigtimedwait nanosleep)  AC_CHECK_FUNCS(sigtimedwait nanosleep)
191    
192  dnl  dnl
 dnl check for sched_setaffinity  
 dnl  
 AC_CHECK_FUNCS(sched_setaffinity)  
   
 dnl  
193  dnl check for pthread_setaffinity_np  dnl check for pthread_setaffinity_np
194  dnl  dnl
195  save_LIBS=$LIBS  save_LIBS=$LIBS
# Line 249  Line 220 
220  dnl  dnl
221  AC_CHECK_FILES(/proc/cpuinfo)  AC_CHECK_FILES(/proc/cpuinfo)
222    
223    dnl check for getcpu and/or sched_getcpu
224    dnl
225    hasGetCPU=no;
226    AC_CHECK_HEADERS([linux/getcpu.h])
227    if test "x$ac_cv_header_linux_getcpu_h" = xyes; then
228      AC_CHECK_FUNCS([getcpu])
229      hasGetCPU=yes;
230    else
231      # getcpu is usually called using syscall
232      #
233      AC_MSG_CHECKING([SYS_getcpu])
234      AC_RUN_IFELSE([AC_LANG_SOURCE([[
235        #define _GNU_SOURCE
236        #include <unistd.h>
237        #include <sys/syscall.h>
238        int main () {
239          unsigned cpu, node;
240          return syscall (SYS_getcpu, &cpu, &node, 0);
241        }
242        ]])],[hasGetCPU=yes],[])
243      AC_MSG_RESULT([$hasGetCPU])
244      if test x"$hasGetCPU" = xyes ; then
245        AC_DEFINE([HAVE_SYS_GETCPU],[1],[Define if SYS_getcpu is defined in <sys/syscall.h>])
246      fi
247    fi
248    if test x"$hasGetCPU" != xyes ; then
249    AC_CHECK_FUNCS([sched_getcpu])
250    fi
251    
252    #################### Linking configuration ####################
253    
254    dnl FIXME: this works for now, but we should probably switch to libtool
255    dnl
256    AC_PATH_PROG(LD, [ld], [none])
257    if test x$LD = xnone ; then
258      AC_MSG_ERROR([cannot find ld command])
259    fi
260    AC_SUBST(LD)
261    
262  dnl  dnl
263  dnl OS-specific linking issues  dnl OS-specific linking issues
264  dnl  dnl
265  LD_NEEDS_RPATH=false;  LD_NEEDS_RPATH=false;
266  LIBM=""  CXXFLAG_fPIC=""
267    LDFLAG_LIBM=""
268  case "$host_os" in  case "$host_os" in
269    darwin*) # On Mac OS X we check for the presence of macports and/or fink    darwin*)
270      # On Mac OS X we check for the presence of homebrew, macports, and fink.
271      # we set up the search paths in priority homebrew > macports > fink.
272        if test -x /sw/bin/fink ; then
273          LDPATHS="-L/sw/lib"
274        fi
275      if test -x /opt/local/bin/port ; then      if test -x /opt/local/bin/port ; then
276        HAS_MACPORTS=yes        LDPATHS="-L/opt/local/lib $LDPATHS"
     else  
       HAS_MACPORTS=no  
277      fi      fi
278      if test -x /sw/bin/fink ; then      if test -d /usr/local/Cellar -a /usr/local/bin/brew ; then
279        HAS_FINK=yes        LDPATHS="-L/usr/local/lib $LDPATHS"
     else  
       HAS_FINK=no  
280      fi      fi
281        DSLEXT="dylib"
282        LD_STATIC=$LD
283        LD_DYNAMIC="$CXX -dynamiclib"
284    ;;    ;;
285    linux*) # On Linux we include the -rpath option to pick up dynamically-loaded libraries    linux*)
286      # On Linux we include the -rpath option to pick up dynamically-loaded libraries
287      # and the -fPIC compiler flag to generate position-indenpendent code
288      LD_NEEDS_RPATH=true      LD_NEEDS_RPATH=true
289      LIBM="-lm"      LDFLAG_LIBM="-lm"
290        CXXFLAG_fPIC="-fPIC"
291        DSLEXT="so"
292        LD_STATIC=$LD
293        LD_DYNAMIC="$CXX -shared"
294    ;;    ;;
295  esac  esac
296    
297  if test x"$HAS_MACPORTS" = xyes ; then  AC_SUBST(LD_STATIC)
298    LDPATHS="-L/opt/local/lib"  AC_SUBST(LD_DYNAMIC)
 elif test x"$HAS_FINK" = xyes ; then  
   LDPATHS="-L/sw/lib"  
 else  
   LDPATHS=""  
 fi  
299  AC_SUBST(LDPATHS)  AC_SUBST(LDPATHS)
300  AC_SUBST(LD_NEEDS_RPATH)  AC_SUBST(LD_NEEDS_RPATH)
301  AC_SUBST(LIBM)  AC_SUBST(LDFLAG_LIBM)
302    AC_SUBST(CXXFLAG_fPIC)
303    AC_SUBST(DSLEXT)
304    
305    #################### end Linking configuration ####################
306    
307    #################### Logging configuration ####################
308    
309    LOGGING_ENABLED=false
310    AC_ARG_ENABLE([event-logging],
311      AC_HELP_STRING([--enable-event-logging], [include event-logging support for parallel target]),
312      [LOGGING_ENABLED=true],
313      [LOGGING_ENABLED=false])
314    
315    AC_SUBST(LOGGING_ENABLED)
316    
317    #################### end Logging configuration ####################
318    
319    #################### Diderot Debugger configuration ####################
320    
321    DEBUGGER_ENABLED=false
322    AC_ARG_ENABLE([debugger],
323      AC_HELP_STRING([--enable-debugger], [build the Diderot debugger (experimental)]),
324      [DEBUGGER_ENABLED=true],
325      [DEBUGGER_ENABLED=false])
326    
327    AC_SUBST(DEBUGGER_ENABLED)
328    
329    #################### end Diderot Debugger configuration ####################
330    
331    #################### CUDA configuration ####################
332    
333    AC_ARG_ENABLE([cuda],
334      AC_HELP_STRING([--enable-cuda], [include support for targeting CUDA]))
335    
336    if test "${enable_cuda+set}" = set ; then
337    dnl
338    dnl Look for NVIDIA's nvcc compiler
339    dnl
340      AC_MSG_NOTICE([checking for CUDA and nvcc])
341      AC_PATH_PROG(NVCC, nvcc, no, $PATH)
342      if test x"$NVCC" = xno ; then
343        AC_MSG_WARN([nvcc not found])
344        CUDA_ENABLED=false
345        NVCC=":"
346      else
347        AC_MSG_RESULT([$NVCC])
348        CUDA_ENABLED=true
349      fi
350    else
351      NVCC=":"
352      CUDA_ENABLED=false
353    fi
354    AC_SUBST(NVCC)
355    AC_SUBST(CUDA_ENABLED)
356    AC_SUBST(LIBS_CUDA)     # TODO
357    AC_SUBST(CPPFLAGS_CUDA) # TODO
358    
359    #################### end CUDA configuration ####################
360    
361    #################### OpenCL configuration ####################
362    
363    AC_ARG_ENABLE([opencl],
364      AC_HELP_STRING([--enable-opencl], [include support for targeting OpenCL]))
365    
366    if test "${enable_opencl+set}" = set ; then
367    
368    dnl
369    dnl check for OpenCL support
370    dnl
371      LIBS_CL="none"
372      case "$host_os" in
373        darwin*) # On Mac OS X we check for installed frameworks
374          AX_CHECK_FRAMEWORK([OpenCL], [LIBS_CL="-framework OpenCL"], [])
375        ;;
376        *)
377          AC_CHECK_LIB([OpenCL],[clGetPlatformIDs],[LIBS_CL="-lOpenCL"])
378        ;;
379      esac
380      if test x"$LIBS_CL" = xnone ; then
381        AC_MSG_WARN([no OpenCL library found])
382        CL_ENABLED=false
383        CL_VERSION=0
384      else
385        CL_ENABLED=true
386        CPPFLAGS_CL=""
387        CL_HEADER=""
388        AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h], [HAVE_CL_H="yes"; CL_HEADER="$ac_header"; break], [HAVE_CL_H="no"])
389        if test x"$HAVE_CL_H" = xno ; then
390          # check for AMD's SDK
391          AC_MSG_CHECKING([for cl.h in AMD's SDK])
392          if test -d /opt/AMDAPP/include/CL ; then
393            HAVE_CL_H="yes"
394            CL_HEADER="/opt/AMDAPP/include/CL/cl.h"
395            AC_DEFINE([HAVE_CL_CL_H])
396            CPPFLAGS_CL="-I/opt/AMDAPP/include"
397          fi
398          AC_MSG_RESULT([$HAVE_CL_H])
399        fi
400        if test x"$HAVE_CL_H" = xno ; then
401          # check for NVIDIA's SDK
402          AC_MSG_CHECKING([for NVIDIA's SDK cl.h])
403          CUDA_HOME=none
404          for CUDA in cuda cuda-7.0 cuda-6.5 cuda-6.0 ; do
405            if test -d /usr/local/$CUDA/include/CL ; then
406              CUDA_HOME=/usr/local/$CUDA
407              break
408            fi
409          done
410          if test x"$CUDA_HOME" != xnone ; then
411            HAVE_CL_H="yes"
412            CL_HEADER="$CUDA_HOME/include/CL/cl.h"
413            AC_DEFINE([HAVE_CL_CL_H])
414            CPPFLAGS_CL="-I$CUDA_HOME/include"
415          fi
416          AC_MSG_RESULT([$HAVE_CL_H])
417        fi
418        if test x"$HAVE_CL_H" = xno ; then
419          AC_MSG_WARN([no cl.h found])
420          CL_ENABLED=false
421          CL_VERSION=0
422          SIZEOF_CL_INT=0
423          SIZEOF_CL_LONG=0
424          SIZEOF_CL_FLOAT=0
425          SIZEOF_CL_DOUBLE=0
426        else
427          # check the cl.h header for which version of OpenCL is supported
428          AC_LANG([C])
429          save_CPPFLAGS=$CPPFLAGS
430          CPPFLAGS="$CPPFLAGS_CL $CPPFLAGS"
431          AC_LINK_IFELSE([AC_LANG_PROGRAM([[
432    #include <stdio.h>
433    # ifdef HAVE_CL_CL_H
434    #   include <CL/cl.h>
435    # elif defined(HAVE_OPENCL_CL_H)
436    #   include <OpenCL/cl.h>
437    # else
438    #   error no cl.h
439    # endif]],
440    [[#if defined(CL_VERSION_1_2)
441      printf("120\n");
442    #elif defined(CL_VERSION_1_1)
443      printf("110\n");
444    #elif defined(CL_VERSION_1_0)
445      printf("100\n");
446    #else
447      printf("0\n");
448    #endif
449            ]])],
450            [CL_VERSION=`./conftest$EXEEXT`], [CL_VERSION=0])
451    dnl
452    dnl check to see how we access the host-side vector types.  For OpenCL 1.1,
453    dnl the specification specifies the behavior, but it was unspecified in 1.0.
454    dnl
455          AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
456      #include "$CL_HEADER"
457      ]],
458            [[cl_float4 x; x[0] = 0.0;]])],
459            [AC_DEFINE([CL_HOST_VECTORS_ARE_ARRAYS],[1],[host vector types are arrays])],
460      dnl
461      dnl not arrays, so try the OpenCL 1.1 structure representation
462      dnl
463            [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
464    #include "$CL_HEADER"
465    ]],
466            [[cl_float4 x; x.s[0] = 0.0;]])],
467            [AC_DEFINE([CL_HOST_VECTORS_ARE_STRUCTS],[1],[host vector types are structs])],
468            [AC_MSG_ERROR([unable to figure out host types for OpenCL vectors])])])
469        # restore saved CPPFLAGS
470          CPPFLAGS=$save_CPPFLAGS
471        # substitutions
472          AC_SUBST(LIBS_CL)
473          AC_SUBST(CPPFLAGS_CL)
474        #
475        # determine the sizes of the host-side OpenCL types
476        AC_CHECK_SIZEOF([cl_int], [], [#include "$CL_HEADER"])
477        SIZEOF_CL_INT=$ac_cv_sizeof_cl_int
478        AC_CHECK_SIZEOF([cl_long], [], [#include "$CL_HEADER"])
479        SIZEOF_CL_LONG=$ac_cv_sizeof_cl_long
480        AC_CHECK_SIZEOF([cl_float], [], [#include "$CL_HEADER"])
481        SIZEOF_CL_FLOAT=$ac_cv_sizeof_cl_float
482        AC_CHECK_SIZEOF([cl_double], [], [#include "$CL_HEADER"])
483        SIZEOF_CL_DOUBLE=$ac_cv_sizeof_cl_double
484        fi
485      fi
486    else
487      CL_ENABLED=false
488      CL_VERSION="0"
489      SIZEOF_CL_INT="0"
490      SIZEOF_CL_LONG="0"
491      SIZEOF_CL_FLOAT="0"
492      SIZEOF_CL_DOUBLE="0"
493    fi
494    
495    AC_SUBST(CL_ENABLED)
496    AC_SUBST(CL_VERSION)
497    AC_DEFINE_UNQUOTED(DIDEROT_CL_VERSION,[$CL_VERSION],[version of OpenCL supported by system])
498    
499    AC_SUBST(SIZEOF_CL_INT)
500    AC_SUBST(SIZEOF_CL_LONG)
501    AC_SUBST(SIZEOF_CL_FLOAT)
502    AC_SUBST(SIZEOF_CL_DOUBLE)
503    
504    #################### end OpenCL configuration ####################
505    
506    #################### Teem configuration ####################
507    
508    dnl get the path to the TEEM installation.  We need this to build the Diderot
509    dnl runtime code and we use the path when searching for teem in the Diderot
510    dnl compiler.
511  dnl  dnl
512  dnl get the path to the TEEM installation  
513    dnl the path can be specified using "--with-teem=..." too
514  dnl  dnl
515  AC_ARG_WITH(teem,  AC_ARG_WITH(teem,
516    AC_HELP_STRING([--with-teem=<path>], [specify path to teem installation]),    AC_HELP_STRING([--with-teem=<path>], [specify path to teem installation]),
517    [ac_cv_use_teem=$withval], [ac_cv_use_teem=no])    [ac_cv_use_teem=$withval], [ac_cv_use_teem=no])
518    
519  if test x"$ac_cv_use_teem" = xno ; then  if test x"$ac_cv_use_teem" = xno ; then
520    dnl search for Teem in some standard places
521    dnl
522      AC_MSG_CHECKING([for teem])
523    TEEM_DIR=none    TEEM_DIR=none
524      POSSIBLE_TEEM_DIRS="/usr/local/teem /usr/local"
525      for dir in $POSSIBLE_TEEM_DIRS ; do
526        if test -f $dir/include/teem/nrrd.h ; then
527          TEEM_DIR=$dir
528          AC_MSG_RESULT([$TEEM_DIR])
529          break
530        fi
531      done
532      if test $TEEM_DIR = none ; then
533        AC_MSG_ERROR([unable to find teem; use --with-teem option to specify location])
534      fi
535  else  else
536    AC_MSG_CHECKING([path to teem ($ac_cv_use_teem)])    AC_MSG_CHECKING([path to teem ($ac_cv_use_teem)])
537    case $ac_cv_use_teem in    case $ac_cv_use_teem in
# Line 302  Line 542 
542      TEEM_DIR=$ac_cv_use_teem      TEEM_DIR=$ac_cv_use_teem
543      # check that TEEM_DIR actually points to something that looks like teem      # check that TEEM_DIR actually points to something that looks like teem
544      if test -f $TEEM_DIR/include/teem/nrrd.h ; then      if test -f $TEEM_DIR/include/teem/nrrd.h ; then
545        AC_MSG_RESULT([ okay])        AC_MSG_RESULT([yes])
546      else      else
547        TEEM_DIR=none        TEEM_DIR=none
548        AC_MSG_RESULT([ invalid])        AC_MSG_RESULT([invalid path to teem])
549      fi      fi
550    else    else
551      TEEM_DIR=none      TEEM_DIR=none
552      AC_MSG_RESULT([ invalid])      AC_MSG_RESULT([invalid path to teem])
553    fi    fi
554  fi  fi
555  if test x"$TEEM_DIR" = xnone ; then  if test x"$TEEM_DIR" = xnone ; then
556    AC_MSG_ERROR([unable to find teem])    AC_MSG_ERROR([unable to find teem])
557  fi  fi
558    dnl
559    dnl check that teem supports the nrrdMetaDataNormalize function
560    dnl
561    save_LDFLAGS=$LDFLAGS
562    save_LIBS=$LIBS
563    LDFLAGS="$LDFLAGS -L$TEEM_DIR/lib"
564    LIBS="$LIBS -lteem -lm"
565    AC_CHECK_FUNCS([nrrdMetaDataNormalize])
566    LDFLAGS=$save_LDFLAGS
567    LIBS=$save_LIBS
568    
569    if test "x$ac_cv_func_nrrdMetaDataNormalize" != xyes; then
570      AC_MSG_ERROR(["please update your teem installation"])
571    fi
572    
573  AC_SUBST(TEEM_DIR)  AC_SUBST(TEEM_DIR)
574    
575  dnl ******************** SML/NJ configuration ********************  #################### end Teem configuration ####################
576    
577    #################### SML configuration ####################
578    
579    dnl
580    dnl We support building with both SML/NJ (the default) or MLton.
581    dnl
582    
583    dnl first check for --with-mlton=path flag
584  dnl  dnl
585    AC_ARG_WITH([mlton],
586      [AS_HELP_STRING([--with-mlton=<path-to-mlton>],
587        [use the MLton Standard ML compiler to build Diderot])],
588      [with_mlton=yes],[with_mlton=no])
589    if test x"$with_mlton" = xyes ; then
590      if test x"$ac_cv_path_with_mlton" = x ; then
591        # look for mlton in the PATH
592        AC_PATH_PROGS(with_mlton, mlton, no)
593        if test x"$MLTON" = xno ; then
594          AC_MSG_ERROR([unable to find mlton executable; please specify the path])
595        fi
596      else
597        with_mlton=$ac_cv_path_with_mlton
598        case $with_mlton in
599          /*) ;;
600          *) AC_MSG_ERROR([please specify absolute path for mlton executable]) ;;
601        esac
602        if test ! -x $with_mlton ; then
603          AC_MSG_ERROR([invalid path for mlton; $with_mlton is not executable])
604        fi
605      fi
606    fi
607    
608    if test x"$with_mlton" = xno ; then
609      # we are using SML/NJ
610      #
611    
612  dnl check that we have a compatible version of SML/NJ  dnl check that we have a compatible version of SML/NJ
613  dnl  dnl
614  CHECK_SMLNJ([AC_MSG_ERROR([unable to find SML/NJ installation; check your PATH or set SMLNJ_CMD])])    CHECK_SMLNJ([AC_MSG_ERROR([unable to find SML/NJ installation; please add it to your PATH or set SML_CMD])])
615  if test $SMLNJ_MAJOR_VERSION -lt 110 \  if test $SMLNJ_MAJOR_VERSION -lt 110 \
616    -o $SMLNJ_MINOR_VERSION -lt 73      -o $SMLNJ_MINOR_VERSION -lt 80
617  then  then
618    AC_MSG_ERROR([installation requires SML/NJ version 110.73+])      AC_MSG_ERROR([installation requires SML/NJ version 110.80+ (available from smlnj.org)])
619  fi  fi
 AC_SUBST(SMLNJ_VERSION)  
620    
621  dnl determine the heap-image suffix  dnl determine the heap-image suffix
622  dnl  dnl
# Line 337  Line 625 
625    
626  dnl look for ml-makedepend  dnl look for ml-makedepend
627  dnl  dnl
 AC_MSG_CHECKING([for ml-makedepend])  
628  tmpPATH="$SMLNJ_PATH:$PATH"  tmpPATH="$SMLNJ_PATH:$PATH"
629  AC_PATH_PROG(ML_MAKEDEPEND, ml-makedepend, ":", $tmpPATH)  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  
630  AC_SUBST(ML_MAKEDEPEND)  AC_SUBST(ML_MAKEDEPEND)
631    
632  dnl  dnl
# Line 356  Line 638 
638    AC_MSG_ERROR([ml-build not found])    AC_MSG_ERROR([ml-build not found])
639  fi  fi
640  AC_SUBST(ML_BUILD)  AC_SUBST(ML_BUILD)
641      SML=smlnj
 dnl ******************** Paths ********************  
   
 DIDEROT_ROOT=`pwd`  
 DIDEROT_DOCDIR=$DIDEROT_ROOT/doc  
 DIDEROT_SRCDIR=$DIDEROT_ROOT/src  
 DIDEROT_LIBDIR=$DIDEROT_ROOT/lib  
 DIDEROT_BINDIR=$DIDEROT_ROOT/bin  
 DIDEROT_MKDIR=$DIDEROT_ROOT/mk  
642    
643  HEAP_IMAGE_DIR=$DIDEROT_BINDIR/.heap  HEAP_IMAGE_DIR=$DIDEROT_BINDIR/.heap
644  INSTALL_SMLNJ_WRAPPER=$DIDEROT_BINDIR/install-sml-wrapper.sh  INSTALL_SMLNJ_WRAPPER=$DIDEROT_BINDIR/install-sml-wrapper.sh
   
 AC_SUBST(DIDEROT_ROOT)  
 AC_SUBST(DIDEROT_DOCDIR)  
 AC_SUBST(DIDEROT_SRCDIR)  
 AC_SUBST(DIDEROT_LIBDIR)  
 AC_SUBST(DIDEROT_BINDIR)  
 AC_SUBST(DIDEROT_MKDIR)  
645  AC_SUBST(HEAP_IMAGE_DIR)  AC_SUBST(HEAP_IMAGE_DIR)
646  AC_SUBST(INSTALL_SMLNJ_WRAPPER)  AC_SUBST(INSTALL_SMLNJ_WRAPPER)
647    
648  dnl  else
649  dnl ******************** C compiler properties ********************  
650  dnl    # we are using MLton
651      MLTON=$with_mlton
652      AC_SUBST(MLTON)
653      SML=mlton
654    
655    fi
656    AC_SUBST(SML)
657    
658    #################### end SML configuration ####################
659    
660    #################### Documentation tools configuration ####################
661    
662    dnl check for doxygen
663  dnl  dnl
664  dnl run the compiler tests in 64-bit mode  AC_ARG_WITH([doxygen],
665      [AS_HELP_STRING([--with-doxygen=<path>], [specify location of doxygen executable])],
666      [DOXYGEN=$with_doxygen],
667      [DOXYGEN=none])
668    if test x$DOXYGEN = xnone ; then
669      # see if we can find doxygen in the user's path
670      AC_PATH_PROG(DOXYGEN, [doxygen], [none])
671    fi
672    if test x$with_doxygen = xyes -o x$with_doxygen = xno ; then
673      AC_MSG_ERROR([--with-doxygen option must specify directory argument])
674    elif test x$DOXYGEN != xnone -a ! -x $DOXYGEN ; then
675      AC_MSG_ERROR([doxygen not found at $DOXYGEN])
676    elif test x$DOXYGEN != xnone ; then
677  dnl  dnl
678  save_CFLAGS=$CFLAGS  dnl verify that $DOXYGEN is an absolute path
 CFLAGS="$CFLAGS $CFLAG_M64"  
   
679  dnl  dnl
680  dnl check for gcc builtin atomic operations    case $DOXYGEN in
681        /*) ;;
682        *) AC_MSG_ERROR([--with-doxygen path must be absolute]) ;;
683      esac
684    fi
685    if test $DOXYGEN = xnone ; then
686      DOXYGEN=:
687    fi
688    AC_SUBST(DOXYGEN)
689    
690    dnl check for asciidoctor
691  dnl  dnl
692  AC_MSG_CHECKING([for builtin atomic operations])  AC_PATH_PROGS([ASCIIDOCTOR], [asciidoctor], [none])
693  AC_LINK_IFELSE(  AC_SUBST(ASCIIDOCTOR)
    [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],  
    AC_MSG_RESULT(yes)  
    AC_DEFINE(  
     [HAVE_BUILTIN_ATOMIC_OPS], 1,  
     [Define to 1 if gcc compiler provides atomic operations.]),  
    AC_MSG_RESULT(no))  
694    
695  AC_C_BIGENDIAN  #################### end Documentation tools configuration ####################
696    
697  dnl  #################### Diderot Debugger configuration ####################
 dnl restore CFLAGS  
 dnl  
 CFLAGS=$save_CFLAGS  
698    
699    dnl The debugger is under development
700  dnl  dnl
701  dnl ******************** config.h stuff ********************  
702    dnl if the debugger is enabled, then include its makefile and
703    dnl look for wxwidgets
704  dnl  dnl
705    if test x"$DEBUGGER_ENABLED" = xtrue ; then
706      DEBUGGER_MAKEFILE=src/debugger/build/Makefile
707      search_path="$PATH$PATH_SEPARATOR/usr/local/bin$PATH_SEPARATOR/opt/local/bin"
708      AC_PATH_PROG([WX_CONFIG], [wx-config], [none], [$search_path])
709      if test x"$WX_CONFIG" = xnone ; then
710        AC_MSG_ERROR([unable to find wx-config, which is required by the Diderot debugger])
711      fi
712    else
713      DEBUGGER_MAKEFILE=
714    fi
715    
716    #################### end Diderot Debugger configuration ####################
717    
718    #################### config.h ####################
719    
720  AC_DEFINE_UNQUOTED(DIDEROT_INCLUDE_PATH,["$DIDEROT_SRCDIR/include"], [path for Diderot header files])  AC_DEFINE_UNQUOTED(DIDEROT_INCLUDE_PATH,["$DIDEROT_SRCDIR/lib/include"], [path for Diderot header files])
721    
722  AH_TOP([  AH_TOP([
723  /*  /*
724   * COPYRIGHT (c) 2011 Diderot project. (http://diderot-language.cs.uchicago.edu)   * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
725   * All rights reserved.   *
726     * COPYRIGHT (c) 2016 The University of Chicago * All rights reserved.
727   */   */
728    
729  #ifndef _DIDEROT_CONFIG_H_  #ifndef _DIDEROT_CONFIG_H_
# Line 428  Line 735 
735  #endif /* !_DIDEROT_CONFIG_H_ */  #endif /* !_DIDEROT_CONFIG_H_ */
736  ])  ])
737    
738  dnl  #################### end config.h ####################
739  dnl ******************** write output ********************  
740  dnl  #################### write output ####################
741    
742    dnl The Makefile for the compiler depends on which SML system we are
743    dnl using.
744    if test x"$SML" = xmlton ; then
745      COMPILER_MAKEFILE_IN=":src/compiler/Makefile_mlton.in"
746      FRAG_GEN_MAKEFILE="src/compiler/gen/fragments/Makefile"
747    else
748      COMPILER_MAKEFILE_IN=""
749      FRAG_GEN_MAKEFILE=
750    fi
751    
752  AC_CONFIG_FILES(  AC_CONFIG_FILES(
753  dnl  dnl
754  dnl ***** Makefiles *****  dnl ***** Makefiles *****
755    Makefile    Makefile
756    doc/Makefile  dnl  doc/Makefile
757    src/clinfo/Makefile    doc/src/man/Makefile
758    src/dnorm/Makefile  dnl  src/clinfo/Makefile
759    src/compiler/Makefile    src/compiler/Makefile"$COMPILER_MAKEFILE_IN"
760      $FRAG_GEN_MAKEFILE
761      $DEBUGGER_MAKEFILE
762    src/lib/build/Makefile    src/lib/build/Makefile
763    src/lib/build/mk/build.gmk:src/lib/build/mk/build_gmk.in    src/lib/build/mk/build.gmk:src/lib/build/mk/build_gmk.in
   test/MIP/Makefile  
   test/probe/Makefile  
   test/iso2d-polyline/Makefile  
   test/vr-lite-cam/Makefile  
764  dnl  dnl
765  dnl ***** SML source files *****  dnl ***** SML source files *****
766    src/compiler/fields/run-dnorm.sml:src/compiler/fields/run-dnorm_sml.in    src/compiler/nrrd/run-dnorm.sml:src/compiler/nrrd/run-dnorm_sml.in
767    src/compiler/common/paths.sml:src/compiler/common/paths_sml.in    src/compiler/common/paths.sml:src/compiler/common/paths_sml.in
768      src/compiler/common/size-of.sml:src/compiler/common/size-of_sml.in
769      src/compiler/options/version.sml:src/compiler/options/version_sml.in
770  )  )
771    
772  AC_CONFIG_HEADERS(src/include/Diderot/config.h:config/config_h.in)  AC_CONFIG_HEADERS(src/lib/include/diderot/config.h:config/config_h.in)
773    
774  dnl  dnl
775  dnl shell scripts  dnl shell scripts
# Line 461  Line 778 
778    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in
779  ], [chmod +x bin/install-sml-wrapper.sh])  ], [chmod +x bin/install-sml-wrapper.sh])
780  AC_CONFIG_FILES([  AC_CONFIG_FILES([
781    src/compiler/gen/file2str/file2str.sh:src/compiler/gen/file2str/file2str_sh.in    src/compiler/gen/fragments/mkfrags.sh:src/compiler/gen/fragments/mkfrags_sh.in
782  ], [chmod +x src/compiler/gen/file2str/file2str.sh])  ], [chmod +x src/compiler/gen/fragments/mkfrags.sh])
783    AC_CONFIG_FILES([
784      src/compiler/gen/fragments/mkmk.sh:src/compiler/gen/fragments/mkmk_sh.in
785    ], [chmod +x src/compiler/gen/fragments/mkmk.sh])
786    
787    dnl
788    dnl additional files for logging tools
789    dnl
790    if test x"$LOGGING_ENABLED" = xtrue ; then
791      AC_CONFIG_FILES([
792        src/logging/gen/Makefile
793        src/logging/log-analyze/Makefile
794        src/logging/log-dump/Makefile
795        src/logging/gen/log-gen.sh:src/logging/gen/log-gen_sh.in
796        src/logging/gen/main.sml:src/logging/gen/main_sml.in
797        src/logging/lib/default-log-paths.hxx:src/logging/lib/default-log-paths_hxx.in
798      ], [chmod +x src/logging/gen/log-gen.sh])
799    fi
800    
801  dnl  dnl
802  dnl generate makefiles for runtime library builds  dnl generate makefiles for runtime library builds
803  dnl  dnl
804  dnl usage: MK_BUILD_DIR(<build-dir>, <target-platform>, <options>)  dnl usage: MK_BUILD_DIR(<build-dir>, <target-platform>, <options>)
805  dnl  dnl
806    dnl where the options are taken from [debug, parallel]
807    dnl
808  AC_DEFUN([MK_BUILD_DIR], [  AC_DEFUN([MK_BUILD_DIR], [
809      if test ! -d src/lib/build/$1 ; then      if test ! -d src/lib/build/$1 ; then
810        mkdir src/lib/build/$1        mkdir src/lib/build/$1
# Line 481  Line 817 
817      AC_CONFIG_FILES(src/lib/build/$1/Makefile)      AC_CONFIG_FILES(src/lib/build/$1/Makefile)
818    ])    ])
819    
820  MK_BUILD_DIR(rt-c-f, c, [float])  MK_BUILD_DIR(rt-seq, sequential, [])
821  MK_BUILD_DIR(rt-c-d, c, [double])  MK_BUILD_DIR(rt-seq-debug, sequentiagetcpul, [debug])
822  MK_BUILD_DIR(rt-c-f-debug, c, [float debug])  MK_BUILD_DIR(rt-par, parallel, [parallel])
823  MK_BUILD_DIR(rt-c-d-debug, c, [double debug])  MK_BUILD_DIR(rt-par-debug, parallel, [parallel debug])
824  MK_BUILD_DIR(rt-c-f-par, parallel, [parallel float])  
825  MK_BUILD_DIR(rt-c-d-par, parallel, [parallel double])  if test x"$LOGGING_ENABLED" = xtrue ; then
826  MK_BUILD_DIR(rt-c-f-par-debug, parallel, [parallel float debug])    MK_BUILD_DIR(rt-par-log, parallel, [parallel logging])
 MK_BUILD_DIR(rt-c-d-par-debug, parallel, [parallel double debug])  
   
 if test x"$CL_ENABLED" = xtrue ; then  
   MK_BUILD_DIR(rt-cl-f, cl, [exec float])  
   MK_BUILD_DIR(rt-cl-d, cl, [exec double])  
   MK_BUILD_DIR(rt-cl-f-debug, cl, [exec float debug])  
   MK_BUILD_DIR(rt-cl-d-debug, cl, [exec double debug])  
827  fi  fi
828    
829    #if test x"$CL_ENABLED" = xtrue ; then
830    #  MK_BUILD_DIR(rt-cl-f, opencl, [float])
831    #  MK_BUILD_DIR(rt-cl-d, opencl, [double])
832    #  MK_BUILD_DIR(rt-cl-f-debug, opencl, [float debug])
833    #  MK_BUILD_DIR(rt-cl-d-debug, opencl, [double debug])
834    #fi
835    
836  AC_OUTPUT  AC_OUTPUT
837    
838    #################### end write output ####################

Legend:
Removed from v.1725  
changed lines
  Added in v.5571

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