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

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

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