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

SCM Repository

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

Diff of /branches/opencl/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/opencl/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 (http://diderot-language.cs.uchicago.edu)]])  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 FIXME: this works for now, but we should probably switch to libtool
38    dnl
39    AC_PATH_PROG(LD, [ld], [none])
40    if test x$LD = xnone ; then
41      AC_MSG_ERROR([cannot find ld command])
42    fi
43    AC_SUBST(LD)
44    
45    dnl check for c99 support
46    dnl
47    AC_PROG_CC_C99
48    if test x"$ac_cv_prog_cc_c99" = xno ; then
49      AC_MSG_ERROR([Diderot requires c99 support])
50    fi
51    
52    dnl extra C compiler options
53    dnl
54    CFLAGS=""
55    CFLAG_M64="-m64"
56    CFLAGS_BASE="-Wformat -Wreturn-type -Wuninitialized"
57    AC_SUBST(CFLAG_M64)
58    AC_SUBST(CFLAGS_BASE)
59    
60    dnl
61    dnl check for pthreads support
62    dnl
63    ACX_PTHREAD()
64    
65    dnl check for doxygen
66    dnl
67    AC_ARG_WITH([doxygen],
68      [AS_HELP_STRING([--with-doxygen=PATH], [specify location of doxygen executable])],
69      [DOXYGEN=$with_doxygen],
70      [DOXYGEN=none])
71    if test x$DOXYGEN = xnone ; then
72      # see if we can find doxygen in the user's path
73      AC_PATH_PROG(DOXYGEN, [doxygen], [none])
74    fi
75    if test x$with_doxygen = xyes -o x$with_doxygen = xno ; then
76      AC_MSG_ERROR([--with-doxygen option must specify directory argument])
77    elif test x$DOXYGEN != xnone -a ! -x $DOXYGEN ; then
78      AC_MSG_ERROR([doxygen not found at $DOXYGEN])
79    elif test x$DOXYGEN != xnone ; then
80    dnl
81    dnl verify that $DOXYGEN is an absolute path
82    dnl
83      case $DOXYGEN in
84        /*) ;;
85        *) AC_MSG_ERROR([--with-doxygen path must be absolute]) ;;
86      esac
87    fi
88    if test $DOXYGEN = xnone ; then
89      DOXYGEN=:
90    fi
91    AC_SUBST(DOXYGEN)
92    
93  dnl  dnl
94  dnl If we are on Mac OS X, check for the presence of macports and/or fink  dnl Look for NVIDIA's nvcc compiler
95  dnl  dnl
96    AC_MSG_NOTICE([checking for CUDA and nvcc])
97    AC_PATH_PROG(NVCC, nvcc, no, $PATH)
98    if test x"$NVCC" = xno ; then
99      AC_MSG_WARN([nvcc not found])
100      CUDA_ENABLED=false
101      NVCC=":"
102    else
103      AC_MSG_RESULT([$NVCC])
104      CUDA_ENABLED=true
105    fi
106    AC_SUBST(NVCC)
107    AC_SUBST(CUDA_ENABLED)
108    
109    dnl
110    dnl check for OpenCL support
111    dnl
112    LIBS_CL="none"
113  case "$host_os" in  case "$host_os" in
114    darwin*) # On Mac OS X we check for installed frameworks    darwin*) # On Mac OS X we check for installed frameworks
115        AX_CHECK_FRAMEWORK([OpenCL], [LIBS_CL="-framework OpenCL"], [])
116      ;;
117      *)
118        AC_CHECK_LIB([OpenCL],[clGetPlatformIDs],[LIBS_CL="-lOpenCL"])
119      ;;
120    esac
121    if test x"$LIBS_CL" = xnone ; then
122      AC_MSG_WARN([no OpenCL library found])
123      CL_ENABLED=false
124      CL_VERSION=0
125    else
126      CL_ENABLED=true
127      CPPFLAGS_CL=""
128      AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h], [HAVE_CL_H="yes"; break], [HAVE_CL_H="no"])
129      if test x"$HAVE_CL_H" = xno ; then
130        # check for AMD's SDK
131        AC_MSG_CHECKING([for cl.h in AMD's SDK])
132        if test -d /opt/AMDAPP/include/CL ; then
133          HAVE_CL_H="yes"
134          AC_DEFINE([HAVE_CL_CL_H])
135          CPPFLAGS_CL="-I/opt/AMDAPP/include"
136        fi
137        AC_MSG_RESULT([$HAVE_CL_H])
138      fi
139      if test x"$HAVE_CL_H" = xno ; then
140        AC_MSG_WARN([no cl.h found])
141        CL_ENABLED=false
142        CL_VERSION=0
143      else
144        # check the cl.h header for which version of OpenCL is supported
145        AC_LANG([C])
146        save_CPPFLAGS=$CPPFLAGS
147        CPPFLAGS="$CPPFLAGS_CL $CPPFLAGS"
148        AC_LINK_IFELSE([AC_LANG_PROGRAM([[
149    #include <stdio.h>
150    # ifdef HAVE_CL_CL_H
151    #   include <CL/cl.h>
152    # elif defined(HAVE_OPENCL_CL_H)
153    #   include <OpenCL/cl.h>
154    # else
155    #   error no cl.h
156    # endif]],
157    [[#if defined(CL_VERSION_1_1)
158      printf("11000\n");
159    #elif defined(CL_VERSION_1_0)
160      printf("10000\n");
161    #else
162      printf("0\n");
163    #endif
164          ]])],
165          [CL_VERSION=`./conftest$EXEEXT`], [CL_VERSION=0])
166    dnl
167    dnl check to see how we access the host-side vector types.  For OpenCL 1.1,
168    dnl the specification specifies the behavior, but it was unspecified in 1.0.
169    dnl
170        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
171    # ifdef HAVE_CL_CL_H
172    #   include <CL/cl.h>
173    # elif defined(HAVE_OPENCL_CL_H)
174    #   include <OpenCL/cl.h>
175    # else
176    #   error no cl.h
177    # endif]],
178          [[cl_float4 x; x[0] = 0.0;]])],
179          [AC_DEFINE([CL_HOST_VECTORS_ARE_ARRAYS],[1],[host vector types are arrays])],
180    dnl
181    dnl not arrays, so try the OpenCL 1.1 structure representation
182    dnl
183          [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
184    # ifdef HAVE_CL_CL_H
185    #   include <CL/cl.h>
186    # elif defined(HAVE_OPENCL_CL_H)
187    #   include <OpenCL/cl.h>
188    # else
189    #   error no cl.h
190    # endif]],
191          [[cl_float4 x; x.s[0] = 0.0;]])],
192          [AC_DEFINE([CL_HOST_VECTORS_ARE_STRUCTS],[1],[host vector types are structs])],
193          [AC_MSG_ERROR([unable to figure out host types for OpenCL vectors])])])
194      # restore saved CPPFLAGS
195        CPPFLAGS=$save_CPPFLAGS
196      # substitutions
197        AC_SUBST(LIBS_CL)
198        AC_SUBST(CPPFLAGS_CL)
199      fi
200    fi
201    AC_SUBST(CL_ENABLED)
202    AC_SUBST(CL_VERSION)
203    
204    dnl
205    dnl check for various library routines etc.
206    dnl
207    AC_CHECK_FUNCS(posix_memalign)
208    if test x"$ac_cv_func_posix_memalign" != xyes ; then
209      AC_CHECK_FUNCS(memalign)
210      if test x"$ac_cv_func_posix_memalign" != xyes ; then
211        AC_CHECK_FUNCS(valloc)
212      fi
213    fi
214    
215    AC_CHECK_FUNCS(mach_absolute_time)
216    AC_CHECK_TYPES([struct timespec])
217    AC_CHECK_FUNCS(pthread_barrier_init)
218    
219    dnl
220    dnl check for clock_gettime.  On Linux, this requires librt.
221    dnl
222    save_LIBS=$LIBS
223    LIBS="-lrt $LIBS"
224    AC_MSG_CHECKING([for clock_gettime])
225    AC_LINK_IFELSE(
226      [AC_LANG_PROGRAM(
227        [[#include <time.h>]],
228        [[struct timespec t; clock_gettime(CLOCK_REALTIME, &t); ]])],
229      [ ac_cv_func_clock_gettime=yes;
230        AC_DEFINE(HAVE_CLOCK_GETTIME, [1], [is clock_gettime available?])],
231      [ac_cv_func_clock_gettime=no])
232    AC_MSG_RESULT($ac_cv_func_clock_gettime)
233    if test "$ac_cv_func_clock_gettime" = "no" ; then
234      LIBS=$save_LIBS
235    fi
236    
237    AC_CHECK_FUNCS(pthread_getcpuclockid)
238    AC_CHECK_FUNCS(sigtimedwait nanosleep)
239    
240    dnl
241    dnl check for sched_setaffinity
242    dnl
243    AC_CHECK_FUNCS(sched_setaffinity)
244    
245    dnl
246    dnl check for pthread_setaffinity_np
247    dnl
248    save_LIBS=$LIBS
249    save_CFLAGS=$CFLAGS
250    LIBS="$PTHREAD_LIBS $LIBS"
251    CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
252    AC_MSG_CHECKING([for pthread_setaffinity_np])
253    AC_LINK_IFELSE(
254      [AC_LANG_PROGRAM(
255        [[#include <pthread.h>]],
256        [[cpu_set_t s; pthread_setaffinity_np(pthread_self(), sizeof(s), &s); ]])],
257      [ ac_cv_func_pthread_setaffinity_np=yes;
258        AC_DEFINE(HAVE_PTHREAD_SETAFFINITY_NP, [1], [is pthread_setaffinity_np available?])],
259      [ac_cv_func_pthread_setaffinity_np=no])
260    AC_MSG_RESULT($ac_cv_func_pthread_setaffinity_np)
261    LIBS=$save_LIBS
262    CFLAGS=$save_CFLAGS
263    
264    dnl
265    dnl check for Linux NUMA support (libnuma)
266    dnl
267    AC_CHECK_LIB(numa,numa_available)
268    if test "$ac_cv_lib_numa_numa_available" = "yes" ; then
269      PTHREAD_LIBS="$PTHREAD_LIBS -lnuma"
270    fi
271    
272    dnl check for /proc/cpuinfo
273    dnl
274    AC_CHECK_FILES(/proc/cpuinfo)
275    
276    dnl
277    dnl OS-specific linking issues
278    dnl
279    LD_NEEDS_RPATH=false;
280    LIBM=""
281    case "$host_os" in
282      darwin*) # On Mac OS X we check for the presence of macports and/or fink
283      if test -x /opt/local/bin/port ; then      if test -x /opt/local/bin/port ; then
284        HAS_MACPORTS=yes        HAS_MACPORTS=yes
285      else      else
# Line 50  Line 291 
291        HAS_FINK=no        HAS_FINK=no
292      fi      fi
293    ;;    ;;
294      linux*) # On Linux we include the -rpath option to pick up dynamically-loaded libraries
295        LD_NEEDS_RPATH=true
296        LIBM="-lm"
297      ;;
298  esac  esac
299    
300  if test x"$HAS_MACPORTS" = xyes ; then  if test x"$HAS_MACPORTS" = xyes ; then
# Line 60  Line 305 
305    LDPATHS=""    LDPATHS=""
306  fi  fi
307  AC_SUBST(LDPATHS)  AC_SUBST(LDPATHS)
308    AC_SUBST(LD_NEEDS_RPATH)
309    AC_SUBST(LIBM)
310    
311  dnl  dnl
312  dnl get the path to the TEEM installation  dnl get the path to the TEEM installation
# Line 77  Line 324 
324    esac    esac
325    if test -x $ac_cv_use_teem ; then    if test -x $ac_cv_use_teem ; then
326      TEEM_DIR=$ac_cv_use_teem      TEEM_DIR=$ac_cv_use_teem
327        # check that TEEM_DIR actually points to something that looks like teem
328        if test -f $TEEM_DIR/include/teem/nrrd.h ; then
329      AC_MSG_RESULT([ okay])      AC_MSG_RESULT([ okay])
330    else    else
331      TEEM_DIR=none      TEEM_DIR=none
332      AC_MSG_RESULT([ invalid])      AC_MSG_RESULT([ invalid])
333    fi    fi
334      else
335        TEEM_DIR=none
336        AC_MSG_RESULT([ invalid])
337      fi
338  fi  fi
339  if test x"$TEEM_DIR" = xnone ; then  if test x"$TEEM_DIR" = xnone ; then
340    AC_MSG_ERROR([unable to find teem])    AC_MSG_ERROR([unable to find teem])
# Line 95  Line 348 
348  dnl  dnl
349  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])])
350  if test $SMLNJ_MAJOR_VERSION -lt 110 \  if test $SMLNJ_MAJOR_VERSION -lt 110 \
351    -o $SMLNJ_MINOR_VERSION -lt 72    -o $SMLNJ_MINOR_VERSION -lt 73
352  then  then
353    AC_MSG_ERROR([installation requires SML/NJ version 110.72+])    AC_MSG_ERROR([installation requires SML/NJ version 110.73+])
354  fi  fi
355  AC_SUBST(SMLNJ_VERSION)  AC_SUBST(SMLNJ_VERSION)
356    
# Line 150  Line 403 
403  AC_SUBST(INSTALL_SMLNJ_WRAPPER)  AC_SUBST(INSTALL_SMLNJ_WRAPPER)
404    
405  dnl  dnl
406    dnl ******************** C compiler properties ********************
407    dnl
408    
409    dnl
410    dnl run the compiler tests in 64-bit mode
411    dnl
412    save_CFLAGS=$CFLAGS
413    CFLAGS="$CFLAGS $CFLAG_M64"
414    
415    dnl
416    dnl check for gcc builtin atomic operations
417    dnl
418    AC_MSG_CHECKING([for builtin atomic operations])
419    AC_LINK_IFELSE(
420       [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
421       AC_MSG_RESULT(yes)
422       AC_DEFINE(
423        [HAVE_BUILTIN_ATOMIC_OPS], 1,
424        [Define to 1 if gcc compiler provides atomic operations.]),
425       AC_MSG_RESULT(no))
426    
427    AC_C_BIGENDIAN
428    
429    dnl
430    dnl restore CFLAGS
431    dnl
432    CFLAGS=$save_CFLAGS
433    
434    dnl
435    dnl ******************** config.h stuff ********************
436    dnl
437    
438    AC_DEFINE_UNQUOTED(DIDEROT_INCLUDE_PATH,["$DIDEROT_SRCDIR/include"], [path for Diderot header files])
439    
440    AH_TOP([
441    /*
442     * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
443     *
444     * COPYRIGHT (c) 2015 The University of Chicago * All rights reserved.
445     */
446    
447    #ifndef _DIDEROT_CONFIG_H_
448    #define _DIDEROT_CONFIG_H_
449    
450    ])
451    AH_BOTTOM([
452    
453    #endif /* !_DIDEROT_CONFIG_H_ */
454    ])
455    
456    dnl
457  dnl ******************** write output ********************  dnl ******************** write output ********************
458  dnl  dnl
459    
# Line 157  Line 461 
461  dnl  dnl
462  dnl ***** Makefiles *****  dnl ***** Makefiles *****
463    Makefile    Makefile
464      doc/Makefile
465      src/clinfo/Makefile
466    src/dnorm/Makefile    src/dnorm/Makefile
467    src/compiler/Makefile    src/compiler/Makefile
468      src/lib/build/Makefile
469      src/lib/build/mk/build.gmk:src/lib/build/mk/build_gmk.in
470    test/MIP/Makefile    test/MIP/Makefile
471    test/probe/Makefile    test/probe/Makefile
472  dnl  dnl
473  dnl ***** SML source files *****  dnl ***** SML source files *****
474    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
475      src/compiler/common/paths.sml:src/compiler/common/paths_sml.in
476  )  )
477    
478    AC_CONFIG_HEADERS(src/include/Diderot/config.h:config/config_h.in)
479    
480  dnl  dnl
481  dnl shell scripts  dnl shell scripts
482  dnl  dnl
483  AC_CONFIG_FILES([  AC_CONFIG_FILES([
484    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in
485  ], [chmod +x bin/install-sml-wrapper.sh])  ], [chmod +x bin/install-sml-wrapper.sh])
486    AC_CONFIG_FILES([
487      src/compiler/gen/file2str/file2str.sh:src/compiler/gen/file2str/file2str_sh.in
488    ], [chmod +x src/compiler/gen/file2str/file2str.sh])
489    AC_CONFIG_FILES([
490      rtest/scripts/run.sh:rtest/scripts/run_sh.in
491    ], [chmod +x rtest/scripts/run.sh])
492    AC_CONFIG_FILES([
493      rtest/scripts/run-one.sh:rtest/scripts/run-one_sh.in
494    ], [chmod +x rtest/scripts/run-one.sh])
495    
496    dnl
497    dnl generate makefiles for runtime library builds
498    dnl
499    dnl usage: MK_BUILD_DIR(<build-dir>, <target-platform>, <options>)
500    dnl
501    AC_DEFUN([MK_BUILD_DIR], [
502        if test ! -d src/lib/build/$1 ; then
503          mkdir src/lib/build/$1
504        fi
505        [sed -e 's,@BUILD_TARGET@,$1,g' \
506          -e 's,@TARGET_PLATFORM@,$2,g' \
507          -e 's,@BUILD_OPTIONS@,$3,g' \
508          src/lib/build/mk/Makefile.in \
509            > src/lib/build/$1/Makefile.in]
510        AC_CONFIG_FILES(src/lib/build/$1/Makefile)
511      ])
512    
513    MK_BUILD_DIR(rt-c-f, c, [float])
514    MK_BUILD_DIR(rt-c-d, c, [double])
515    MK_BUILD_DIR(rt-c-f-debug, c, [float debug])
516    MK_BUILD_DIR(rt-c-d-debug, c, [double debug])
517    MK_BUILD_DIR(rt-c-f-par, parallel, [parallel float])
518    MK_BUILD_DIR(rt-c-d-par, parallel, [parallel double])
519    MK_BUILD_DIR(rt-c-f-par-debug, parallel, [parallel float debug])
520    MK_BUILD_DIR(rt-c-d-par-debug, parallel, [parallel double debug])
521    
522    if test x"$CL_ENABLED" = xtrue ; then
523      MK_BUILD_DIR(rt-cl-f, cl, [float])
524      MK_BUILD_DIR(rt-cl-d, cl, [double])
525      MK_BUILD_DIR(rt-cl-f-debug, cl, [float debug])
526      MK_BUILD_DIR(rt-cl-d-debug, cl, [double debug])
527    fi
528    
529  AC_OUTPUT  AC_OUTPUT

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

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