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

SCM Repository

[diderot] Diff of /branches/pure-cfg/configure.ac
ViewVC logotype

Diff of /branches/pure-cfg/configure.ac

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

revision 1158, Mon May 9 16:11:27 2011 UTC revision 1403, Wed Jun 29 18:33:46 2011 UTC
# 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 28  Line 29 
29    
30  dnl check for standard programs  dnl check for standard programs
31  dnl  dnl
32    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
# Line 41  Line 43 
43    
44  dnl extra C compiler options  dnl extra C compiler options
45  dnl  dnl
46    CFLAGS=""
47  CFLAG_M64="-m64"  CFLAG_M64="-m64"
48  CFLAGS="$CFLAGS -Wformat -Wreturn-type -Wuninitialized"  CFLAGS_BASE="-Wformat -Wreturn-type -Wuninitialized"
49  AC_SUBST(CFLAG_M64)  AC_SUBST(CFLAG_M64)
50    AC_SUBST(CFLAGS_BASE)
51    
52    dnl
53    dnl check for pthreads support
54    dnl
55    ACX_PTHREAD()
56    
57  dnl  dnl
58  dnl Look for NVIDIA's nvcc compiler  dnl Look for NVIDIA's nvcc compiler
59  dnl  dnl
60  AC_MSG_CHECKING([for CUDA and nvcc])  AC_MSG_NOTICE([checking for CUDA and nvcc])
61  AC_PATH_PROG(NVCC, nvcc, ":", $PATH)  AC_PATH_PROG(NVCC, nvcc, no, $PATH)
62  if test $NVCC = none ; then  if test x"$NVCC" = xno ; then
63    AC_MSG_WARN([nvcc not found])    AC_MSG_WARN([nvcc not found])
64      CUDA_ENABLED=false
65      NVCC=":"
66  else  else
67    AC_MSG_RESULT([$NVCC])    AC_MSG_RESULT([$NVCC])
68      CUDA_ENABLED=true
69  fi  fi
70  AC_SUBST(NVCC)  AC_SUBST(NVCC)
71    AC_SUBST(CUDA_ENABLED)
72    
73  dnl  dnl
74  dnl check for pthreads support  dnl check for OpenCL support
75  dnl  dnl
76  ACX_PTHREAD()  CL_LIBS="none"
77    case "$host_os" in
78      darwin*) # On Mac OS X we check for installed frameworks
79        AX_CHECK_FRAMEWORK([OpenCL], [CL_LIBS="-framework OpenCL"], [])
80      ;;
81      *)
82        AC_CHECK_LIB([OpenCL],[clGetPlatformIDs],[CL_LIBS="-lOpenCL"])
83      ;;
84    esac
85    if test x"$CL_LIBS" = xnone ; then
86      AC_MSG_WARN([no OpenCL library found])
87      CL_ENABLED=false
88      CL_VERSION=0
89    else
90      CL_ENABLED=true
91      AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h])
92      # check the cl.h header for which version of OpenCL is supported
93      AC_LANG([C])
94      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
95    #include <stdio.h>
96    # ifdef HAVE_CL_CL_H
97    #   include <CL/cl.h>
98    # elif defined(HAVE_OPENCL_CL_H)
99    #   include <OpenCL/cl.h>
100    # else
101    #   error no cl.h
102    # endif]],
103    [[#if defined(CL_VERSION_1_1)
104      printf("11000\n");
105    #elif defined(CL_VERSION_1_0)
106      printf("10000\n");
107    #else
108      printf("0\n");
109    #endif
110        ]])],
111        [CL_VERSION=`./conftest$EXEEXT`], [CL_VERSION=0])
112    dnl
113    dnl check to see how we access the host-side vector types.  For OpenCL 1.1,
114    dnl the specification specifies the behavior, but it was unspecified in 1.0.
115    dnl
116      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
117    # ifdef HAVE_CL_CL_H
118    #   include <CL/cl.h>
119    # elif defined(HAVE_OPENCL_CL_H)
120    #   include <OpenCL/cl.h>
121    # else
122    #   error no cl.h
123    # endif]],
124        [[cl_float4 x; x[0] = 0.0;]])],
125        [AC_DEFINE([CL_HOST_VECTORS_ARE_ARRAYS],[1],[host vector types are arrays])],
126    dnl
127    dnl not arrays, so try the OpenCL 1.1 structure representation
128    dnl
129        [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
130    # ifdef HAVE_CL_CL_H
131    #   include <CL/cl.h>
132    # elif defined(HAVE_OPENCL_CL_H)
133    #   include <OpenCL/cl.h>
134    # else
135    #   error no cl.h
136    # endif]],
137        [[cl_float4 x; x.s[0] = 0.0;]])],
138        [AC_DEFINE([CL_HOST_VECTORS_ARE_STRUCTS],[1],[host vector types are structs])],
139        [AC_MSG_ERROR([unable to figure out host types for OpenCL vectors])])])
140      # substitutions
141      AC_SUBST(CL_LIBS)
142    fi
143    AC_SUBST(CL_ENABLED)
144    AC_SUBST(CL_VERSION)
145    
146    dnl
147    dnl check for various library routines etc.
148    dnl
149    AC_CHECK_FUNCS(posix_memalign)
150    if test x"$ac_cv_func_posix_memalign" != xyes ; then
151      AC_CHECK_FUNCS(memalign)
152      if test x"$ac_cv_func_posix_memalign" != xyes ; then
153        AC_CHECK_FUNCS(valloc)
154      fi
155    fi
156    
157    AC_CHECK_FUNCS(mach_absolute_time)
158    AC_CHECK_TYPES([struct timespec])
159    AC_CHECK_FUNCS(pthread_barrier_init)
160    
161    dnl
162    dnl check for clock_gettime.  On Linux, this requires librt.
163    dnl
164    save_LIBS=$LIBS
165    LIBS="-lrt $LIBS"
166    AC_MSG_CHECKING([for clock_gettime])
167    AC_LINK_IFELSE(
168      [AC_LANG_PROGRAM(
169        [[#include <time.h>]],
170        [[struct timespec t; clock_gettime(CLOCK_REALTIME, &t); ]])],
171      [ ac_cv_func_clock_gettime=yes;
172        AC_DEFINE(HAVE_CLOCK_GETTIME, [1], [is clock_gettime available?])],
173      [ac_cv_func_clock_gettime=no])
174    AC_MSG_RESULT($ac_cv_func_clock_gettime)
175    if test "$ac_cv_func_clock_gettime" = "no" ; then
176      LIBS=$save_LIBS
177    fi
178    
179    AC_CHECK_FUNCS(pthread_getcpuclockid)
180    AC_CHECK_FUNCS(sigtimedwait nanosleep)
181    
182    dnl
183    dnl check for sched_setaffinity
184    dnl
185    AC_CHECK_FUNCS(sched_setaffinity)
186    
187    dnl
188    dnl check for pthread_setaffinity_np
189    dnl
190    save_LIBS=$LIBS
191    save_CFLAGS=$CFLAGS
192    LIBS="$PTHREAD_LIBS $LIBS"
193    CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
194    AC_MSG_CHECKING([for pthread_setaffinity_np])
195    AC_LINK_IFELSE(
196      [AC_LANG_PROGRAM(
197        [[#include <pthread.h>]],
198        [[cpu_set_t s; pthread_setaffinity_np(pthread_self(), sizeof(s), &s); ]])],
199      [ ac_cv_func_pthread_setaffinity_np=yes;
200        AC_DEFINE(HAVE_PTHREAD_SETAFFINITY_NP, [1], [is pthread_setaffinity_np available?])],
201      [ac_cv_func_pthread_setaffinity_np=no])
202    AC_MSG_RESULT($ac_cv_func_pthread_setaffinity_np)
203    LIBS=$save_LIBS
204    CFLAGS=$save_CFLAGS
205    
206    dnl
207    dnl check for Linux NUMA support (libnuma)
208    dnl
209    AC_CHECK_LIB(numa,numa_available)
210    if test "$ac_cv_lib_numa_numa_available" = "yes" ; then
211      PTHREAD_LIBS="$PTHREAD_LIBS -lnuma"
212    fi
213    
214    dnl check for /proc/cpuinfo
215    dnl
216    AC_CHECK_FILES(/proc/cpuinfo)
217    
218  dnl  dnl
219  dnl OS-specific linking issues  dnl OS-specific linking issues
# Line 113  Line 266 
266    esac    esac
267    if test -x $ac_cv_use_teem ; then    if test -x $ac_cv_use_teem ; then
268      TEEM_DIR=$ac_cv_use_teem      TEEM_DIR=$ac_cv_use_teem
269        # check that TEEM_DIR actually points to something that looks like teem
270        if test -f $TEEM_DIR/include/teem/nrrd.h ; then
271      AC_MSG_RESULT([ okay])      AC_MSG_RESULT([ okay])
272    else    else
273      TEEM_DIR=none      TEEM_DIR=none
274      AC_MSG_RESULT([ invalid])      AC_MSG_RESULT([ invalid])
275    fi    fi
276      else
277        TEEM_DIR=none
278        AC_MSG_RESULT([ invalid])
279      fi
280  fi  fi
281  if test x"$TEEM_DIR" = xnone ; then  if test x"$TEEM_DIR" = xnone ; then
282    AC_MSG_ERROR([unable to find teem])    AC_MSG_ERROR([unable to find teem])
# Line 131  Line 290 
290  dnl  dnl
291  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])])
292  if test $SMLNJ_MAJOR_VERSION -lt 110 \  if test $SMLNJ_MAJOR_VERSION -lt 110 \
293    -o $SMLNJ_MINOR_VERSION -lt 72    -o $SMLNJ_MINOR_VERSION -lt 73
294  then  then
295    AC_MSG_ERROR([installation requires SML/NJ version 110.72+])    AC_MSG_ERROR([installation requires SML/NJ version 110.73+])
296  fi  fi
297  AC_SUBST(SMLNJ_VERSION)  AC_SUBST(SMLNJ_VERSION)
298    
# Line 186  Line 345 
345  AC_SUBST(INSTALL_SMLNJ_WRAPPER)  AC_SUBST(INSTALL_SMLNJ_WRAPPER)
346    
347  dnl  dnl
348    dnl ******************** C compiler properties ********************
349    dnl
350    
351    dnl
352    dnl run the compiler tests in 64-bit mode
353    dnl
354    save_CFLAGS=$CFLAGS
355    CFLAGS="$CFLAGS $CFLAG_M64"
356    
357    dnl
358    dnl check for gcc builtin atomic operations
359    dnl
360    AC_MSG_CHECKING([for builtin atomic operations])
361    AC_LINK_IFELSE(
362       [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
363       AC_MSG_RESULT(yes)
364       AC_DEFINE(
365        [HAVE_BUILTIN_ATOMIC_OPS], 1,
366        [Define to 1 if gcc compiler provides atomic operations.]),
367       AC_MSG_RESULT(no))
368    
369    AC_C_BIGENDIAN
370    
371    dnl
372    dnl restore CFLAGS
373    dnl
374    CFLAGS=$save_CFLAGS
375    
376    dnl
377    dnl ******************** config.h stuff ********************
378    dnl
379    
380    AC_DEFINE_UNQUOTED(DIDEROT_INCLUDE_PATH,["$DIDEROT_SRCDIR/include"], [path for Diderot header files])
381    
382    AH_TOP([
383    /*
384     * COPYRIGHT (c) 2011 Diderot project. (http://diderot-language.cs.uchicago.edu)
385     * All rights reserved.
386     */
387    
388    #ifndef _DIDEROT_CONFIG_H_
389    #define _DIDEROT_CONFIG_H_
390    
391    ])
392    AH_BOTTOM([
393    
394    #endif /* !_DIDEROT_CONFIG_H_ */
395    ])
396    
397    dnl
398  dnl ******************** write output ********************  dnl ******************** write output ********************
399  dnl  dnl
400    
# Line 193  Line 402 
402  dnl  dnl
403  dnl ***** Makefiles *****  dnl ***** Makefiles *****
404    Makefile    Makefile
405      src/clinfo/Makefile
406    src/dnorm/Makefile    src/dnorm/Makefile
407    src/compiler/Makefile    src/compiler/Makefile
   src/lib/Makefile  
408    src/lib/build/Makefile    src/lib/build/Makefile
409    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
410    test/MIP/Makefile    test/MIP/Makefile
411    test/probe/Makefile    test/probe/Makefile
412  dnl  dnl
413    dnl ***** CM files *****
414      src/compiler/codegen/sources.cm:src/compiler/codegen/sources_cm.in
415    dnl
416  dnl ***** SML source files *****  dnl ***** SML source files *****
417    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
418    src/compiler/common/paths.sml:src/compiler/common/paths_sml.in    src/compiler/common/paths.sml:src/compiler/common/paths_sml.in
419  )  )
420    
421    AC_CONFIG_HEADERS(src/include/Diderot/config.h:config/config_h.in)
422    
423  dnl  dnl
424  dnl shell scripts  dnl shell scripts
425  dnl  dnl
# Line 230  Line 444 
444      AC_CONFIG_FILES(src/lib/build/$1/Makefile)      AC_CONFIG_FILES(src/lib/build/$1/Makefile)
445    ])    ])
446    
447  MK_BUILD_DIR(rt-c-f, c-target, [float])  MK_BUILD_DIR(rt-c-f, c, [float])
448  MK_BUILD_DIR(rt-c-f-debug, c-target, [float debug])  MK_BUILD_DIR(rt-c-f-debug, c, [float debug])
449    MK_BUILD_DIR(rt-c-f-par, parallel, [parallel float])
450    MK_BUILD_DIR(rt-c-f-par-debug, parallel, [parallel float debug])
451    
452    if test x"$CL_ENABLED" = xtrue ; then
453      MK_BUILD_DIR(rt-cl-f, cl, [float])
454      MK_BUILD_DIR(rt-cl-f-debug, cl, [float debug])
455    fi
456    
457  AC_OUTPUT  AC_OUTPUT

Legend:
Removed from v.1158  
changed lines
  Added in v.1403

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