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

SCM Repository

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

Diff of /branches/cuda/configure.ac

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

trunk/configure.ac revision 260, Tue Aug 10 15:34:34 2010 UTC branches/cuda/configure.ac revision 3349, Tue Oct 27 15:16:36 2015 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) 2015 The University of Chicago
6  dnl All rights reserved.  dnl All rights reserved.
7  dnl  dnl
8    
 dnl NOTE: MANTICORE_DIST_VERSION is an M4 variable defined in config/aclocal.m4  
 dnl  
9  AC_INIT(diderot,0.1,)  AC_INIT(diderot,0.1,)
10    
11  AC_PREREQ(2.60)  AC_PREREQ(2.60)
12  AC_COPYRIGHT([[COPYRIGHT (c) 2010 The Diderot Project]])  AC_COPYRIGHT([[COPYRIGHT (c) 2015 The University of Chicago]])
13  AC_CONFIG_SRCDIR(src/dnorm/dnorm.c)  AC_CONFIG_SRCDIR(src/dnorm/dnorm.c)
14  AC_CONFIG_AUX_DIR(config)  AC_CONFIG_AUX_DIR(config)
15  AC_CONFIG_MACRO_DIR(config)  AC_CONFIG_MACRO_DIR(config)
# Line 20  Line 20 
20  sinclude(config/acx_pthread.m4)  sinclude(config/acx_pthread.m4)
21  sinclude(config/check_smlnj.m4)  sinclude(config/check_smlnj.m4)
22  sinclude(config/check_smlnj_heap_suffix.m4)  sinclude(config/check_smlnj_heap_suffix.m4)
23    sinclude(config/ax_check_framework.m4)
24    
25  dnl  dnl
26  dnl get host information  dnl get host information
# Line 29  Line 29 
29    
30  dnl check for standard programs  dnl check for standard programs
31  dnl  dnl
32  AC_PROG_CC_C99  AC_PROG_CC([clang gcc cc])
33  AC_PROG_CPP  AC_PROG_CPP
34  AC_PROG_INSTALL  AC_PROG_INSTALL
35  AC_PROG_MAKE_SET  AC_PROG_MAKE_SET
36    
37    dnl check for c99 support
38    dnl
39    AC_PROG_CC_C99
40    if test x"$ac_cv_prog_cc_c99" = xno ; then
41      AC_MSG_ERROR([Diderot requires c99 support])
42    fi
43    
44    dnl extra C compiler options
45    dnl
46    CFLAGS=""
47    CFLAG_M64="-m64"
48    CFLAGS_BASE="-Wformat -Wreturn-type -Wuninitialized"
49    AC_SUBST(CFLAG_M64)
50    AC_SUBST(CFLAGS_BASE)
51    
52    dnl
53    dnl check for pthreads support
54  dnl  dnl
55  dnl If we are on Mac OS X, check for the presence of macports and/or fink  ACX_PTHREAD()
56    
57    dnl check for doxygen
58  dnl  dnl
59    AC_ARG_WITH([doxygen],
60      [AS_HELP_STRING([--with-doxygen=PATH], [specify location of doxygen executable])],
61      [DOXYGEN=$with_doxygen],
62      [DOXYGEN=none])
63    if test x$DOXYGEN = xnone ; then
64      # see if we can find doxygen in the user's path
65      AC_PATH_PROG(DOXYGEN, [doxygen], [none])
66    fi
67    if test x$with_doxygen = xyes -o x$with_doxygen = xno ; then
68      AC_MSG_ERROR([--with-doxygen option must specify directory argument])
69    elif test x$DOXYGEN != xnone -a ! -x $DOXYGEN ; then
70      AC_MSG_ERROR([doxygen not found at $DOXYGEN])
71    elif test x$DOXYGEN != xnone ; then
72    dnl
73    dnl verify that $DOXYGEN is an absolute path
74    dnl
75      case $DOXYGEN in
76        /*) ;;
77        *) AC_MSG_ERROR([--with-doxygen path must be absolute]) ;;
78      esac
79    fi
80    if test $DOXYGEN = xnone ; then
81      DOXYGEN=:
82    fi
83    AC_SUBST(DOXYGEN)
84    
85    dnl
86    dnl Look for NVIDIA's nvcc compiler
87    dnl
88    AC_MSG_NOTICE([checking for CUDA and nvcc])
89    AC_PATH_PROG(NVCC, nvcc, no, $PATH)
90    if test x"$NVCC" = xno ; then
91      AC_MSG_WARN([nvcc not found])
92      CUDA_ENABLED=false
93      NVCC=":"
94    else
95      AC_MSG_RESULT([$NVCC])
96      CUDA_ENABLED=true
97    fi
98    AC_SUBST(NVCC)
99    AC_SUBST(CUDA_ENABLED)
100    
101    dnl
102    dnl check for OpenCL support
103    dnl
104    CL_LIBS="none"
105  case "$host_os" in  case "$host_os" in
106    darwin*) # On Mac OS X we check for installed frameworks    darwin*) # On Mac OS X we check for installed frameworks
107        AX_CHECK_FRAMEWORK([OpenCL], [CL_LIBS="-framework OpenCL"], [])
108      ;;
109      *)
110        AC_CHECK_LIB([OpenCL],[clGetPlatformIDs],[CL_LIBS="-lOpenCL"])
111      ;;
112    esac
113    if test x"$CL_LIBS" = xnone ; then
114      AC_MSG_WARN([no OpenCL library found])
115      CL_ENABLED=false
116      CL_VERSION=0
117    else
118      CL_ENABLED=true
119      AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h])
120      # check the cl.h header for which version of OpenCL is supported
121      AC_LANG([C])
122      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
123    #include <stdio.h>
124    # ifdef HAVE_CL_CL_H
125    #   include <CL/cl.h>
126    # elif defined(HAVE_OPENCL_CL_H)
127    #   include <OpenCL/cl.h>
128    # else
129    #   error no cl.h
130    # endif]],
131    [[#if defined(CL_VERSION_1_1)
132      printf("11000\n");
133    #elif defined(CL_VERSION_1_0)
134      printf("10000\n");
135    #else
136      printf("0\n");
137    #endif
138        ]])],
139        [CL_VERSION=`./conftest$EXEEXT`], [CL_VERSION=0])
140    dnl
141    dnl check to see how we access the host-side vector types.  For OpenCL 1.1,
142    dnl the specification specifies the behavior, but it was unspecified in 1.0.
143    dnl
144      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
145    # ifdef HAVE_CL_CL_H
146    #   include <CL/cl.h>
147    # elif defined(HAVE_OPENCL_CL_H)
148    #   include <OpenCL/cl.h>
149    # else
150    #   error no cl.h
151    # endif]],
152        [[cl_float4 x; x[0] = 0.0;]])],
153        [AC_DEFINE([CL_HOST_VECTORS_ARE_ARRAYS],[1],[host vector types are arrays])],
154    dnl
155    dnl not arrays, so try the OpenCL 1.1 structure representation
156    dnl
157        [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
158    # ifdef HAVE_CL_CL_H
159    #   include <CL/cl.h>
160    # elif defined(HAVE_OPENCL_CL_H)
161    #   include <OpenCL/cl.h>
162    # else
163    #   error no cl.h
164    # endif]],
165        [[cl_float4 x; x.s[0] = 0.0;]])],
166        [AC_DEFINE([CL_HOST_VECTORS_ARE_STRUCTS],[1],[host vector types are structs])],
167        [AC_MSG_ERROR([unable to figure out host types for OpenCL vectors])])])
168      # substitutions
169      AC_SUBST(CL_LIBS)
170    fi
171    AC_SUBST(CL_ENABLED)
172    AC_SUBST(CL_VERSION)
173    
174    dnl
175    dnl check for various library routines etc.
176    dnl
177    AC_CHECK_FUNCS(posix_memalign)
178    if test x"$ac_cv_func_posix_memalign" != xyes ; then
179      AC_CHECK_FUNCS(memalign)
180      if test x"$ac_cv_func_posix_memalign" != xyes ; then
181        AC_CHECK_FUNCS(valloc)
182      fi
183    fi
184    
185    AC_CHECK_FUNCS(mach_absolute_time)
186    AC_CHECK_TYPES([struct timespec])
187    AC_CHECK_FUNCS(pthread_barrier_init)
188    
189    dnl
190    dnl check for clock_gettime.  On Linux, this requires librt.
191    dnl
192    save_LIBS=$LIBS
193    LIBS="-lrt $LIBS"
194    AC_MSG_CHECKING([for clock_gettime])
195    AC_LINK_IFELSE(
196      [AC_LANG_PROGRAM(
197        [[#include <time.h>]],
198        [[struct timespec t; clock_gettime(CLOCK_REALTIME, &t); ]])],
199      [ ac_cv_func_clock_gettime=yes;
200        AC_DEFINE(HAVE_CLOCK_GETTIME, [1], [is clock_gettime available?])],
201      [ac_cv_func_clock_gettime=no])
202    AC_MSG_RESULT($ac_cv_func_clock_gettime)
203    if test "$ac_cv_func_clock_gettime" = "no" ; then
204      LIBS=$save_LIBS
205    fi
206    
207    AC_CHECK_FUNCS(pthread_getcpuclockid)
208    AC_CHECK_FUNCS(sigtimedwait nanosleep)
209    
210    dnl
211    dnl check for sched_setaffinity
212    dnl
213    AC_CHECK_FUNCS(sched_setaffinity)
214    
215    dnl
216    dnl check for pthread_setaffinity_np
217    dnl
218    save_LIBS=$LIBS
219    save_CFLAGS=$CFLAGS
220    LIBS="$PTHREAD_LIBS $LIBS"
221    CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
222    AC_MSG_CHECKING([for pthread_setaffinity_np])
223    AC_LINK_IFELSE(
224      [AC_LANG_PROGRAM(
225        [[#include <pthread.h>]],
226        [[cpu_set_t s; pthread_setaffinity_np(pthread_self(), sizeof(s), &s); ]])],
227      [ ac_cv_func_pthread_setaffinity_np=yes;
228        AC_DEFINE(HAVE_PTHREAD_SETAFFINITY_NP, [1], [is pthread_setaffinity_np available?])],
229      [ac_cv_func_pthread_setaffinity_np=no])
230    AC_MSG_RESULT($ac_cv_func_pthread_setaffinity_np)
231    LIBS=$save_LIBS
232    CFLAGS=$save_CFLAGS
233    
234    dnl
235    dnl check for Linux NUMA support (libnuma)
236    dnl
237    AC_CHECK_LIB(numa,numa_available)
238    if test "$ac_cv_lib_numa_numa_available" = "yes" ; then
239      PTHREAD_LIBS="$PTHREAD_LIBS -lnuma"
240    fi
241    
242    dnl check for /proc/cpuinfo
243    dnl
244    AC_CHECK_FILES(/proc/cpuinfo)
245    
246    dnl
247    dnl OS-specific linking issues
248    dnl
249    LD_NEEDS_RPATH=false;
250    LIBM=""
251    case "$host_os" in
252      darwin*) # On Mac OS X we check for the presence of macports and/or fink
253      if test -x /opt/local/bin/port ; then      if test -x /opt/local/bin/port ; then
254        HAS_MACPORTS=yes        HAS_MACPORTS=yes
255      else      else
# Line 50  Line 261 
261        HAS_FINK=no        HAS_FINK=no
262      fi      fi
263    ;;    ;;
264      linux*) # On Linux we include the -rpath option to pick up dynamically-loaded libraries
265        LD_NEEDS_RPATH=true
266        LIBM="-lm"
267      ;;
268  esac  esac
269    
270  if test x"$HAS_MACPORTS" = xyes ; then  if test x"$HAS_MACPORTS" = xyes ; then
# Line 60  Line 275 
275    LDPATHS=""    LDPATHS=""
276  fi  fi
277  AC_SUBST(LDPATHS)  AC_SUBST(LDPATHS)
278    AC_SUBST(LD_NEEDS_RPATH)
279    AC_SUBST(LIBM)
280    
281  dnl  dnl
282  dnl get the path to the TEEM installation  dnl get the path to the TEEM installation
# Line 77  Line 294 
294    esac    esac
295    if test -x $ac_cv_use_teem ; then    if test -x $ac_cv_use_teem ; then
296      TEEM_DIR=$ac_cv_use_teem      TEEM_DIR=$ac_cv_use_teem
297        # check that TEEM_DIR actually points to something that looks like teem
298        if test -f $TEEM_DIR/include/teem/nrrd.h ; then
299      AC_MSG_RESULT([ okay])      AC_MSG_RESULT([ okay])
300    else    else
301      TEEM_DIR=none      TEEM_DIR=none
302      AC_MSG_RESULT([ invalid])      AC_MSG_RESULT([ invalid])
303    fi    fi
304      else
305        TEEM_DIR=none
306        AC_MSG_RESULT([ invalid])
307      fi
308  fi  fi
309  if test x"$TEEM_DIR" = xnone ; then  if test x"$TEEM_DIR" = xnone ; then
310    AC_MSG_ERROR([unable to find teem])    AC_MSG_ERROR([unable to find teem])
# Line 95  Line 318 
318  dnl  dnl
319  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; check your PATH or set SMLNJ_CMD])])
320  if test $SMLNJ_MAJOR_VERSION -lt 110 \  if test $SMLNJ_MAJOR_VERSION -lt 110 \
321    -o $SMLNJ_MINOR_VERSION -lt 72    -o $SMLNJ_MINOR_VERSION -lt 73
322  then  then
323    AC_MSG_ERROR([installation requires SML/NJ version 110.72+])    AC_MSG_ERROR([installation requires SML/NJ version 110.73+])
324  fi  fi
325  AC_SUBST(SMLNJ_VERSION)  AC_SUBST(SMLNJ_VERSION)
326    
# Line 150  Line 373 
373  AC_SUBST(INSTALL_SMLNJ_WRAPPER)  AC_SUBST(INSTALL_SMLNJ_WRAPPER)
374    
375  dnl  dnl
376    dnl ******************** C compiler properties ********************
377    dnl
378    
379    dnl
380    dnl run the compiler tests in 64-bit mode
381    dnl
382    save_CFLAGS=$CFLAGS
383    CFLAGS="$CFLAGS $CFLAG_M64"
384    
385    dnl
386    dnl check for gcc builtin atomic operations
387    dnl
388    AC_MSG_CHECKING([for builtin atomic operations])
389    AC_LINK_IFELSE(
390       [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
391       AC_MSG_RESULT(yes)
392       AC_DEFINE(
393        [HAVE_BUILTIN_ATOMIC_OPS], 1,
394        [Define to 1 if gcc compiler provides atomic operations.]),
395       AC_MSG_RESULT(no))
396    
397    AC_C_BIGENDIAN
398    
399    dnl
400    dnl restore CFLAGS
401    dnl
402    CFLAGS=$save_CFLAGS
403    
404    dnl
405    dnl ******************** config.h stuff ********************
406    dnl
407    
408    AC_DEFINE_UNQUOTED(DIDEROT_INCLUDE_PATH,["$DIDEROT_SRCDIR/include"], [path for Diderot header files])
409    
410    AH_TOP([
411    /*
412     * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
413     *
414     * COPYRIGHT (c) 2015 The University of Chicago * All rights reserved.
415     */
416    
417    #ifndef _DIDEROT_CONFIG_H_
418    #define _DIDEROT_CONFIG_H_
419    
420    ])
421    AH_BOTTOM([
422    
423    #endif /* !_DIDEROT_CONFIG_H_ */
424    ])
425    
426    dnl
427  dnl ******************** write output ********************  dnl ******************** write output ********************
428  dnl  dnl
429    
430  AC_CONFIG_FILES(  AC_CONFIG_FILES(
431  dnl  dnl
432  dnl ***** Makefiles *****  dnl ***** Makefiles *****
433      Makefile
434      doc/Makefile
435      src/clinfo/Makefile
436    src/dnorm/Makefile    src/dnorm/Makefile
437    src/compiler/Makefile    src/compiler/Makefile
438      src/lib/build/Makefile
439      src/lib/build/mk/build.gmk:src/lib/build/mk/build_gmk.in
440    test/MIP/Makefile    test/MIP/Makefile
441    test/probe/Makefile    test/probe/Makefile
442  dnl  dnl
443  dnl ***** SML source files *****  dnl ***** SML source files *****
444    src/compiler/fields/run-dnorm.sml:src/compiler/fields/run-dnorm_sml.in    src/compiler/fields/run-dnorm.sml:src/compiler/fields/run-dnorm_sml.in
445      src/compiler/common/paths.sml:src/compiler/common/paths_sml.in
446  )  )
447    
448    AC_CONFIG_HEADERS(src/include/Diderot/config.h:config/config_h.in)
449    
450  dnl  dnl
451  dnl shell scripts  dnl shell scripts
452  dnl  dnl
453  AC_CONFIG_FILES([  AC_CONFIG_FILES([
454    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in
455  ], [chmod +x bin/install-sml-wrapper.sh])  ], [chmod +x bin/install-sml-wrapper.sh])
456    AC_CONFIG_FILES([
457      src/compiler/gen/file2str/file2str.sh:src/compiler/gen/file2str/file2str_sh.in
458    ], [chmod +x src/compiler/gen/file2str/file2str.sh])
459    
460    dnl
461    dnl generate makefiles for runtime library builds
462    dnl
463    dnl usage: MK_BUILD_DIR(<build-dir>, <target-platform>, <options>)
464    dnl
465    AC_DEFUN([MK_BUILD_DIR], [
466        if test ! -d src/lib/build/$1 ; then
467          mkdir src/lib/build/$1
468        fi
469        [sed -e 's,@BUILD_TARGET@,$1,g' \
470          -e 's,@TARGET_PLATFORM@,$2,g' \
471          -e 's,@BUILD_OPTIONS@,$3,g' \
472          src/lib/build/mk/Makefile.in \
473            > src/lib/build/$1/Makefile.in]
474        AC_CONFIG_FILES(src/lib/build/$1/Makefile)
475      ])
476    
477    MK_BUILD_DIR(rt-c-f, c, [float])
478    MK_BUILD_DIR(rt-c-d, c, [double])
479    MK_BUILD_DIR(rt-c-f-debug, c, [float debug])
480    MK_BUILD_DIR(rt-c-d-debug, c, [double debug])
481    MK_BUILD_DIR(rt-c-f-par, parallel, [parallel float])
482    MK_BUILD_DIR(rt-c-d-par, parallel, [parallel double])
483    MK_BUILD_DIR(rt-c-f-par-debug, parallel, [parallel float debug])
484    MK_BUILD_DIR(rt-c-d-par-debug, parallel, [parallel double debug])
485    
486    if test x"$CL_ENABLED" = xtrue ; then
487      MK_BUILD_DIR(rt-cl-f, cl, [float])
488      MK_BUILD_DIR(rt-cl-d, cl, [double])
489      MK_BUILD_DIR(rt-cl-f-debug, cl, [float debug])
490      MK_BUILD_DIR(rt-cl-d-debug, cl, [double debug])
491    fi
492    
493  AC_OUTPUT  AC_OUTPUT

Legend:
Removed from v.260  
changed lines
  Added in v.3349

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