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 3, Wed Jan 6 04:47:22 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(??)  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)
16    
17  dnl  dnl
18  dnl include additional macros  dnl include additional macros
19  dnl  dnl
 dnl sinclude(config/ax_check_gl.m4)  
 dnl sinclude(config/ax_check_glu.m4)  
 dnl sinclude(config/ax_check_glut.m4)  
20  sinclude(config/acx_pthread.m4)  sinclude(config/acx_pthread.m4)
21  sinclude(config/ax_lang_compiler_ms.m4)  sinclude(config/check_smlnj.m4)
22    sinclude(config/check_smlnj_heap_suffix.m4)
23  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)  
24    
25  dnl  dnl
26  dnl get host and target information  dnl get host information
27  dnl  dnl
28  AC_CANONICAL_HOST  AC_CANONICAL_HOST
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
74    dnl check for OpenCL support
75    dnl
76    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      # 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
198          HAS_MACPORTS=yes
199        else
200          HAS_MACPORTS=no
201        fi
202        if test -x /sw/bin/fink ; then
203          HAS_FINK=yes
204        else
205          HAS_FINK=no
206        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
213    
214    if test x"$HAS_MACPORTS" = xyes ; then
215      LDPATHS="-L/opt/local/lib"
216    elif test x"$HAS_FINK" = xyes ; then
217      LDPATHS="-L/sw/lib"
218    else
219      LDPATHS=""
220    fi
221    AC_SUBST(LDPATHS)
222    AC_SUBST(LD_NEEDS_RPATH)
223    AC_SUBST(LIBM)
224    
225    dnl
226    dnl get the path to the TEEM installation
227    dnl
228    AC_ARG_WITH(teem,
229      AC_HELP_STRING([--with-teem=<path>], [specify path to teem installation]),
230      [ac_cv_use_teem=$withval], [ac_cv_use_teem=no])
231    if test x"$ac_cv_use_teem" = xno ; then
232      TEEM_DIR=none
233    else
234      AC_MSG_CHECKING([path to teem ($ac_cv_use_teem)])
235      case $ac_cv_use_teem in
236        /*) ;;
237        *) AC_MSG_ERROR([path to teem must be absolute]) ;;
238      esac
239      if test -x $ac_cv_use_teem ; then
240        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])
244        else
245          TEEM_DIR=none
246          AC_MSG_RESULT([ invalid])
247        fi
248      else
249        TEEM_DIR=none
250        AC_MSG_RESULT([ invalid])
251      fi
252    fi
253    if test x"$TEEM_DIR" = xnone ; then
254      AC_MSG_ERROR([unable to find teem])
255    fi
256    AC_SUBST(TEEM_DIR)
257    
258    dnl ******************** SML/NJ configuration ********************
259    dnl
260    
261    dnl check that we have a compatible version of SML/NJ
262    dnl
263    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 \
265      -o $SMLNJ_MINOR_VERSION -lt 73
266    then
267      AC_MSG_ERROR([installation requires SML/NJ version 110.73+])
268    fi
269    AC_SUBST(SMLNJ_VERSION)
270    
271    dnl determine the heap-image suffix
272    dnl
273    CHECK_SMLNJ_HEAP_SUFFIX([
274      AC_MSG_ERROR([unsupported configuration ${host_cpu}-${host_os}])])
275    
276    dnl look for ml-makedepend
277    dnl
278    AC_MSG_CHECKING([for ml-makedepend])
279    tmpPATH="$SMLNJ_PATH:$PATH"
280    AC_PATH_PROG(ML_MAKEDEPEND, ml-makedepend, ":", $tmpPATH)
281    if test $ML_MAKEDEPEND = none ; then
282      AC_MSG_ERROR([ml-makedepend not found])
283    else
284      AC_MSG_RESULT([$ML_MAKEDEPEND])
285    fi
286    AC_SUBST(ML_MAKEDEPEND)
287    
288    dnl
289    dnl look for ml-build
290    dnl
291    tmpPATH="$SMLNJ_PATH:$PATH"
292    AC_PATH_PROG(ML_BUILD, ml-build, none, $tmpPATH)
293    if test $ML_BUILD = none ; then
294      AC_MSG_ERROR([ml-build not found])
295    fi
296    AC_SUBST(ML_BUILD)
297    
298    dnl ******************** Paths ********************
299    
300    DIDEROT_ROOT=`pwd`
301    DIDEROT_DOCDIR=$DIDEROT_ROOT/doc
302    DIDEROT_SRCDIR=$DIDEROT_ROOT/src
303    DIDEROT_LIBDIR=$DIDEROT_ROOT/lib
304    DIDEROT_BINDIR=$DIDEROT_ROOT/bin
305    DIDEROT_MKDIR=$DIDEROT_ROOT/mk
306    
307    HEAP_IMAGE_DIR=$DIDEROT_BINDIR/.heap
308    INSTALL_SMLNJ_WRAPPER=$DIDEROT_BINDIR/install-sml-wrapper.sh
309    
310    AC_SUBST(DIDEROT_ROOT)
311    AC_SUBST(DIDEROT_DOCDIR)
312    AC_SUBST(DIDEROT_SRCDIR)
313    AC_SUBST(DIDEROT_LIBDIR)
314    AC_SUBST(DIDEROT_BINDIR)
315    AC_SUBST(DIDEROT_MKDIR)
316    AC_SUBST(HEAP_IMAGE_DIR)
317    AC_SUBST(INSTALL_SMLNJ_WRAPPER)
318    
319    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 ********************
371    dnl
372    
373    AC_CONFIG_FILES(
374    dnl
375    dnl ***** Makefiles *****
376      Makefile
377      src/dnorm/Makefile
378      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
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
388    dnl ***** SML source files *****
389      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
396    dnl shell scripts
397    dnl
398    AC_CONFIG_FILES([
399      bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in
400    ], [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.3  
changed lines
  Added in v.1367

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