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

SCM Repository

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

Diff of /branches/vis15/configure.ac

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

trunk/configure.ac revision 436, Tue Oct 19 14:35:45 2010 UTC branches/vis12/configure.ac revision 2111, Mon Dec 17 16:55:33 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 (http://diderot-language.cs.uchicago.edu)]])  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 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 standard headers
60    dnl
61    AC_HEADER_STDBOOL
62    
63    dnl
64    dnl check for pthreads support
65    dnl
66    ACX_PTHREAD
67    
68    dnl check for doxygen
69    dnl
70    AC_ARG_WITH([doxygen],
71      [AS_HELP_STRING([--with-doxygen=PATH], [specify location of doxygen executable])],
72      [DOXYGEN=$with_doxygen],
73      [DOXYGEN=none])
74    if test x$DOXYGEN = xnone ; then
75      # see if we can find doxygen in the user's path
76      AC_PATH_PROG(DOXYGEN, [doxygen], [none])
77    fi
78    if test x$with_doxygen = xyes -o x$with_doxygen = xno ; then
79      AC_MSG_ERROR([--with-doxygen option must specify directory argument])
80    elif test x$DOXYGEN != xnone -a ! -x $DOXYGEN ; then
81      AC_MSG_ERROR([doxygen not found at $DOXYGEN])
82    elif test x$DOXYGEN != xnone ; then
83  dnl  dnl
84  dnl If we are on Mac OS X, check for the presence of macports and/or fink  dnl verify that $DOXYGEN is an absolute path
85    dnl
86      case $DOXYGEN in
87        /*) ;;
88        *) AC_MSG_ERROR([--with-doxygen path must be absolute]) ;;
89      esac
90    fi
91    if test $DOXYGEN = xnone ; then
92      DOXYGEN=:
93    fi
94    AC_SUBST(DOXYGEN)
95    
96  dnl  dnl
97    dnl Look for NVIDIA's nvcc compiler
98    dnl
99    AC_MSG_NOTICE([checking for CUDA and nvcc])
100    AC_PATH_PROG(NVCC, nvcc, no, $PATH)
101    if test x"$NVCC" = xno ; then
102      AC_MSG_WARN([nvcc not found])
103      CUDA_ENABLED=false
104      NVCC=":"
105    else
106      AC_MSG_RESULT([$NVCC])
107      CUDA_ENABLED=true
108    fi
109    AC_SUBST(NVCC)
110    AC_SUBST(CUDA_ENABLED)
111    
112    dnl
113    dnl check for OpenCL support
114    dnl
115    LIBS_CL="none"
116  case "$host_os" in  case "$host_os" in
117    darwin*) # On Mac OS X we check for installed frameworks    darwin*) # On Mac OS X we check for installed frameworks
118        AX_CHECK_FRAMEWORK([OpenCL], [LIBS_CL="-framework OpenCL"], [])
119      ;;
120      *)
121        AC_CHECK_LIB([OpenCL],[clGetPlatformIDs],[LIBS_CL="-lOpenCL"])
122      ;;
123    esac
124    if test x"$LIBS_CL" = xnone ; then
125      AC_MSG_WARN([no OpenCL library found])
126      CL_ENABLED=false
127      CL_VERSION=0
128    else
129      CL_ENABLED=true
130      CPPFLAGS_CL=""
131      CL_HEADER=""
132      AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h], [HAVE_CL_H="yes"; CL_HEADER="$ac_header"; break], [HAVE_CL_H="no"])
133      if test x"$HAVE_CL_H" = xno ; then
134        # check for AMD's SDK
135        AC_MSG_CHECKING([for cl.h in AMD's SDK])
136        if test -d /opt/AMDAPP/include/CL ; then
137          HAVE_CL_H="yes"
138          CL_HEADER="/opt/AMDAPP/include/CL/cl.h"
139          AC_DEFINE([HAVE_CL_CL_H])
140          CPPFLAGS_CL="-I/opt/AMDAPP/include"
141        fi
142        AC_MSG_RESULT([$HAVE_CL_H])
143      fi
144      if test x"$HAVE_CL_H" = xno ; then
145        AC_MSG_WARN([no cl.h found])
146        CL_ENABLED=false
147        CL_VERSION=0
148        SIZEOF_CL_INT=0
149        SIZEOF_CL_LONG=0
150        SIZEOF_CL_FLOAT=0
151        SIZEOF_CL_DOUBLE=0
152      else
153        # check the cl.h header for which version of OpenCL is supported
154        AC_LANG([C])
155        save_CPPFLAGS=$CPPFLAGS
156        CPPFLAGS="$CPPFLAGS_CL $CPPFLAGS"
157        AC_LINK_IFELSE([AC_LANG_PROGRAM([[
158    #include <stdio.h>
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    [[#if defined(CL_VERSION_1_1)
167      printf("11000\n");
168    #elif defined(CL_VERSION_1_0)
169      printf("10000\n");
170    #else
171      printf("0\n");
172    #endif
173          ]])],
174          [CL_VERSION=`./conftest$EXEEXT`], [CL_VERSION=0])
175    dnl
176    dnl check to see how we access the host-side vector types.  For OpenCL 1.1,
177    dnl the specification specifies the behavior, but it was unspecified in 1.0.
178    dnl
179        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
180    #include "$CL_HEADER"
181    ]],
182          [[cl_float4 x; x[0] = 0.0;]])],
183          [AC_DEFINE([CL_HOST_VECTORS_ARE_ARRAYS],[1],[host vector types are arrays])],
184    dnl
185    dnl not arrays, so try the OpenCL 1.1 structure representation
186    dnl
187          [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
188    #include "$CL_HEADER"
189    ]],
190          [[cl_float4 x; x.s[0] = 0.0;]])],
191          [AC_DEFINE([CL_HOST_VECTORS_ARE_STRUCTS],[1],[host vector types are structs])],
192          [AC_MSG_ERROR([unable to figure out host types for OpenCL vectors])])])
193      # restore saved CPPFLAGS
194        CPPFLAGS=$save_CPPFLAGS
195      # substitutions
196        AC_SUBST(LIBS_CL)
197        AC_SUBST(CPPFLAGS_CL)
198      #
199      # determine the sizes of the host-side OpenCL types
200      AC_CHECK_SIZEOF([cl_int], [], [#include "$CL_HEADER"])
201      SIZEOF_CL_INT=$ac_cv_sizeof_cl_int
202      AC_CHECK_SIZEOF([cl_long], [], [#include "$CL_HEADER"])
203      SIZEOF_CL_LONG=$ac_cv_sizeof_cl_long
204      AC_CHECK_SIZEOF([cl_float], [], [#include "$CL_HEADER"])
205      SIZEOF_CL_FLOAT=$ac_cv_sizeof_cl_float
206      AC_CHECK_SIZEOF([cl_double], [], [#include "$CL_HEADER"])
207      SIZEOF_CL_DOUBLE=$ac_cv_sizeof_cl_double
208      fi
209    fi
210    AC_SUBST(CL_ENABLED)
211    AC_SUBST(CL_VERSION)
212    
213    AC_SUBST(SIZEOF_CL_INT)
214    AC_SUBST(SIZEOF_CL_LONG)
215    AC_SUBST(SIZEOF_CL_FLOAT)
216    AC_SUBST(SIZEOF_CL_DOUBLE)
217    
218    dnl
219    dnl check for various library routines etc.
220    dnl
221    AC_CHECK_FUNCS(posix_memalign)
222    if test x"$ac_cv_func_posix_memalign" != xyes ; then
223      AC_CHECK_FUNCS(memalign)
224      if test x"$ac_cv_func_posix_memalign" != xyes ; then
225        AC_CHECK_FUNCS(valloc)
226      fi
227    fi
228    
229    AC_CHECK_FUNCS(mach_absolute_time)
230    AC_CHECK_TYPES([struct timespec])
231    AC_CHECK_FUNCS(pthread_barrier_init)
232    
233    dnl
234    dnl check for clock_gettime.  On Linux, this requires librt.
235    dnl
236    save_LIBS=$LIBS
237    LIBS="-lrt $LIBS"
238    AC_MSG_CHECKING([for clock_gettime])
239    AC_LINK_IFELSE(
240      [AC_LANG_PROGRAM(
241        [[#include <time.h>]],
242        [[struct timespec t; clock_gettime(CLOCK_REALTIME, &t); ]])],
243      [ ac_cv_func_clock_gettime=yes;
244        AC_DEFINE(HAVE_CLOCK_GETTIME, [1], [is clock_gettime available?])],
245      [ac_cv_func_clock_gettime=no])
246    AC_MSG_RESULT($ac_cv_func_clock_gettime)
247    if test "$ac_cv_func_clock_gettime" = "no" ; then
248      LIBS=$save_LIBS
249    fi
250    
251    AC_CHECK_FUNCS(pthread_getcpuclockid)
252    AC_CHECK_FUNCS(sigtimedwait nanosleep)
253    
254    dnl
255    dnl check for sched_setaffinity
256    dnl
257    AC_CHECK_FUNCS(sched_setaffinity)
258    
259    dnl
260    dnl check for pthread_setaffinity_np
261    dnl
262    save_LIBS=$LIBS
263    save_CFLAGS=$CFLAGS
264    LIBS="$PTHREAD_LIBS $LIBS"
265    CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
266    AC_MSG_CHECKING([for pthread_setaffinity_np])
267    AC_LINK_IFELSE(
268      [AC_LANG_PROGRAM(
269        [[#include <pthread.h>]],
270        [[cpu_set_t s; pthread_setaffinity_np(pthread_self(), sizeof(s), &s); ]])],
271      [ ac_cv_func_pthread_setaffinity_np=yes;
272        AC_DEFINE(HAVE_PTHREAD_SETAFFINITY_NP, [1], [is pthread_setaffinity_np available?])],
273      [ac_cv_func_pthread_setaffinity_np=no])
274    AC_MSG_RESULT($ac_cv_func_pthread_setaffinity_np)
275    LIBS=$save_LIBS
276    CFLAGS=$save_CFLAGS
277    
278    dnl
279    dnl check for Linux NUMA support (libnuma)
280    dnl
281    AC_CHECK_LIB(numa,numa_available)
282    if test "$ac_cv_lib_numa_numa_available" = "yes" ; then
283      PTHREAD_LIBS="$PTHREAD_LIBS -lnuma"
284    fi
285    
286    dnl check for /proc/cpuinfo
287    dnl
288    AC_CHECK_FILES(/proc/cpuinfo)
289    
290    dnl
291    dnl OS-specific linking issues
292    dnl
293    LD_NEEDS_RPATH=false;
294    LIBM=""
295    case "$host_os" in
296      darwin*) # On Mac OS X we check for the presence of macports and/or fink
297      if test -x /opt/local/bin/port ; then      if test -x /opt/local/bin/port ; then
298        HAS_MACPORTS=yes        HAS_MACPORTS=yes
299      else      else
# Line 50  Line 305 
305        HAS_FINK=no        HAS_FINK=no
306      fi      fi
307    ;;    ;;
308      linux*) # On Linux we include the -rpath option to pick up dynamically-loaded libraries
309        LD_NEEDS_RPATH=true
310        LIBM="-lm"
311      ;;
312  esac  esac
313    
314  if test x"$HAS_MACPORTS" = xyes ; then  if test x"$HAS_MACPORTS" = xyes ; then
# Line 60  Line 319 
319    LDPATHS=""    LDPATHS=""
320  fi  fi
321  AC_SUBST(LDPATHS)  AC_SUBST(LDPATHS)
322    AC_SUBST(LD_NEEDS_RPATH)
323    AC_SUBST(LIBM)
324    
325  dnl  dnl
326  dnl get the path to the TEEM installation  dnl get the path to the TEEM installation
# Line 77  Line 338 
338    esac    esac
339    if test -x $ac_cv_use_teem ; then    if test -x $ac_cv_use_teem ; then
340      TEEM_DIR=$ac_cv_use_teem      TEEM_DIR=$ac_cv_use_teem
341        # check that TEEM_DIR actually points to something that looks like teem
342        if test -f $TEEM_DIR/include/teem/nrrd.h ; then
343      AC_MSG_RESULT([ okay])      AC_MSG_RESULT([ okay])
344    else    else
345      TEEM_DIR=none      TEEM_DIR=none
346      AC_MSG_RESULT([ invalid])      AC_MSG_RESULT([ invalid])
347    fi    fi
348      else
349        TEEM_DIR=none
350        AC_MSG_RESULT([ invalid])
351      fi
352  fi  fi
353  if test x"$TEEM_DIR" = xnone ; then  if test x"$TEEM_DIR" = xnone ; then
354    AC_MSG_ERROR([unable to find teem])    AC_MSG_ERROR([unable to find teem; use --with-teem option to specify location])
355  fi  fi
356  AC_SUBST(TEEM_DIR)  AC_SUBST(TEEM_DIR)
357    
# Line 95  Line 362 
362  dnl  dnl
363  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])])
364  if test $SMLNJ_MAJOR_VERSION -lt 110 \  if test $SMLNJ_MAJOR_VERSION -lt 110 \
365    -o $SMLNJ_MINOR_VERSION -lt 72    -o $SMLNJ_MINOR_VERSION -lt 73
366  then  then
367    AC_MSG_ERROR([installation requires SML/NJ version 110.72+])    AC_MSG_ERROR([installation requires SML/NJ version 110.73+])
368  fi  fi
369  AC_SUBST(SMLNJ_VERSION)  AC_SUBST(SMLNJ_VERSION)
370    
# Line 150  Line 417 
417  AC_SUBST(INSTALL_SMLNJ_WRAPPER)  AC_SUBST(INSTALL_SMLNJ_WRAPPER)
418    
419  dnl  dnl
420    dnl ******************** C compiler properties ********************
421    dnl
422    
423    dnl
424    dnl run the compiler tests in 64-bit mode
425    dnl
426    save_CFLAGS=$CFLAGS
427    CFLAGS="$CFLAGS $CFLAG_M64"
428    
429    dnl
430    dnl check for gcc builtin atomic operations
431    dnl
432    AC_MSG_CHECKING([for builtin atomic operations])
433    AC_LINK_IFELSE(
434       [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
435       AC_MSG_RESULT(yes)
436       AC_DEFINE(
437        [HAVE_BUILTIN_ATOMIC_OPS], 1,
438        [Define to 1 if gcc compiler provides atomic operations.]),
439       AC_MSG_RESULT(no))
440    
441    AC_C_BIGENDIAN
442    
443    #
444    # determine the sizes of the standard C types
445    AC_CHECK_SIZEOF([int])
446    SIZEOF_C_INT=$ac_cv_sizeof_int
447    AC_CHECK_SIZEOF([long])
448    SIZEOF_C_LONG=$ac_cv_sizeof_long
449    AC_CHECK_SIZEOF([float])
450    SIZEOF_C_FLOAT=$ac_cv_sizeof_float
451    AC_CHECK_SIZEOF([double])
452    SIZEOF_C_DOUBLE=$ac_cv_sizeof_double
453    
454    AC_SUBST(SIZEOF_C_INT)
455    AC_SUBST(SIZEOF_C_LONG)
456    AC_SUBST(SIZEOF_C_FLOAT)
457    AC_SUBST(SIZEOF_C_DOUBLE)
458    
459    dnl
460    dnl restore CFLAGS
461    dnl
462    CFLAGS=$save_CFLAGS
463    
464    dnl
465    dnl ******************** config.h stuff ********************
466    dnl
467    
468    AC_DEFINE_UNQUOTED(DIDEROT_INCLUDE_PATH,["$DIDEROT_SRCDIR/include"], [path for Diderot header files])
469    
470    AH_TOP([
471    /*
472     * COPYRIGHT (c) 2011 Diderot project. (http://diderot-language.cs.uchicago.edu)
473     * All rights reserved.
474     */
475    
476    #ifndef _DIDEROT_CONFIG_H_
477    #define _DIDEROT_CONFIG_H_
478    
479    ])
480    AH_BOTTOM([
481    
482    #ifdef NDEBUG
483    #define STATIC_INLINE   static inline
484    #else
485    #define STATIC_INLINE   static
486    #endif
487    
488    #endif /* !_DIDEROT_CONFIG_H_ */
489    ])
490    
491    dnl
492  dnl ******************** write output ********************  dnl ******************** write output ********************
493  dnl  dnl
494    
# Line 157  Line 496 
496  dnl  dnl
497  dnl ***** Makefiles *****  dnl ***** Makefiles *****
498    Makefile    Makefile
499      doc/Makefile
500      src/clinfo/Makefile
501    src/dnorm/Makefile    src/dnorm/Makefile
502    src/compiler/Makefile    src/compiler/Makefile
503      src/lib/build/Makefile
504      src/lib/build/mk/build.gmk:src/lib/build/mk/build_gmk.in
505    test/MIP/Makefile    test/MIP/Makefile
506    test/probe/Makefile    test/probe/Makefile
507      test/iso2d-polyline/Makefile
508      test/vr-lite-cam/Makefile
509      test/hlic/Makefile
510  dnl  dnl
511  dnl ***** SML source files *****  dnl ***** SML source files *****
512    src/compiler/fields/run-dnorm.sml:src/compiler/fields/run-dnorm_sml.in    src/compiler/nrrd/run-dnorm.sml:src/compiler/nrrd/run-dnorm_sml.in
513      src/compiler/common/paths.sml:src/compiler/common/paths_sml.in
514      src/compiler/common/size-of.sml:src/compiler/common/size-of_sml.in
515  )  )
516    
517    AC_CONFIG_HEADERS(src/include/Diderot/config.h:config/config_h.in)
518    
519  dnl  dnl
520  dnl shell scripts  dnl shell scripts
521  dnl  dnl
522  AC_CONFIG_FILES([  AC_CONFIG_FILES([
523    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in    bin/install-sml-wrapper.sh:config/install-sml-wrapper_sh.in
524  ], [chmod +x bin/install-sml-wrapper.sh])  ], [chmod +x bin/install-sml-wrapper.sh])
525    AC_CONFIG_FILES([
526      src/compiler/gen/file2str/file2str.sh:src/compiler/gen/file2str/file2str_sh.in
527    ], [chmod +x src/compiler/gen/file2str/file2str.sh])
528    AC_CONFIG_FILES([
529      rtest/scripts/run.sh:rtest/scripts/run_sh.in
530    ], [chmod +x rtest/scripts/run.sh])
531    AC_CONFIG_FILES([
532      rtest/scripts/run-one.sh:rtest/scripts/run-one_sh.in
533    ], [chmod +x rtest/scripts/run-one.sh])
534    
535    dnl
536    dnl generate makefiles for runtime library builds
537    dnl
538    dnl usage: MK_BUILD_DIR(<build-dir>, <target-platform>, <options>)
539    dnl
540    AC_DEFUN([MK_BUILD_DIR], [
541        if test ! -d src/lib/build/$1 ; then
542          mkdir src/lib/build/$1
543        fi
544        [sed -e 's,@BUILD_TARGET@,$1,g' \
545          -e 's,@TARGET_PLATFORM@,$2,g' \
546          -e 's,@BUILD_OPTIONS@,$3,g' \
547          src/lib/build/mk/Makefile.in \
548            > src/lib/build/$1/Makefile.in]
549        AC_CONFIG_FILES(src/lib/build/$1/Makefile)
550      ])
551    
552    MK_BUILD_DIR(rt-c-f, c, [float])
553    MK_BUILD_DIR(rt-c-d, c, [double])
554    MK_BUILD_DIR(rt-c-f-debug, c, [float debug])
555    MK_BUILD_DIR(rt-c-d-debug, c, [double debug])
556    MK_BUILD_DIR(rt-c-f-par, parallel, [parallel float])
557    MK_BUILD_DIR(rt-c-d-par, parallel, [parallel double])
558    MK_BUILD_DIR(rt-c-f-par-debug, parallel, [parallel float debug])
559    MK_BUILD_DIR(rt-c-d-par-debug, parallel, [parallel double debug])
560    
561    if test x"$CL_ENABLED" = xtrue ; then
562      MK_BUILD_DIR(rt-cl-f, cl, [float])
563      MK_BUILD_DIR(rt-cl-d, cl, [double])
564      MK_BUILD_DIR(rt-cl-f-debug, cl, [float debug])
565      MK_BUILD_DIR(rt-cl-d-debug, cl, [double debug])
566    fi
567    
568  AC_OUTPUT  AC_OUTPUT

Legend:
Removed from v.436  
changed lines
  Added in v.2111

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