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

SCM Repository

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

Diff of /branches/staging/configure.ac

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

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

Legend:
Removed from v.123  
changed lines
  Added in v.1838

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