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

trunk/configure.ac revision 436, Tue Oct 19 14:35:45 2010 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  dnl NOTE: MANTICORE_DIST_VERSION is an M4 variable defined in config/aclocal.m4  AC_INIT(diderot,2.0,)
 dnl  
 AC_INIT(diderot,0.1,)  
10    
11  AC_PREREQ(2.60)  AC_PREREQ(2.60)
12  AC_COPYRIGHT([[COPYRIGHT (c) 2010 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)
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_C99  
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 extra compiler options
70    dnl
71    CXXFLAGS_BASE="-Wreturn-type -Wuninitialized"
72    
73    AC_LANG_PUSH([C++])
74    AX_GCC_FUNC_ATTRIBUTE(noreturn)
75    AC_LANG_POP([C++])
76    
77    dnl check for SIMD support
78    dnl
79    AX_EXT
80    
81    AC_ARG_ENABLE([32-bit],
82      AC_HELP_STRING([--enable-32-bit], [configure Diderot to produce 32-bit executables]),
83      [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
91    dnl run the compiler tests in 64-bit mode
92    dnl
93    save_CFLAGS=$CFLAGS
94    CFLAGS="$CFLAGS $CXXFLAG_Mxx"
95    
96    dnl
97    dnl check for gcc builtin atomic operations
98    dnl
99    AC_MSG_CHECKING([for builtin atomic operations])
100    AC_LINK_IFELSE(
101       [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
102       AC_MSG_RESULT(yes)
103       AC_DEFINE(
104        [HAVE_BUILTIN_ATOMIC_OPS], 1,
105        [Define to 1 if gcc compiler provides atomic operations.]),
106       AC_MSG_RESULT(no))
107    
108    dnl
109    dnl check endianess
110    dnl
111    AC_C_BIGENDIAN
112    
113    #
114    # determine the sizes of the standard C types
115    AC_CHECK_SIZEOF([int])
116    SIZEOF_C_INT=$ac_cv_sizeof_int
117    AC_CHECK_SIZEOF([long])
118    SIZEOF_C_LONG=$ac_cv_sizeof_long
119    AC_CHECK_SIZEOF([float])
120    SIZEOF_C_FLOAT=$ac_cv_sizeof_float
121    AC_CHECK_SIZEOF([double])
122    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
130    dnl restore CFLAGS
131    dnl
132    CFLAGS=$save_CFLAGS
133    
134    dnl
135    dnl check for <stdbool.h>, which we use in the C API
136    dnl
137    AC_HEADER_STDBOOL
138    
139    dnl
140    dnl the C boolean type to use in generated library headers
141    dnl
142    if test x"$ac_cv_header_stdbool_h" = xyes ; then
143      BOOLTY="bool"
144    elif test "x$ac_cv_type__Bool" = xyes; then
145      BOOLTY="_Bool"
146    else
147      BOOLTY="int"
148    fi
149    AC_SUBST(BOOLTY)
150    
151    dnl
152    dnl check for pthreads support
153    dnl
154    ACX_PTHREAD
155    
156    dnl
157    dnl check for various library routines etc.
158    dnl
159    AC_CHECK_FUNCS(posix_memalign)
160    if test x"$ac_cv_func_posix_memalign" != xyes ; then
161      AC_CHECK_FUNCS(memalign)
162      if test x"$ac_cv_func_posix_memalign" != xyes ; then
163        AC_CHECK_FUNCS(valloc)
164      fi
165    fi
166    
167    AC_CHECK_FUNCS(mach_absolute_time)
168    AC_CHECK_TYPES([struct timespec])
169    AC_CHECK_FUNCS(pthread_barrier_init)
170    
171    dnl
172    dnl check for clock_gettime.  On Linux, this requires librt.
173    dnl
174    save_LIBS=$LIBS
175    LIBS="-lrt $LIBS"
176    AC_MSG_CHECKING([for clock_gettime])
177    AC_LINK_IFELSE(
178      [AC_LANG_PROGRAM(
179        [[#include <time.h>]],
180        [[struct timespec t; clock_gettime(CLOCK_REALTIME, &t); ]])],
181      [ ac_cv_func_clock_gettime=yes;
182        AC_DEFINE(HAVE_CLOCK_GETTIME, [1], [is clock_gettime available?])],
183      [ac_cv_func_clock_gettime=no])
184    AC_MSG_RESULT($ac_cv_func_clock_gettime)
185    if test "$ac_cv_func_clock_gettime" = "no" ; then
186      LIBS=$save_LIBS
187    fi
188    
189    AC_CHECK_FUNCS(pthread_getcpuclockid)
190    AC_CHECK_FUNCS(sigtimedwait nanosleep)
191    
192    dnl
193    dnl check for pthread_setaffinity_np
194  dnl  dnl
195  dnl If we are on Mac OS X, check for the presence of macports and/or fink  save_LIBS=$LIBS
196    save_CFLAGS=$CFLAGS
197    LIBS="$PTHREAD_LIBS $LIBS"
198    CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
199    AC_MSG_CHECKING([for pthread_setaffinity_np])
200    AC_LINK_IFELSE(
201      [AC_LANG_PROGRAM(
202        [[#include <pthread.h>]],
203        [[cpu_set_t s; pthread_setaffinity_np(pthread_self(), sizeof(s), &s); ]])],
204      [ ac_cv_func_pthread_setaffinity_np=yes;
205        AC_DEFINE(HAVE_PTHREAD_SETAFFINITY_NP, [1], [is pthread_setaffinity_np available?])],
206      [ac_cv_func_pthread_setaffinity_np=no])
207    AC_MSG_RESULT($ac_cv_func_pthread_setaffinity_np)
208    LIBS=$save_LIBS
209    CFLAGS=$save_CFLAGS
210    
211    dnl
212    dnl check for Linux NUMA support (libnuma)
213    dnl
214    AC_CHECK_LIB(numa,numa_available)
215    if test "$ac_cv_lib_numa_numa_available" = "yes" ; then
216      PTHREAD_LIBS="$PTHREAD_LIBS -lnuma"
217    fi
218    
219    dnl check for /proc/cpuinfo
220  dnl  dnl
221    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
263    dnl OS-specific linking issues
264    dnl
265    LD_NEEDS_RPATH=false;
266    CXXFLAG_fPIC=""
267    LDFLAG_LIBM=""
268  case "$host_os" in  case "$host_os" in
269    darwin*) # On Mac OS X we check for installed frameworks    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"
277        fi
278        if test -d /usr/local/Cellar -a /usr/local/bin/brew ; then
279          LDPATHS="-L/usr/local/lib $LDPATHS"
280        fi
281        DSLEXT="dylib"
282        LD_STATIC=$LD
283        LD_DYNAMIC="$CXX -dynamiclib"
284      ;;
285      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
289        LDFLAG_LIBM="-lm"
290        CXXFLAG_fPIC="-fPIC"
291        DSLEXT="so"
292        LD_STATIC=$LD
293        LD_DYNAMIC="$CXX -shared"
294      ;;
295    esac
296    
297    AC_SUBST(LD_STATIC)
298    AC_SUBST(LD_DYNAMIC)
299    AC_SUBST(LDPATHS)
300    AC_SUBST(LD_NEEDS_RPATH)
301    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      else
347        HAS_MACPORTS=no      AC_MSG_RESULT([$NVCC])
348        CUDA_ENABLED=true
349      fi      fi
     if test -x /sw/bin/fink ; then  
       HAS_FINK=yes  
350      else      else
351        HAS_FINK=no    NVCC=":"
352      CUDA_ENABLED=false
353      fi      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  esac
380      if test x"$LIBS_CL" = xnone ; then
381  if test x"$HAS_MACPORTS" = xyes ; then      AC_MSG_WARN([no OpenCL library found])
382    LDPATHS="-L/opt/local/lib"      CL_ENABLED=false
383  elif test x"$HAS_FINK" = xyes ; then      CL_VERSION=0
   LDPATHS="-L/sw/lib"  
384  else  else
385    LDPATHS=""      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  fi
398  AC_SUBST(LDPATHS)        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 77  Line 540 
540    esac    esac
541    if test -x $ac_cv_use_teem ; then    if test -x $ac_cv_use_teem ; then
542      TEEM_DIR=$ac_cv_use_teem      TEEM_DIR=$ac_cv_use_teem
543      AC_MSG_RESULT([ okay])      # check that TEEM_DIR actually points to something that looks like teem
544        if test -f $TEEM_DIR/include/teem/nrrd.h ; then
545          AC_MSG_RESULT([yes])
546        else
547          TEEM_DIR=none
548          AC_MSG_RESULT([invalid path to teem])
549        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  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
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 72      -o $SMLNJ_MINOR_VERSION -lt 80
617  then  then
618    AC_MSG_ERROR([installation requires SML/NJ version 110.72+])      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 108  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 127  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    else
649    
650      # 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
664    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
678    dnl verify that $DOXYGEN is an absolute path
679    dnl
680      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
692    AC_PATH_PROGS([ASCIIDOCTOR], [asciidoctor], [none])
693    AC_SUBST(ASCIIDOCTOR)
694    
695    #################### end Documentation tools configuration ####################
696    
697    #################### Diderot Debugger configuration ####################
698    
699    dnl The debugger is under development
700  dnl  dnl
701  dnl ******************** write output ********************  
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/lib/include"], [path for Diderot header files])
721    
722    AH_TOP([
723    /*
724     * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
725     *
726     * COPYRIGHT (c) 2016 The University of Chicago * All rights reserved.
727     */
728    
729    #ifndef _DIDEROT_CONFIG_H_
730    #define _DIDEROT_CONFIG_H_
731    
732    ])
733    AH_BOTTOM([
734    
735    #endif /* !_DIDEROT_CONFIG_H_ */
736    ])
737    
738    #################### end config.h ####################
739    
740    #################### 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    src/dnorm/Makefile  dnl  doc/Makefile
757    src/compiler/Makefile    doc/src/man/Makefile
758    test/MIP/Makefile  dnl  src/clinfo/Makefile
759    test/probe/Makefile    src/compiler/Makefile"$COMPILER_MAKEFILE_IN"
760      $FRAG_GEN_MAKEFILE
761      $DEBUGGER_MAKEFILE
762      src/lib/build/Makefile
763      src/lib/build/mk/build.gmk:src/lib/build/mk/build_gmk.in
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
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/lib/include/diderot/config.h:config/config_h.in)
773    
774  dnl  dnl
775  dnl shell scripts  dnl shell scripts
776  dnl  dnl
777  AC_CONFIG_FILES([  AC_CONFIG_FILES([
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([
781      src/compiler/gen/fragments/mkfrags.sh:src/compiler/gen/fragments/mkfrags_sh.in
782    ], [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
802    dnl generate makefiles for runtime library builds
803    dnl
804    dnl usage: MK_BUILD_DIR(<build-dir>, <target-platform>, <options>)
805    dnl
806    dnl where the options are taken from [debug, parallel]
807    dnl
808    AC_DEFUN([MK_BUILD_DIR], [
809        if test ! -d src/lib/build/$1 ; then
810          mkdir src/lib/build/$1
811        fi
812        [sed -e 's,@BUILD_TARGET@,$1,g' \
813          -e 's,@TARGET_PLATFORM@,$2,g' \
814          -e 's,@BUILD_OPTIONS@,$3,g' \
815          src/lib/build/mk/Makefile.in \
816            > src/lib/build/$1/Makefile.in]
817        AC_CONFIG_FILES(src/lib/build/$1/Makefile)
818      ])
819    
820    MK_BUILD_DIR(rt-seq, sequential, [])
821    MK_BUILD_DIR(rt-seq-debug, sequentiagetcpul, [debug])
822    MK_BUILD_DIR(rt-par, parallel, [parallel])
823    MK_BUILD_DIR(rt-par-debug, parallel, [parallel debug])
824    
825    if test x"$LOGGING_ENABLED" = xtrue ; then
826      MK_BUILD_DIR(rt-par-log, parallel, [parallel logging])
827    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.436  
changed lines
  Added in v.5571

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