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

SCM Repository

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

Diff of /branches/charisee/configure.ac

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

revision 204, Tue Aug 3 16:41:03 2010 UTC revision 1367, Wed Jun 22 18:40:52 2011 UTC
# Line 9  Line 9 
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) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)]])
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
55    ACX_PTHREAD()
56    
57    dnl
58    dnl Look for NVIDIA's nvcc compiler
59    dnl
60    AC_MSG_NOTICE([checking for CUDA and nvcc])
61    AC_PATH_PROG(NVCC, nvcc, no, $PATH)
62    if test x"$NVCC" = xno ; then
63      AC_MSG_WARN([nvcc not found])
64      CUDA_ENABLED=false
65      NVCC=":"
66    else
67      AC_MSG_RESULT([$NVCC])
68      CUDA_ENABLED=true
69    fi
70    AC_SUBST(NVCC)
71    AC_SUBST(CUDA_ENABLED)
72    
73  dnl  dnl
74  dnl If we are on Mac OS X, check for the presence of macports and/or fink  dnl check for OpenCL support
75  dnl  dnl
76    CL_LIBS="none"
77  case "$host_os" in  case "$host_os" in
78    darwin*) # On Mac OS X we check for installed frameworks    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      # substitutions
113      AC_SUBST(CL_LIBS)
114    fi
115    AC_SUBST(CL_ENABLED)
116    AC_SUBST(CL_VERSION)
117    
118    dnl
119    dnl check for various library routines etc.
120    dnl
121    AC_CHECK_FUNCS(posix_memalign)
122    if test x"$ac_cv_func_posix_memalign" != xyes ; then
123      AC_CHECK_FUNCS(memalign)
124      if test x"$ac_cv_func_posix_memalign" != xyes ; then
125        AC_CHECK_FUNCS(valloc)
126      fi
127    fi
128    
129    AC_CHECK_FUNCS(mach_absolute_time)
130    AC_CHECK_TYPES([struct timespec])
131    AC_CHECK_FUNCS(pthread_barrier_init)
132    
133    dnl
134    dnl check for clock_gettime.  On Linux, this requires librt.
135    dnl
136    save_LIBS=$LIBS
137    LIBS="-lrt $LIBS"
138    AC_MSG_CHECKING([for clock_gettime])
139    AC_LINK_IFELSE(
140      [AC_LANG_PROGRAM(
141        [[#include <time.h>]],
142        [[struct timespec t; clock_gettime(CLOCK_REALTIME, &t); ]])],
143      [ ac_cv_func_clock_gettime=yes;
144        AC_DEFINE(HAVE_CLOCK_GETTIME, [1], [is clock_gettime available?])],
145      [ac_cv_func_clock_gettime=no])
146    AC_MSG_RESULT($ac_cv_func_clock_gettime)
147    if test "$ac_cv_func_clock_gettime" = "no" ; then
148      LIBS=$save_LIBS
149    fi
150    
151    AC_CHECK_FUNCS(pthread_getcpuclockid)
152    AC_CHECK_FUNCS(sigtimedwait nanosleep)
153    
154    dnl
155    dnl check for sched_setaffinity
156    dnl
157    AC_CHECK_FUNCS(sched_setaffinity)
158    
159    dnl
160    dnl check for pthread_setaffinity_np
161    dnl
162    save_LIBS=$LIBS
163    save_CFLAGS=$CFLAGS
164    LIBS="$PTHREAD_LIBS $LIBS"
165    CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
166    AC_MSG_CHECKING([for pthread_setaffinity_np])
167    AC_LINK_IFELSE(
168      [AC_LANG_PROGRAM(
169        [[#include <pthread.h>]],
170        [[cpu_set_t s; pthread_setaffinity_np(pthread_self(), sizeof(s), &s); ]])],
171      [ ac_cv_func_pthread_setaffinity_np=yes;
172        AC_DEFINE(HAVE_PTHREAD_SETAFFINITY_NP, [1], [is pthread_setaffinity_np available?])],
173      [ac_cv_func_pthread_setaffinity_np=no])
174    AC_MSG_RESULT($ac_cv_func_pthread_setaffinity_np)
175    LIBS=$save_LIBS
176    CFLAGS=$save_CFLAGS
177    
178    dnl
179    dnl check for Linux NUMA support (libnuma)
180    dnl
181    AC_CHECK_LIB(numa,numa_available)
182    if test "$ac_cv_lib_numa_numa_available" = "yes" ; then
183      PTHREAD_LIBS="$PTHREAD_LIBS -lnuma"
184    fi
185    
186    dnl check for /proc/cpuinfo
187    dnl
188    AC_CHECK_FILES(/proc/cpuinfo)
189    
190    dnl
191    dnl OS-specific linking issues
192    dnl
193    LD_NEEDS_RPATH=false;
194    LIBM=""
195    case "$host_os" in
196      darwin*) # On Mac OS X we check for the presence of macports and/or fink
197      if test -x /opt/local/bin/port ; then      if test -x /opt/local/bin/port ; then
198        HAS_MACPORTS=yes        HAS_MACPORTS=yes
199      else      else
# Line 50  Line 205 
205        HAS_FINK=no        HAS_FINK=no
206      fi      fi
207    ;;    ;;
208      linux*) # On Linux we include the -rpath option to pick up dynamically-loaded libraries
209        LD_NEEDS_RPATH=true
210        LIBM="-lm"
211      ;;
212  esac  esac
213    
214  if test x"$HAS_MACPORTS" = xyes ; then  if test x"$HAS_MACPORTS" = xyes ; then
# Line 60  Line 219 
219    LDPATHS=""    LDPATHS=""
220  fi  fi
221  AC_SUBST(LDPATHS)  AC_SUBST(LDPATHS)
222    AC_SUBST(LD_NEEDS_RPATH)
223    AC_SUBST(LIBM)
224    
225  dnl  dnl
226  dnl get the path to the TEEM installation  dnl get the path to the TEEM installation
# Line 77  Line 238 
238    esac    esac
239    if test -x $ac_cv_use_teem ; then    if test -x $ac_cv_use_teem ; then
240      TEEM_DIR=$ac_cv_use_teem      TEEM_DIR=$ac_cv_use_teem
241        # check that TEEM_DIR actually points to something that looks like teem
242        if test -f $TEEM_DIR/include/teem/nrrd.h ; then
243      AC_MSG_RESULT([ okay])      AC_MSG_RESULT([ okay])
244    else    else
245      TEEM_DIR=none      TEEM_DIR=none
246      AC_MSG_RESULT([ invalid])      AC_MSG_RESULT([ invalid])
247    fi    fi
248      else
249        TEEM_DIR=none
250        AC_MSG_RESULT([ invalid])
251      fi
252  fi  fi
253  if test x"$TEEM_DIR" = xnone ; then  if test x"$TEEM_DIR" = xnone ; then
254    AC_MSG_ERROR([unable to find teem])    AC_MSG_ERROR([unable to find teem])
# Line 95  Line 262 
262  dnl  dnl
263  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])])
264  if test $SMLNJ_MAJOR_VERSION -lt 110 \  if test $SMLNJ_MAJOR_VERSION -lt 110 \
265    -o $SMLNJ_MINOR_VERSION -lt 72    -o $SMLNJ_MINOR_VERSION -lt 73
266  then  then
267    AC_MSG_ERROR([installation requires SML/NJ version 110.72+])    AC_MSG_ERROR([installation requires SML/NJ version 110.73+])
268  fi  fi
269  AC_SUBST(SMLNJ_VERSION)  AC_SUBST(SMLNJ_VERSION)
270    
# Line 150  Line 317 
317  AC_SUBST(INSTALL_SMLNJ_WRAPPER)  AC_SUBST(INSTALL_SMLNJ_WRAPPER)
318    
319  dnl  dnl
320    dnl ******************** C compiler properties ********************
321    dnl
322    
323    dnl
324    dnl run the compiler tests in 64-bit mode
325    dnl
326    save_CFLAGS=$CFLAGS
327    CFLAGS="$CFLAGS $CFLAG_M64"
328    
329    dnl
330    dnl check for gcc builtin atomic operations
331    dnl
332    AC_MSG_CHECKING([for builtin atomic operations])
333    AC_LINK_IFELSE(
334       [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
335       AC_MSG_RESULT(yes)
336       AC_DEFINE(
337        [HAVE_BUILTIN_ATOMIC_OPS], 1,
338        [Define to 1 if gcc compiler provides atomic operations.]),
339       AC_MSG_RESULT(no))
340    
341    AC_C_BIGENDIAN
342    
343    dnl
344    dnl restore CFLAGS
345    dnl
346    CFLAGS=$save_CFLAGS
347    
348    dnl
349    dnl ******************** config.h stuff ********************
350    dnl
351    
352    AC_DEFINE_UNQUOTED(DIDEROT_INCLUDE_PATH,["$DIDEROT_SRCDIR/include"], [path for Diderot header files])
353    
354    AH_TOP([
355    /*
356     * COPYRIGHT (c) 2011 Diderot project. (http://diderot-language.cs.uchicago.edu)
357     * All rights reserved.
358     */
359    
360    #ifndef _DIDEROT_CONFIG_H_
361    #define _DIDEROT_CONFIG_H_
362    
363    ])
364    AH_BOTTOM([
365    
366    #endif /* !_DIDEROT_CONFIG_H_ */
367    ])
368    
369    dnl
370  dnl ******************** write output ********************  dnl ******************** write output ********************
371  dnl  dnl
372    
373  AC_CONFIG_FILES(  AC_CONFIG_FILES(
374  dnl  dnl
375  dnl ***** Makefiles *****  dnl ***** Makefiles *****
376      Makefile
377    src/dnorm/Makefile    src/dnorm/Makefile
378    src/compiler/Makefile    src/compiler/Makefile
379      src/lib/build/Makefile
380      src/lib/build/mk/build.gmk:src/lib/build/mk/build_gmk.in
381    test/MIP/Makefile    test/MIP/Makefile
382      test/probe/Makefile
383      test/teem/Makefile
384    dnl
385    dnl ***** CM files *****
386      src/compiler/codegen/sources.cm:src/compiler/codegen/sources_cm.in
387  dnl  dnl
388  dnl ***** SML source files *****  dnl ***** SML source files *****
389    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
390      src/compiler/common/paths.sml:src/compiler/common/paths_sml.in
391  )  )
392    
393    AC_CONFIG_HEADERS(src/include/Diderot/config.h:config/config_h.in)
394    
395  dnl  dnl
396  dnl shell scripts  dnl shell scripts
397  dnl  dnl
398  AC_CONFIG_FILES([  AC_CONFIG_FILES([
399    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in
400  ], [chmod +x bin/install-sml-wrapper.sh])  ], [chmod +x bin/install-sml-wrapper.sh])
401    AC_CONFIG_FILES([
402      rtest/scripts/run-one.sh:rtest/scripts/run-one_sh.in
403    ], [chmod +x rtest/scripts/run-one.sh])
404    AC_CONFIG_FILES([
405      rtest/scripts/run.sh:rtest/scripts/run_sh.in
406    ], [chmod +x rtest/scripts/run.sh])
407    
408    dnl
409    dnl generate makefiles for runtime library builds
410    dnl
411    dnl usage: MK_BUILD_DIR(<build-dir>, <target-platform>, <options>)
412    dnl
413    AC_DEFUN([MK_BUILD_DIR], [
414        if test ! -d src/lib/build/$1 ; then
415          mkdir src/lib/build/$1
416        fi
417        [sed -e 's,@BUILD_TARGET@,$1,g' \
418          -e 's,@TARGET_PLATFORM@,$2,g' \
419          -e 's,@BUILD_OPTIONS@,$3,g' \
420          src/lib/build/mk/Makefile.in \
421            > src/lib/build/$1/Makefile.in]
422        AC_CONFIG_FILES(src/lib/build/$1/Makefile)
423      ])
424    
425    MK_BUILD_DIR(rt-c-f, c, [float])
426    MK_BUILD_DIR(rt-c-f-debug, c, [float debug])
427    MK_BUILD_DIR(rt-c-f-par, parallel, [parallel float])
428    MK_BUILD_DIR(rt-c-f-par-debug, parallel, [parallel float debug])
429    
430  AC_OUTPUT  AC_OUTPUT

Legend:
Removed from v.204  
changed lines
  Added in v.1367

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