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 1116, Thu May 5 04:49:02 2011 UTC branches/vis15/configure.ac revision 4973, Mon May 1 13:34:25 2017 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) 2016 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) 2016 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_x86_cpuid.m4)
28    sinclude(config/ax_gcc_x86_avx_xgetbv.m4)
29    sinclude(config/ax_ext.m4)
30  sinclude(config/acx_pthread.m4)  sinclude(config/acx_pthread.m4)
31  sinclude(config/check_smlnj.m4)  sinclude(config/check_smlnj.m4)
32  sinclude(config/check_smlnj_heap_suffix.m4)  sinclude(config/check_smlnj_heap_suffix.m4)
33    sinclude(config/ax_check_framework.m4)
34    sinclude(config/ax_cxx_compile_stdcxx.m4)
35    
36  dnl  dnl
37  dnl get host information  dnl get host information
38  dnl  dnl
39  AC_CANONICAL_HOST  AC_CANONICAL_HOST
40    
41    #################### Paths configuration ####################
42    
43    DIDEROT_ROOT=`pwd`
44    DIDEROT_DOCDIR=$DIDEROT_ROOT/doc
45    DIDEROT_SRCDIR=$DIDEROT_ROOT/src
46    DIDEROT_LIBDIR=$DIDEROT_ROOT/lib
47    DIDEROT_BINDIR=$DIDEROT_ROOT/bin
48    DIDEROT_MKDIR=$DIDEROT_ROOT/mk
49    
50    AC_SUBST(DIDEROT_ROOT)
51    AC_SUBST(DIDEROT_DOCDIR)
52    AC_SUBST(DIDEROT_SRCDIR)
53    AC_SUBST(DIDEROT_LIBDIR)
54    AC_SUBST(DIDEROT_BINDIR)
55    AC_SUBST(DIDEROT_MKDIR)
56    
57    #################### end Paths configuration ####################
58    
59  dnl check for standard programs  dnl check for standard programs
60  dnl  dnl
61  AC_PROG_CPP  AC_PROG_CPP
62    AC_PROG_CC([clang gcc cc])
63    AC_PROG_CXX([clang++ g++ c++])
64    AX_CXX_COMPILE_STDCXX(11,[],[mandatory])
65  AC_PROG_INSTALL  AC_PROG_INSTALL
66  AC_PROG_MAKE_SET  AC_PROG_MAKE_SET
67    
68  dnl check for c99 support  dnl FIXME: this works for now, but we should probably switch to libtool
69  dnl  dnl
70  AC_PROG_CC_C99  AC_PATH_PROG(LD, [ld], [none])
71  if test x"$ac_cv_prog_cc_c99" = xno ; then  if test x$LD = xnone ; then
72    AC_MSG_ERROR([Diderot requires c99 support])    AC_MSG_ERROR([cannot find ld command])
73  fi  fi
74    AC_SUBST(LD)
75    
76  dnl extra C compiler options  dnl extra compiler options
77  dnl  dnl
78  CFLAG_M64="-m64"  CXXFLAGS_BASE="-Wreturn-type -Wuninitialized"
 CFLAGS="$CFLAGS -Wformat -Wreturn-type -Wuninitialized"  
 AC_SUBST(CFLAG_M64)  
79    
80    dnl check for SIMD support
81  dnl  dnl
82  dnl Look for NVIDIA's nvcc compiler  AX_EXT
83    
84    AC_ARG_ENABLE([32-bit],
85      AC_HELP_STRING([--enable-32-bit], [configure Diderot to produce 32-bit executables]),
86      [CXXFLAG_Mxx="-m32"],
87      [CXXFLAG_Mxx="-m64"])
88    
89    CXXFLAGS="$CXXFLAG_Mxx $CXXFLAGS_BASE"
90    AC_SUBST(CXXFLAG_Mxx)
91    AC_SUBST(CXXFLAGS_BASE)
92    
93  dnl  dnl
94  AC_MSG_CHECKING([for CUDA and nvcc])  dnl run the compiler tests in 64-bit mode
95  AC_PATH_PROG(NVCC, nvcc, ":", $PATH)  dnl
96  if test $NVCC = none ; then  save_CFLAGS=$CFLAGS
97    AC_MSG_WARN([nvcc not found])  CFLAGS="$CFLAGS $CFLAG_MXX"
98    
99    dnl
100    dnl check for gcc builtin atomic operations
101    dnl
102    AC_MSG_CHECKING([for builtin atomic operations])
103    AC_LINK_IFELSE(
104       [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
105       AC_MSG_RESULT(yes)
106       AC_DEFINE(
107        [HAVE_BUILTIN_ATOMIC_OPS], 1,
108        [Define to 1 if gcc compiler provides atomic operations.]),
109       AC_MSG_RESULT(no))
110    
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  else
147    AC_MSG_RESULT([$NVCC])    BOOLTY="int"
148  fi  fi
149  AC_SUBST(NVCC)  AC_SUBST(BOOLTY)
150    
151  dnl  dnl
152  dnl check for pthreads support  dnl check for pthreads support
153  dnl  dnl
154  ACX_PTHREAD()  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
195    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
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  dnl  dnl
253  dnl OS-specific linking issues  dnl OS-specific linking issues
# Line 97  Line 284 
284  AC_SUBST(LD_NEEDS_RPATH)  AC_SUBST(LD_NEEDS_RPATH)
285  AC_SUBST(LIBM)  AC_SUBST(LIBM)
286    
287    #################### Logging configuration ####################
288    
289    LOGGING_ENABLED=false
290    AC_ARG_ENABLE([event-logging],
291      AC_HELP_STRING([--enable-event-logging], [include event-logging support for parallel target]),
292      [LOGGING_ENABLED=true],
293      [LOGGING_ENABLED=false])
294    
295    AC_SUBST(LOGGING_ENABLED)
296    
297    #################### end Logging configuration ####################
298    
299    #################### CUDA configuration ####################
300    
301    AC_ARG_ENABLE([cuda],
302      AC_HELP_STRING([--enable-cuda], [include support for targeting CUDA]))
303    
304    if test "${enable_cuda+set}" = set ; then
305    dnl
306    dnl Look for NVIDIA's nvcc compiler
307    dnl
308      AC_MSG_NOTICE([checking for CUDA and nvcc])
309      AC_PATH_PROG(NVCC, nvcc, no, $PATH)
310      if test x"$NVCC" = xno ; then
311        AC_MSG_WARN([nvcc not found])
312        CUDA_ENABLED=false
313        NVCC=":"
314      else
315        AC_MSG_RESULT([$NVCC])
316        CUDA_ENABLED=true
317      fi
318    else
319      NVCC=":"
320      CUDA_ENABLED=false
321    fi
322    AC_SUBST(NVCC)
323    AC_SUBST(CUDA_ENABLED)
324    
325    #################### end CUDA configuration ####################
326    
327    #################### OpenCL configuration ####################
328    
329    AC_ARG_ENABLE([opencl],
330      AC_HELP_STRING([--enable-opencl], [include support for targeting OpenCL]))
331    
332    if test "${enable_opencl+set}" = set ; then
333    
334  dnl  dnl
335  dnl get the path to the TEEM installation  dnl check for OpenCL support
336    dnl
337      LIBS_CL="none"
338      case "$host_os" in
339        darwin*) # On Mac OS X we check for installed frameworks
340          AX_CHECK_FRAMEWORK([OpenCL], [LIBS_CL="-framework OpenCL"], [])
341        ;;
342        *)
343          AC_CHECK_LIB([OpenCL],[clGetPlatformIDs],[LIBS_CL="-lOpenCL"])
344        ;;
345      esac
346      if test x"$LIBS_CL" = xnone ; then
347        AC_MSG_WARN([no OpenCL library found])
348        CL_ENABLED=false
349        CL_VERSION=0
350      else
351        CL_ENABLED=true
352        CPPFLAGS_CL=""
353        CL_HEADER=""
354        AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h], [HAVE_CL_H="yes"; CL_HEADER="$ac_header"; break], [HAVE_CL_H="no"])
355        if test x"$HAVE_CL_H" = xno ; then
356          # check for AMD's SDK
357          AC_MSG_CHECKING([for cl.h in AMD's SDK])
358          if test -d /opt/AMDAPP/include/CL ; then
359            HAVE_CL_H="yes"
360            CL_HEADER="/opt/AMDAPP/include/CL/cl.h"
361            AC_DEFINE([HAVE_CL_CL_H])
362            CPPFLAGS_CL="-I/opt/AMDAPP/include"
363          fi
364          AC_MSG_RESULT([$HAVE_CL_H])
365        fi
366        if test x"$HAVE_CL_H" = xno ; then
367          # check for NVIDIA's SDK
368          AC_MSG_CHECKING([for NVIDIA's SDK cl.h])
369          CUDA_HOME=none
370          for CUDA in cuda cuda-7.0 cuda-6.5 cuda-6.0 ; do
371            if test -d /usr/local/$CUDA/include/CL ; then
372              CUDA_HOME=/usr/local/$CUDA
373              break
374            fi
375          done
376          if test x"$CUDA_HOME" != xnone ; then
377            HAVE_CL_H="yes"
378            CL_HEADER="$CUDA_HOME/include/CL/cl.h"
379            AC_DEFINE([HAVE_CL_CL_H])
380            CPPFLAGS_CL="-I$CUDA_HOME/include"
381          fi
382          AC_MSG_RESULT([$HAVE_CL_H])
383        fi
384        if test x"$HAVE_CL_H" = xno ; then
385          AC_MSG_WARN([no cl.h found])
386          CL_ENABLED=false
387          CL_VERSION=0
388          SIZEOF_CL_INT=0
389          SIZEOF_CL_LONG=0
390          SIZEOF_CL_FLOAT=0
391          SIZEOF_CL_DOUBLE=0
392        else
393          # check the cl.h header for which version of OpenCL is supported
394          AC_LANG([C])
395          save_CPPFLAGS=$CPPFLAGS
396          CPPFLAGS="$CPPFLAGS_CL $CPPFLAGS"
397          AC_LINK_IFELSE([AC_LANG_PROGRAM([[
398    #include <stdio.h>
399    # ifdef HAVE_CL_CL_H
400    #   include <CL/cl.h>
401    # elif defined(HAVE_OPENCL_CL_H)
402    #   include <OpenCL/cl.h>
403    # else
404    #   error no cl.h
405    # endif]],
406    [[#if defined(CL_VERSION_1_2)
407      printf("120\n");
408    #elif defined(CL_VERSION_1_1)
409      printf("110\n");
410    #elif defined(CL_VERSION_1_0)
411      printf("100\n");
412    #else
413      printf("0\n");
414    #endif
415            ]])],
416            [CL_VERSION=`./conftest$EXEEXT`], [CL_VERSION=0])
417    dnl
418    dnl check to see how we access the host-side vector types.  For OpenCL 1.1,
419    dnl the specification specifies the behavior, but it was unspecified in 1.0.
420    dnl
421          AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
422      #include "$CL_HEADER"
423      ]],
424            [[cl_float4 x; x[0] = 0.0;]])],
425            [AC_DEFINE([CL_HOST_VECTORS_ARE_ARRAYS],[1],[host vector types are arrays])],
426      dnl
427      dnl not arrays, so try the OpenCL 1.1 structure representation
428      dnl
429            [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
430    #include "$CL_HEADER"
431    ]],
432            [[cl_float4 x; x.s[0] = 0.0;]])],
433            [AC_DEFINE([CL_HOST_VECTORS_ARE_STRUCTS],[1],[host vector types are structs])],
434            [AC_MSG_ERROR([unable to figure out host types for OpenCL vectors])])])
435        # restore saved CPPFLAGS
436          CPPFLAGS=$save_CPPFLAGS
437        # substitutions
438          AC_SUBST(LIBS_CL)
439          AC_SUBST(CPPFLAGS_CL)
440        #
441        # determine the sizes of the host-side OpenCL types
442        AC_CHECK_SIZEOF([cl_int], [], [#include "$CL_HEADER"])
443        SIZEOF_CL_INT=$ac_cv_sizeof_cl_int
444        AC_CHECK_SIZEOF([cl_long], [], [#include "$CL_HEADER"])
445        SIZEOF_CL_LONG=$ac_cv_sizeof_cl_long
446        AC_CHECK_SIZEOF([cl_float], [], [#include "$CL_HEADER"])
447        SIZEOF_CL_FLOAT=$ac_cv_sizeof_cl_float
448        AC_CHECK_SIZEOF([cl_double], [], [#include "$CL_HEADER"])
449        SIZEOF_CL_DOUBLE=$ac_cv_sizeof_cl_double
450        fi
451      fi
452    else
453      CL_ENABLED=false
454      CL_VERSION="0"
455      SIZEOF_CL_INT="0"
456      SIZEOF_CL_LONG="0"
457      SIZEOF_CL_FLOAT="0"
458      SIZEOF_CL_DOUBLE="0"
459    fi
460    
461    AC_SUBST(CL_ENABLED)
462    AC_SUBST(CL_VERSION)
463    AC_DEFINE_UNQUOTED(DIDEROT_CL_VERSION,[$CL_VERSION],[version of OpenCL supported by system])
464    
465    AC_SUBST(SIZEOF_CL_INT)
466    AC_SUBST(SIZEOF_CL_LONG)
467    AC_SUBST(SIZEOF_CL_FLOAT)
468    AC_SUBST(SIZEOF_CL_DOUBLE)
469    
470    #################### end OpenCL configuration ####################
471    
472    #################### Teem configuration ####################
473    
474    dnl get the path to the TEEM installation.  We need this to build the Diderot
475    dnl runtime code and we use the path when searching for teem in the Diderot
476    dnl compiler.
477    dnl
478    
479    dnl the path can be specified using "--with-teem=..." too
480  dnl  dnl
481  AC_ARG_WITH(teem,  AC_ARG_WITH(teem,
482    AC_HELP_STRING([--with-teem=<path>], [specify path to teem installation]),    AC_HELP_STRING([--with-teem=<path>], [specify path to teem installation]),
483    [ac_cv_use_teem=$withval], [ac_cv_use_teem=no])    [ac_cv_use_teem=$withval], [ac_cv_use_teem=no])
484    
485  if test x"$ac_cv_use_teem" = xno ; then  if test x"$ac_cv_use_teem" = xno ; then
486    dnl search for Teem in some standard places
487    dnl
488      AC_MSG_CHECKING([for teem])
489    TEEM_DIR=none    TEEM_DIR=none
490      POSSIBLE_TEEM_DIRS="/usr/local/teem /usr/local"
491      for dir in $POSSIBLE_TEEM_DIRS ; do
492        if test -f $dir/include/teem/nrrd.h ; then
493          TEEM_DIR=$dir
494          AC_MSG_RESULT([$TEEM_DIR])
495          break
496        fi
497      done
498      if test $TEEM_DIR = none ; then
499        AC_MSG_ERROR([unable to find teem; use --with-teem option to specify location])
500      fi
501  else  else
502    AC_MSG_CHECKING([path to teem ($ac_cv_use_teem)])    AC_MSG_CHECKING([path to teem ($ac_cv_use_teem)])
503    case $ac_cv_use_teem in    case $ac_cv_use_teem in
# Line 113  Line 506 
506    esac    esac
507    if test -x $ac_cv_use_teem ; then    if test -x $ac_cv_use_teem ; then
508      TEEM_DIR=$ac_cv_use_teem      TEEM_DIR=$ac_cv_use_teem
509      AC_MSG_RESULT([ okay])      # check that TEEM_DIR actually points to something that looks like teem
510        if test -f $TEEM_DIR/include/teem/nrrd.h ; then
511          AC_MSG_RESULT([yes])
512        else
513          TEEM_DIR=none
514          AC_MSG_RESULT([invalid path to teem])
515        fi
516    else    else
517      TEEM_DIR=none      TEEM_DIR=none
518      AC_MSG_RESULT([ invalid])      AC_MSG_RESULT([invalid path to teem])
519    fi    fi
520  fi  fi
521  if test x"$TEEM_DIR" = xnone ; then  if test x"$TEEM_DIR" = xnone ; then
522    AC_MSG_ERROR([unable to find teem])    AC_MSG_ERROR([unable to find teem])
523  fi  fi
524    dnl
525    dnl check that teem supports the nrrdMetaDataNormalize function
526    dnl
527    save_LDFLAGS=$LDFLAGS
528    save_LIBS=$LIBS
529    LDFLAGS="$LDFLAGS -L$TEEM_DIR/lib"
530    LIBS="$LIBS -lteem -lm"
531    AC_CHECK_FUNCS([nrrdMetaDataNormalize])
532    LDFLAGS=$save_LDFLAGS
533    LIBS=$save_LIBS
534    
535    if test "x$ac_cv_func_nrrdMetaDataNormalize" != xyes; then
536      AC_MSG_ERROR(["please update your teem installation"])
537    fi
538    
539  AC_SUBST(TEEM_DIR)  AC_SUBST(TEEM_DIR)
540    
541  dnl ******************** SML/NJ configuration ********************  #################### end Teem configuration ####################
542    
543    #################### SML configuration ####################
544    
545    dnl
546    dnl We support building with both SML/NJ (the default) or MLton.
547  dnl  dnl
548    
549    dnl first check for --with-mlton=path flag
550    dnl
551    AC_ARG_WITH([mlton],
552      [AS_HELP_STRING([--with-mlton=<path-to-mlton>],
553        [use the MLton Standard ML compiler to build Diderot])],
554      [with_mlton=yes],[with_mlton=no])
555    if test x"$with_mlton" = xyes ; then
556      if test x"$ac_cv_path_with_mlton" = x ; then
557        # look for mlton in the PATH
558        AC_PATH_PROGS(with_mlton, mlton, no)
559        if test x"$MLTON" = xno ; then
560          AC_MSG_ERROR([unable to find mlton executable; please specify the path])
561        fi
562      else
563        with_mlton=$ac_cv_path_with_mlton
564        case $with_mlton in
565          /*) ;;
566          *) AC_MSG_ERROR([please specify absolute path for mlton executable]) ;;
567        esac
568        if test ! -x $with_mlton ; then
569          AC_MSG_ERROR([invalid path for mlton; $with_mlton is not executable])
570        fi
571      fi
572    fi
573    
574    if test x"$with_mlton" = xno ; then
575      # we are using SML/NJ
576      #
577    
578  dnl check that we have a compatible version of SML/NJ  dnl check that we have a compatible version of SML/NJ
579  dnl  dnl
580  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])])
581  if test $SMLNJ_MAJOR_VERSION -lt 110 \  if test $SMLNJ_MAJOR_VERSION -lt 110 \
582    -o $SMLNJ_MINOR_VERSION -lt 72      -o $SMLNJ_MINOR_VERSION -lt 80
583  then  then
584    AC_MSG_ERROR([installation requires SML/NJ version 110.72+])      AC_MSG_ERROR([installation requires SML/NJ version 110.80+ (available from smlnj.org)])
585  fi  fi
 AC_SUBST(SMLNJ_VERSION)  
586    
587  dnl determine the heap-image suffix  dnl determine the heap-image suffix
588  dnl  dnl
# Line 144  Line 591 
591    
592  dnl look for ml-makedepend  dnl look for ml-makedepend
593  dnl  dnl
 AC_MSG_CHECKING([for ml-makedepend])  
594  tmpPATH="$SMLNJ_PATH:$PATH"  tmpPATH="$SMLNJ_PATH:$PATH"
595  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  
596  AC_SUBST(ML_MAKEDEPEND)  AC_SUBST(ML_MAKEDEPEND)
597    
598  dnl  dnl
# Line 163  Line 604 
604    AC_MSG_ERROR([ml-build not found])    AC_MSG_ERROR([ml-build not found])
605  fi  fi
606  AC_SUBST(ML_BUILD)  AC_SUBST(ML_BUILD)
607      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  
608    
609  HEAP_IMAGE_DIR=$DIDEROT_BINDIR/.heap  HEAP_IMAGE_DIR=$DIDEROT_BINDIR/.heap
610  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)  
611  AC_SUBST(HEAP_IMAGE_DIR)  AC_SUBST(HEAP_IMAGE_DIR)
612  AC_SUBST(INSTALL_SMLNJ_WRAPPER)  AC_SUBST(INSTALL_SMLNJ_WRAPPER)
613    
614    else
615    
616      # we are using MLton
617      MLTON=$with_mlton
618      AC_SUBST(MLTON)
619      SML=mlton
620    
621    fi
622    AC_SUBST(SML)
623    
624    #################### end SML configuration ####################
625    
626    #################### Documentation tools configuration ####################
627    
628    dnl check for doxygen
629    dnl
630    AC_ARG_WITH([doxygen],
631      [AS_HELP_STRING([--with-doxygen=<path>], [specify location of doxygen executable])],
632      [DOXYGEN=$with_doxygen],
633      [DOXYGEN=none])
634    if test x$DOXYGEN = xnone ; then
635      # see if we can find doxygen in the user's path
636      AC_PATH_PROG(DOXYGEN, [doxygen], [none])
637    fi
638    if test x$with_doxygen = xyes -o x$with_doxygen = xno ; then
639      AC_MSG_ERROR([--with-doxygen option must specify directory argument])
640    elif test x$DOXYGEN != xnone -a ! -x $DOXYGEN ; then
641      AC_MSG_ERROR([doxygen not found at $DOXYGEN])
642    elif test x$DOXYGEN != xnone ; then
643    dnl
644    dnl verify that $DOXYGEN is an absolute path
645    dnl
646      case $DOXYGEN in
647        /*) ;;
648        *) AC_MSG_ERROR([--with-doxygen path must be absolute]) ;;
649      esac
650    fi
651    if test $DOXYGEN = xnone ; then
652      DOXYGEN=:
653    fi
654    AC_SUBST(DOXYGEN)
655    
656    dnl check for asciidoc and related tools
657    dnl
658    AC_PATH_PROGS([ASCIIDOC], [asciidoc], [none])
659    AC_PATH_PROGS([A2X], [a2x], [none])
660    AC_PATH_PROGS([HIGHLIGHTER], [pygmentize], [none])
661    AC_PATH_PROGS([DBLATEX], [dblatex], [none])
662    
663  dnl  dnl
664  dnl ******************** write output ********************  dnl get the path to the asciidoc cofiguration files
665  dnl  dnl
666    if test x"$ASCIIDOC" != xnone ; then
667      AC_MSG_CHECKING([path to asciidoc configuration files])
668      ASCIIDOC_CONF_DIR=`$ASCIIDOC -v /dev/null 2>&1 | head -n 1 | sed 's|.*reading: \(.*\)/asciidoc.conf|\1|'`
669      AC_MSG_RESULT([$ASCIIDOC_CONF_DIR])
670    fi
671    AC_SUBST(ASCIIDOC)
672    AC_SUBST(A2X)
673    AC_SUBST(ASCIIDOC_CONF_DIR)
674    AC_SUBST(HIGHLIGHTER)
675    AC_SUBST(DBLATEX)
676    
677    #################### end Documentation tools configuration ####################
678    
679    #################### config.h ####################
680    
681    AC_DEFINE_UNQUOTED(DIDEROT_INCLUDE_PATH,["$DIDEROT_SRCDIR/lib/include"], [path for Diderot header files])
682    
683    AH_TOP([
684    /*
685     * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
686     *
687     * COPYRIGHT (c) 2016 The University of Chicago * All rights reserved.
688     */
689    
690    #ifndef _DIDEROT_CONFIG_H_
691    #define _DIDEROT_CONFIG_H_
692    
693    ])
694    AH_BOTTOM([
695    
696    #endif /* !_DIDEROT_CONFIG_H_ */
697    ])
698    
699    #################### end config.h ####################
700    
701    #################### write output ####################
702    
703    dnl The compiler Makefile depends on which SML system we are
704    dnl using.
705    if test x"$SML" = xmlton ; then
706      COMPILER_MAKEFILE_IN=":src/compiler/Makefile_mlton.in"
707    else
708      COMPILER_MAKEFILE_IN=""
709    fi
710    
711  AC_CONFIG_FILES(  AC_CONFIG_FILES(
712  dnl  dnl
713  dnl ***** Makefiles *****  dnl ***** Makefiles *****
714    Makefile    Makefile
715    src/dnorm/Makefile  dnl  doc/Makefile
716    src/compiler/Makefile  dnl  doc/man/Makefile
717    src/lib/Makefile  dnl  src/clinfo/Makefile
718      src/compiler/Makefile"$COMPILER_MAKEFILE_IN"
719    src/lib/build/Makefile    src/lib/build/Makefile
720    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/Makefile  
   test/MIP/Makefile  
   test/probe/Makefile  
721  dnl  dnl
722  dnl ***** SML source files *****  dnl ***** SML source files *****
723    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
724    src/compiler/common/paths.sml:src/compiler/common/paths_sml.in    src/compiler/common/paths.sml:src/compiler/common/paths_sml.in
725      src/compiler/common/size-of.sml:src/compiler/common/size-of_sml.in
726      src/compiler/options/version.sml:src/compiler/options/version_sml.in
727  )  )
728    
729    AC_CONFIG_HEADERS(src/lib/include/diderot/config.h:config/config_h.in)
730    
731  dnl  dnl
732  dnl shell scripts  dnl shell scripts
733  dnl  dnl
734  AC_CONFIG_FILES([  AC_CONFIG_FILES([
735    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in
736  ], [chmod +x bin/install-sml-wrapper.sh])  ], [chmod +x bin/install-sml-wrapper.sh])
737    AC_CONFIG_FILES([
738      src/compiler/gen/fragments/mkfrags.sh:src/compiler/gen/fragments/mkfrags_sh.in
739    ], [chmod +x src/compiler/gen/fragments/mkfrags.sh])
740    AC_CONFIG_FILES([
741      src/compiler/gen/fragments/mkmk.sh:src/compiler/gen/fragments/mkmk_sh.in
742    ], [chmod +x src/compiler/gen/fragments/mkmk.sh])
743    
744    dnl
745    dnl additional files for logging tools
746    dnl
747    if test x"$LOGGING_ENABLED" = xtrue ; then
748      AC_CONFIG_FILES([
749        src/logging/gen/Makefile
750        src/logging/log-analyze/Makefile
751        src/logging/log-dump/Makefile
752        src/logging/gen/log-gen.sh:src/logging/gen/log-gen_sh.in
753        src/logging/gen/main.sml:src/logging/gen/main_sml.in
754        src/logging/lib/default-log-paths.hxx:src/logging/lib/default-log-paths_hxx.in
755      ], [chmod +x src/logging/gen/log-gen.sh])
756    fi
757    
758  dnl  dnl
759  dnl generate makefiles for runtime library builds  dnl generate makefiles for runtime library builds
760  dnl  dnl
761  dnl usage: MK_BUILD_DIR(<build-dir>, <target-platform>, <options>)  dnl usage: MK_BUILD_DIR(<build-dir>, <target-platform>, <options>)
762  dnl  dnl
763    dnl where the options are taken from [debug, parallel]
764    dnl
765  AC_DEFUN([MK_BUILD_DIR], [  AC_DEFUN([MK_BUILD_DIR], [
766      if test ! -d src/lib/build/$1 ; then      if test ! -d src/lib/build/$1 ; then
767        mkdir src/lib/build/$1        mkdir src/lib/build/$1
# Line 231  Line 774 
774      AC_CONFIG_FILES(src/lib/build/$1/Makefile)      AC_CONFIG_FILES(src/lib/build/$1/Makefile)
775    ])    ])
776    
777  MK_BUILD_DIR(rt-c-f, c-target, [float])  MK_BUILD_DIR(rt-seq, sequential, [])
778  MK_BUILD_DIR(rt-c-f-debug, c-target, [float debug])  MK_BUILD_DIR(rt-seq-debug, sequentiagetcpul, [debug])
779    MK_BUILD_DIR(rt-par, parallel, [parallel])
780    MK_BUILD_DIR(rt-par-debug, parallel, [parallel debug])
781    
782    if test x"$LOGGING_ENABLED" = xtrue ; then
783      MK_BUILD_DIR(rt-par-log, parallel, [parallel logging])
784    fi
785    
786    #if test x"$CL_ENABLED" = xtrue ; then
787    #  MK_BUILD_DIR(rt-cl-f, opencl, [float])
788    #  MK_BUILD_DIR(rt-cl-d, opencl, [double])
789    #  MK_BUILD_DIR(rt-cl-f-debug, opencl, [float debug])
790    #  MK_BUILD_DIR(rt-cl-d-debug, opencl, [double debug])
791    #fi
792    
793  AC_OUTPUT  AC_OUTPUT
794    
795    #################### end write output ####################

Legend:
Removed from v.1116  
changed lines
  Added in v.4973

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