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

SCM Repository

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

Diff of /branches/lamont/configure.ac

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

revision 3, Wed Jan 6 04:47:22 2010 UTC revision 1531, Fri Oct 14 18:45:50 2011 UTC
# Line 4  Line 4 
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) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)]])
11  AC_CONFIG_SRCDIR(??)  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)
14    
15  dnl  dnl
16  dnl include additional macros  dnl include additional macros
17  dnl  dnl
 dnl sinclude(config/ax_check_gl.m4)  
 dnl sinclude(config/ax_check_glu.m4)  
 dnl sinclude(config/ax_check_glut.m4)  
18  sinclude(config/acx_pthread.m4)  sinclude(config/acx_pthread.m4)
19  sinclude(config/ax_lang_compiler_ms.m4)  sinclude(config/check_smlnj.m4)
20    sinclude(config/check_smlnj_heap_suffix.m4)
21  sinclude(config/ax_check_framework.m4)  sinclude(config/ax_check_framework.m4)
 sinclude(config/ax_check_macports.m4)  
 sinclude(config/ax_check_lib_stdcall.m4)  
22    
23  dnl  dnl
24  dnl get host and target information  dnl get host information
25  dnl  dnl
26  AC_CANONICAL_HOST  AC_CANONICAL_HOST
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
44    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
56    dnl Look for NVIDIA's nvcc compiler
57    dnl
58    AC_MSG_NOTICE([checking for CUDA and nvcc])
59    AC_PATH_PROG(NVCC, nvcc, no, $PATH)
60    if test x"$NVCC" = xno ; then
61      AC_MSG_WARN([nvcc not found])
62      CUDA_ENABLED=false
63      NVCC=":"
64    else
65      AC_MSG_RESULT([$NVCC])
66      CUDA_ENABLED=true
67    fi
68    AC_SUBST(NVCC)
69    AC_SUBST(CUDA_ENABLED)
70    
71    dnl
72    dnl check for OpenCL support
73    dnl
74    CL_LIBS="none"
75    case "$host_os" in
76      darwin*) # On Mac OS X we check for installed frameworks
77        AX_CHECK_FRAMEWORK([OpenCL], [CL_LIBS="-framework OpenCL"], [])
78      ;;
79      *)
80        AC_CHECK_LIB([OpenCL],[clGetPlatformIDs],[CL_LIBS="-lOpenCL"])
81      ;;
82    esac
83    if test x"$CL_LIBS" = xnone ; then
84      AC_MSG_WARN([no OpenCL library found])
85      CL_ENABLED=false
86      CL_VERSION=0
87    else
88      CL_ENABLED=true
89      AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h])
90      # check the cl.h header for which version of OpenCL is supported
91      AC_LANG([C])
92      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
93    #include <stdio.h>
94    # ifdef HAVE_CL_CL_H
95    #   include <CL/cl.h>
96    # elif defined(HAVE_OPENCL_CL_H)
97    #   include <OpenCL/cl.h>
98    # else
99    #   error no cl.h
100    # endif]],
101    [[#if defined(CL_VERSION_1_1)
102      printf("11000\n");
103    #elif defined(CL_VERSION_1_0)
104      printf("10000\n");
105    #else
106      printf("0\n");
107    #endif
108        ]])],
109        [CL_VERSION=`./conftest$EXEEXT`], [CL_VERSION=0])
110      # substitutions
111      AC_SUBST(CL_LIBS)
112    fi
113    AC_SUBST(CL_ENABLED)
114    AC_SUBST(CL_VERSION)
115    
116    dnl
117    dnl check for various library routines etc.
118    dnl
119    AC_CHECK_FUNCS(posix_memalign)
120    if test x"$ac_cv_func_posix_memalign" != xyes ; then
121      AC_CHECK_FUNCS(memalign)
122      if test x"$ac_cv_func_posix_memalign" != xyes ; then
123        AC_CHECK_FUNCS(valloc)
124      fi
125    fi
126    
127    AC_CHECK_FUNCS(mach_absolute_time)
128    AC_CHECK_TYPES([struct timespec])
129    AC_CHECK_FUNCS(pthread_barrier_init)
130    
131    dnl
132    dnl check for clock_gettime.  On Linux, this requires librt.
133    dnl
134    save_LIBS=$LIBS
135    LIBS="-lrt $LIBS"
136    AC_MSG_CHECKING([for clock_gettime])
137    AC_LINK_IFELSE(
138      [AC_LANG_PROGRAM(
139        [[#include <time.h>]],
140        [[struct timespec t; clock_gettime(CLOCK_REALTIME, &t); ]])],
141      [ ac_cv_func_clock_gettime=yes;
142        AC_DEFINE(HAVE_CLOCK_GETTIME, [1], [is clock_gettime available?])],
143      [ac_cv_func_clock_gettime=no])
144    AC_MSG_RESULT($ac_cv_func_clock_gettime)
145    if test "$ac_cv_func_clock_gettime" = "no" ; then
146      LIBS=$save_LIBS
147    fi
148    
149    AC_CHECK_FUNCS(pthread_getcpuclockid)
150    AC_CHECK_FUNCS(sigtimedwait nanosleep)
151    
152    dnl
153    dnl check for sched_setaffinity
154    dnl
155    AC_CHECK_FUNCS(sched_setaffinity)
156    
157    dnl
158    dnl check for pthread_setaffinity_np
159    dnl
160    save_LIBS=$LIBS
161    save_CFLAGS=$CFLAGS
162    LIBS="$PTHREAD_LIBS $LIBS"
163    CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
164    AC_MSG_CHECKING([for pthread_setaffinity_np])
165    AC_LINK_IFELSE(
166      [AC_LANG_PROGRAM(
167        [[#include <pthread.h>]],
168        [[cpu_set_t s; pthread_setaffinity_np(pthread_self(), sizeof(s), &s); ]])],
169      [ ac_cv_func_pthread_setaffinity_np=yes;
170        AC_DEFINE(HAVE_PTHREAD_SETAFFINITY_NP, [1], [is pthread_setaffinity_np available?])],
171      [ac_cv_func_pthread_setaffinity_np=no])
172    AC_MSG_RESULT($ac_cv_func_pthread_setaffinity_np)
173    LIBS=$save_LIBS
174    CFLAGS=$save_CFLAGS
175    
176    dnl
177    dnl check for Linux NUMA support (libnuma)
178    dnl
179    AC_CHECK_LIB(numa,numa_available)
180    if test "$ac_cv_lib_numa_numa_available" = "yes" ; then
181      PTHREAD_LIBS="$PTHREAD_LIBS -lnuma"
182    fi
183    
184    dnl check for /proc/cpuinfo
185    dnl
186    AC_CHECK_FILES(/proc/cpuinfo)
187    
188    dnl
189    dnl OS-specific linking issues
190    dnl
191    LD_NEEDS_RPATH=false;
192    LIBM=""
193    case "$host_os" in
194      darwin*) # On Mac OS X we check for the presence of macports and/or fink
195        if test -x /opt/local/bin/port ; then
196          HAS_MACPORTS=yes
197        else
198          HAS_MACPORTS=no
199        fi
200        if test -x /sw/bin/fink ; then
201          HAS_FINK=yes
202        else
203          HAS_FINK=no
204        fi
205      ;;
206      linux*) # On Linux we include the -rpath option to pick up dynamically-loaded libraries
207        LD_NEEDS_RPATH=true
208        LIBM="-lm"
209      ;;
210    esac
211    
212    if test x"$HAS_MACPORTS" = xyes ; then
213      LDPATHS="-L/opt/local/lib"
214    elif test x"$HAS_FINK" = xyes ; then
215      LDPATHS="-L/sw/lib"
216    else
217      LDPATHS=""
218    fi
219    AC_SUBST(LDPATHS)
220    AC_SUBST(LD_NEEDS_RPATH)
221    AC_SUBST(LIBM)
222    
223    dnl
224    dnl get the path to the TEEM installation
225    dnl
226    AC_ARG_WITH(teem,
227      AC_HELP_STRING([--with-teem=<path>], [specify path to teem installation]),
228      [ac_cv_use_teem=$withval], [ac_cv_use_teem=no])
229    if test x"$ac_cv_use_teem" = xno ; then
230      TEEM_DIR=none
231    else
232      AC_MSG_CHECKING([path to teem ($ac_cv_use_teem)])
233      case $ac_cv_use_teem in
234        /*) ;;
235        *) AC_MSG_ERROR([path to teem must be absolute]) ;;
236      esac
237      if test -x $ac_cv_use_teem ; then
238        TEEM_DIR=$ac_cv_use_teem
239        # check that TEEM_DIR actually points to something that looks like teem
240        if test -f $TEEM_DIR/include/teem/nrrd.h ; then
241          AC_MSG_RESULT([ okay])
242        else
243          TEEM_DIR=none
244          AC_MSG_RESULT([ invalid])
245        fi
246      else
247        TEEM_DIR=none
248        AC_MSG_RESULT([ invalid])
249      fi
250    fi
251    if test x"$TEEM_DIR" = xnone ; then
252      AC_MSG_ERROR([unable to find teem])
253    fi
254    AC_SUBST(TEEM_DIR)
255    
256    dnl ******************** SML/NJ configuration ********************
257    dnl
258    
259    dnl check that we have a compatible version of SML/NJ
260    dnl
261    CHECK_SMLNJ([AC_MSG_ERROR([unable to find SML/NJ installation; check your PATH or set SMLNJ_CMD])])
262    if test $SMLNJ_MAJOR_VERSION -lt 110 \
263      -o $SMLNJ_MINOR_VERSION -lt 73
264    then
265      AC_MSG_ERROR([installation requires SML/NJ version 110.73+])
266    fi
267    AC_SUBST(SMLNJ_VERSION)
268    
269    dnl determine the heap-image suffix
270    dnl
271    CHECK_SMLNJ_HEAP_SUFFIX([
272      AC_MSG_ERROR([unsupported configuration ${host_cpu}-${host_os}])])
273    
274    dnl look for ml-makedepend
275    dnl
276    AC_MSG_CHECKING([for ml-makedepend])
277    tmpPATH="$SMLNJ_PATH:$PATH"
278    AC_PATH_PROG(ML_MAKEDEPEND, ml-makedepend, ":", $tmpPATH)
279    if test $ML_MAKEDEPEND = none ; then
280      AC_MSG_ERROR([ml-makedepend not found])
281    else
282      AC_MSG_RESULT([$ML_MAKEDEPEND])
283    fi
284    AC_SUBST(ML_MAKEDEPEND)
285    
286    dnl
287    dnl look for ml-build
288    dnl
289    tmpPATH="$SMLNJ_PATH:$PATH"
290    AC_PATH_PROG(ML_BUILD, ml-build, none, $tmpPATH)
291    if test $ML_BUILD = none ; then
292      AC_MSG_ERROR([ml-build not found])
293    fi
294    AC_SUBST(ML_BUILD)
295    
296    dnl ******************** Paths ********************
297    
298    DIDEROT_ROOT=`pwd`
299    DIDEROT_DOCDIR=$DIDEROT_ROOT/doc
300    DIDEROT_SRCDIR=$DIDEROT_ROOT/src
301    DIDEROT_LIBDIR=$DIDEROT_ROOT/lib
302    DIDEROT_BINDIR=$DIDEROT_ROOT/bin
303    DIDEROT_MKDIR=$DIDEROT_ROOT/mk
304    
305    HEAP_IMAGE_DIR=$DIDEROT_BINDIR/.heap
306    INSTALL_SMLNJ_WRAPPER=$DIDEROT_BINDIR/install-sml-wrapper.sh
307    
308    AC_SUBST(DIDEROT_ROOT)
309    AC_SUBST(DIDEROT_DOCDIR)
310    AC_SUBST(DIDEROT_SRCDIR)
311    AC_SUBST(DIDEROT_LIBDIR)
312    AC_SUBST(DIDEROT_BINDIR)
313    AC_SUBST(DIDEROT_MKDIR)
314    AC_SUBST(HEAP_IMAGE_DIR)
315    AC_SUBST(INSTALL_SMLNJ_WRAPPER)
316    
317    dnl
318    dnl ******************** C compiler properties ********************
319    dnl
320    
321    dnl
322    dnl run the compiler tests in 64-bit mode
323    dnl
324    save_CFLAGS=$CFLAGS
325    CFLAGS="$CFLAGS $CFLAG_M64"
326    
327    dnl
328    dnl check for gcc builtin atomic operations
329    dnl
330    AC_MSG_CHECKING([for builtin atomic operations])
331    AC_LINK_IFELSE(
332       [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
333       AC_MSG_RESULT(yes)
334       AC_DEFINE(
335        [HAVE_BUILTIN_ATOMIC_OPS], 1,
336        [Define to 1 if gcc compiler provides atomic operations.]),
337       AC_MSG_RESULT(no))
338    
339    AC_C_BIGENDIAN
340    
341    dnl
342    dnl restore CFLAGS
343    dnl
344    CFLAGS=$save_CFLAGS
345    
346    dnl
347    dnl ******************** config.h stuff ********************
348    dnl
349    
350    AC_DEFINE_UNQUOTED(DIDEROT_INCLUDE_PATH,["$DIDEROT_SRCDIR/include"], [path for Diderot header files])
351    
352    AH_TOP([
353    /*
354     * COPYRIGHT (c) 2011 Diderot project. (http://diderot-language.cs.uchicago.edu)
355     * All rights reserved.
356     */
357    
358    #ifndef _DIDEROT_CONFIG_H_
359    #define _DIDEROT_CONFIG_H_
360    
361    ])
362    AH_BOTTOM([
363    
364    #endif /* !_DIDEROT_CONFIG_H_ */
365    ])
366    
367    dnl
368    dnl ******************** write output ********************
369    dnl
370    
371    AC_CONFIG_FILES(
372    dnl
373    dnl ***** Makefiles *****
374      Makefile
375      src/dnorm/Makefile
376      src/compiler/Makefile
377      src/lib/build/Makefile
378      src/lib/build/mk/build.gmk:src/lib/build/mk/build_gmk.in
379      test/MIP/Makefile
380      test/probe/Makefile
381      test/teem/Makefile
382    dnl
383    dnl ***** CM files *****
384      src/compiler/codegen/sources.cm:src/compiler/codegen/sources_cm.in
385    dnl
386    dnl ***** SML source files *****
387      src/compiler/fields/run-dnorm.sml:src/compiler/fields/run-dnorm_sml.in
388      src/compiler/common/paths.sml:src/compiler/common/paths_sml.in
389    )
390    
391    AC_CONFIG_HEADERS(src/include/Diderot/config.h:config/config_h.in)
392    
393    dnl
394    dnl shell scripts
395    dnl
396    AC_CONFIG_FILES([
397      bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in
398    ], [chmod +x bin/install-sml-wrapper.sh])
399    AC_CONFIG_FILES([
400      rtest/scripts/run-one.sh:rtest/scripts/run-one_sh.in
401    ], [chmod +x rtest/scripts/run-one.sh])
402    AC_CONFIG_FILES([
403      rtest/scripts/run.sh:rtest/scripts/run_sh.in
404    ], [chmod +x rtest/scripts/run.sh])
405    
406    dnl
407    dnl generate makefiles for runtime library builds
408    dnl
409    dnl usage: MK_BUILD_DIR(<build-dir>, <target-platform>, <options>)
410    dnl
411    AC_DEFUN([MK_BUILD_DIR], [
412        if test ! -d src/lib/build/$1 ; then
413          mkdir src/lib/build/$1
414        fi
415        [sed -e 's,@BUILD_TARGET@,$1,g' \
416          -e 's,@TARGET_PLATFORM@,$2,g' \
417          -e 's,@BUILD_OPTIONS@,$3,g' \
418          src/lib/build/mk/Makefile.in \
419            > src/lib/build/$1/Makefile.in]
420        AC_CONFIG_FILES(src/lib/build/$1/Makefile)
421      ])
422    
423    MK_BUILD_DIR(rt-c-f, c, [float])
424    MK_BUILD_DIR(rt-c-f-debug, c, [float debug])
425    MK_BUILD_DIR(rt-c-f-par, parallel, [parallel float])
426    MK_BUILD_DIR(rt-c-f-par-debug, parallel, [parallel float debug])
427    
428  AC_OUTPUT  AC_OUTPUT

Legend:
Removed from v.3  
changed lines
  Added in v.1531

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