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

SCM Repository

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

Diff of /branches/charisee/configure.ac

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

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

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

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