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

SCM Repository

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

Diff of /branches/charisee_dev/configure.ac

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

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

Legend:
Removed from v.321  
changed lines
  Added in v.1990

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