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) 2012 The Diderot Project |
dnl COPYRIGHT (c) 2014 The Diderot Project |
4 |
dnl All rights reserved. |
dnl All rights reserved. |
5 |
dnl |
dnl |
6 |
|
|
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) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)]]) |
AC_COPYRIGHT([[COPYRIGHT (c) 2014 The Diderot Project (http://diderot-language.cs.uchicago.edu)]]) |
11 |
AC_CONFIG_SRCDIR(src/dnorm/dnorm.c) |
AC_CONFIG_SRCDIR(src/compiler/driver/main.sml) |
12 |
AC_CONFIG_AUX_DIR(config) |
AC_CONFIG_AUX_DIR(config) |
13 |
AC_CONFIG_MACRO_DIR(config) |
AC_CONFIG_MACRO_DIR(config) |
14 |
|
|
47 |
AC_MSG_ERROR([Diderot requires c99 support]) |
AC_MSG_ERROR([Diderot requires c99 support]) |
48 |
fi |
fi |
49 |
|
|
50 |
|
AC_ARG_ENABLE([32-bit], |
51 |
|
AC_HELP_STRING([--enable-32-bit], [configure Diderot to produce 32-bit executables]), |
52 |
|
[CFLAG_MXX="-m32"], |
53 |
|
[CFLAG_MXX="-m64"]) |
54 |
|
|
55 |
dnl extra C compiler options |
dnl extra C compiler options |
56 |
dnl |
dnl |
57 |
CFLAGS="" |
CFLAGS="" |
|
CFLAG_M64="-m64" |
|
58 |
CFLAGS_BASE="-Wformat -Wreturn-type -Wuninitialized" |
CFLAGS_BASE="-Wformat -Wreturn-type -Wuninitialized" |
59 |
AC_SUBST(CFLAG_M64) |
AC_SUBST(CFLAG_MXX) |
60 |
AC_SUBST(CFLAGS_BASE) |
AC_SUBST(CFLAGS_BASE) |
61 |
|
|
62 |
dnl |
dnl |
69 |
dnl |
dnl |
70 |
ACX_PTHREAD |
ACX_PTHREAD |
71 |
|
|
|
dnl check for doxygen |
|
|
dnl |
|
|
AC_ARG_WITH([doxygen], |
|
|
[AS_HELP_STRING([--with-doxygen=PATH], [specify location of doxygen executable])], |
|
|
[DOXYGEN=$with_doxygen], |
|
|
[DOXYGEN=none]) |
|
|
if test x$DOXYGEN = xnone ; then |
|
|
# see if we can find doxygen in the user's path |
|
|
AC_PATH_PROG(DOXYGEN, [doxygen], [none]) |
|
|
fi |
|
|
if test x$with_doxygen = xyes -o x$with_doxygen = xno ; then |
|
|
AC_MSG_ERROR([--with-doxygen option must specify directory argument]) |
|
|
elif test x$DOXYGEN != xnone -a ! -x $DOXYGEN ; then |
|
|
AC_MSG_ERROR([doxygen not found at $DOXYGEN]) |
|
|
elif test x$DOXYGEN != xnone ; then |
|
|
dnl |
|
|
dnl verify that $DOXYGEN is an absolute path |
|
|
dnl |
|
|
case $DOXYGEN in |
|
|
/*) ;; |
|
|
*) AC_MSG_ERROR([--with-doxygen path must be absolute]) ;; |
|
|
esac |
|
|
fi |
|
|
if test $DOXYGEN = xnone ; then |
|
|
DOXYGEN=: |
|
|
fi |
|
|
AC_SUBST(DOXYGEN) |
|
|
|
|
72 |
dnl |
dnl |
73 |
dnl Look for NVIDIA's nvcc compiler |
dnl Look for NVIDIA's nvcc compiler |
74 |
dnl |
dnl |
104 |
else |
else |
105 |
CL_ENABLED=true |
CL_ENABLED=true |
106 |
CPPFLAGS_CL="" |
CPPFLAGS_CL="" |
107 |
AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h], [HAVE_CL_H="yes"; break], [HAVE_CL_H="no"]) |
CL_HEADER="" |
108 |
|
AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h], [HAVE_CL_H="yes"; CL_HEADER="$ac_header"; break], [HAVE_CL_H="no"]) |
109 |
if test x"$HAVE_CL_H" = xno ; then |
if test x"$HAVE_CL_H" = xno ; then |
110 |
# check for AMD's SDK |
# check for AMD's SDK |
111 |
AC_MSG_CHECKING([for cl.h in AMD's SDK]) |
AC_MSG_CHECKING([for cl.h in AMD's SDK]) |
112 |
if test -d /opt/AMDAPP/include/CL ; then |
if test -d /opt/AMDAPP/include/CL ; then |
113 |
HAVE_CL_H="yes" |
HAVE_CL_H="yes" |
114 |
|
CL_HEADER="/opt/AMDAPP/include/CL/cl.h" |
115 |
AC_DEFINE([HAVE_CL_CL_H]) |
AC_DEFINE([HAVE_CL_CL_H]) |
116 |
CPPFLAGS_CL="-I/opt/AMDAPP/include" |
CPPFLAGS_CL="-I/opt/AMDAPP/include" |
117 |
fi |
fi |
118 |
AC_MSG_RESULT([$HAVE_CL_H]) |
AC_MSG_RESULT([$HAVE_CL_H]) |
119 |
fi |
fi |
120 |
if test x"$HAVE_CL_H" = xno ; then |
if test x"$HAVE_CL_H" = xno ; then |
121 |
|
# check for NVIDIA's SDK |
122 |
|
AC_MSG_CHECKING([for NVIDIA's SDK cl.h]) |
123 |
|
if test -d /usr/local/cuda/include/CL ; then |
124 |
|
HAVE_CL_H="yes" |
125 |
|
CL_HEADER="/usr/local/cuda/include/CL/cl.h" |
126 |
|
AC_DEFINE([HAVE_CL_CL_H]) |
127 |
|
CPPFLAGS_CL="-I/usr/local/cuda/include" |
128 |
|
fi |
129 |
|
AC_MSG_RESULT([$HAVE_CL_H]) |
130 |
|
fi |
131 |
|
if test x"$HAVE_CL_H" = xno ; then |
132 |
AC_MSG_WARN([no cl.h found]) |
AC_MSG_WARN([no cl.h found]) |
133 |
CL_ENABLED=false |
CL_ENABLED=false |
134 |
CL_VERSION=0 |
CL_VERSION=0 |
135 |
|
SIZEOF_CL_INT=0 |
136 |
|
SIZEOF_CL_LONG=0 |
137 |
|
SIZEOF_CL_FLOAT=0 |
138 |
|
SIZEOF_CL_DOUBLE=0 |
139 |
else |
else |
140 |
# check the cl.h header for which version of OpenCL is supported |
# check the cl.h header for which version of OpenCL is supported |
141 |
AC_LANG([C]) |
AC_LANG([C]) |
150 |
# else |
# else |
151 |
# error no cl.h |
# error no cl.h |
152 |
# endif]], |
# endif]], |
153 |
[[#if defined(CL_VERSION_1_1) |
[[#if defined(CL_VERSION_1_2) |
154 |
|
printf("12000\n"); |
155 |
|
#elif defined(CL_VERSION_1_1) |
156 |
printf("11000\n"); |
printf("11000\n"); |
157 |
#elif defined(CL_VERSION_1_0) |
#elif defined(CL_VERSION_1_0) |
158 |
printf("10000\n"); |
printf("10000\n"); |
166 |
dnl the specification specifies the behavior, but it was unspecified in 1.0. |
dnl the specification specifies the behavior, but it was unspecified in 1.0. |
167 |
dnl |
dnl |
168 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
169 |
# ifdef HAVE_CL_CL_H |
#include "$CL_HEADER" |
170 |
# include <CL/cl.h> |
]], |
|
# elif defined(HAVE_OPENCL_CL_H) |
|
|
# include <OpenCL/cl.h> |
|
|
# else |
|
|
# error no cl.h |
|
|
# endif]], |
|
171 |
[[cl_float4 x; x[0] = 0.0;]])], |
[[cl_float4 x; x[0] = 0.0;]])], |
172 |
[AC_DEFINE([CL_HOST_VECTORS_ARE_ARRAYS],[1],[host vector types are arrays])], |
[AC_DEFINE([CL_HOST_VECTORS_ARE_ARRAYS],[1],[host vector types are arrays])], |
173 |
dnl |
dnl |
174 |
dnl not arrays, so try the OpenCL 1.1 structure representation |
dnl not arrays, so try the OpenCL 1.1 structure representation |
175 |
dnl |
dnl |
176 |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
177 |
# ifdef HAVE_CL_CL_H |
#include "$CL_HEADER" |
178 |
# include <CL/cl.h> |
]], |
|
# elif defined(HAVE_OPENCL_CL_H) |
|
|
# include <OpenCL/cl.h> |
|
|
# else |
|
|
# error no cl.h |
|
|
# endif]], |
|
179 |
[[cl_float4 x; x.s[0] = 0.0;]])], |
[[cl_float4 x; x.s[0] = 0.0;]])], |
180 |
[AC_DEFINE([CL_HOST_VECTORS_ARE_STRUCTS],[1],[host vector types are structs])], |
[AC_DEFINE([CL_HOST_VECTORS_ARE_STRUCTS],[1],[host vector types are structs])], |
181 |
[AC_MSG_ERROR([unable to figure out host types for OpenCL vectors])])]) |
[AC_MSG_ERROR([unable to figure out host types for OpenCL vectors])])]) |
184 |
# substitutions |
# substitutions |
185 |
AC_SUBST(LIBS_CL) |
AC_SUBST(LIBS_CL) |
186 |
AC_SUBST(CPPFLAGS_CL) |
AC_SUBST(CPPFLAGS_CL) |
187 |
|
# |
188 |
|
# determine the sizes of the host-side OpenCL types |
189 |
|
AC_CHECK_SIZEOF([cl_int], [], [#include "$CL_HEADER"]) |
190 |
|
SIZEOF_CL_INT=$ac_cv_sizeof_cl_int |
191 |
|
AC_CHECK_SIZEOF([cl_long], [], [#include "$CL_HEADER"]) |
192 |
|
SIZEOF_CL_LONG=$ac_cv_sizeof_cl_long |
193 |
|
AC_CHECK_SIZEOF([cl_float], [], [#include "$CL_HEADER"]) |
194 |
|
SIZEOF_CL_FLOAT=$ac_cv_sizeof_cl_float |
195 |
|
AC_CHECK_SIZEOF([cl_double], [], [#include "$CL_HEADER"]) |
196 |
|
SIZEOF_CL_DOUBLE=$ac_cv_sizeof_cl_double |
197 |
fi |
fi |
198 |
fi |
fi |
199 |
AC_SUBST(CL_ENABLED) |
AC_SUBST(CL_ENABLED) |
200 |
AC_SUBST(CL_VERSION) |
AC_SUBST(CL_VERSION) |
201 |
|
|
202 |
|
AC_SUBST(SIZEOF_CL_INT) |
203 |
|
AC_SUBST(SIZEOF_CL_LONG) |
204 |
|
AC_SUBST(SIZEOF_CL_FLOAT) |
205 |
|
AC_SUBST(SIZEOF_CL_DOUBLE) |
206 |
|
|
207 |
dnl |
dnl |
208 |
dnl check for various library routines etc. |
dnl check for various library routines etc. |
209 |
dnl |
dnl |
312 |
AC_SUBST(LIBM) |
AC_SUBST(LIBM) |
313 |
|
|
314 |
dnl |
dnl |
315 |
dnl get the path to the TEEM installation |
dnl get the path to the TEEM installation. We need this to build the Diderot |
316 |
|
dnl runtime code and we use the path when searching for teem in the Diderot |
317 |
|
dnl compiler. |
318 |
dnl |
dnl |
319 |
AC_ARG_WITH(teem, |
AC_ARG_WITH(teem, |
320 |
AC_HELP_STRING([--with-teem=<path>], [specify path to teem installation]), |
AC_HELP_STRING([--with-teem=<path>], [specify path to teem installation]), |
331 |
TEEM_DIR=$ac_cv_use_teem |
TEEM_DIR=$ac_cv_use_teem |
332 |
# check that TEEM_DIR actually points to something that looks like teem |
# check that TEEM_DIR actually points to something that looks like teem |
333 |
if test -f $TEEM_DIR/include/teem/nrrd.h ; then |
if test -f $TEEM_DIR/include/teem/nrrd.h ; then |
334 |
AC_MSG_RESULT([ okay]) |
AC_MSG_RESULT([yes]) |
335 |
else |
else |
336 |
TEEM_DIR=none |
TEEM_DIR=none |
337 |
AC_MSG_RESULT([ invalid]) |
AC_MSG_RESULT([no]) |
338 |
fi |
fi |
339 |
else |
else |
340 |
TEEM_DIR=none |
TEEM_DIR=none |
341 |
AC_MSG_RESULT([ invalid]) |
AC_MSG_RESULT([no]) |
342 |
fi |
fi |
343 |
fi |
fi |
344 |
if test x"$TEEM_DIR" = xnone ; then |
if test x"$TEEM_DIR" = xnone ; then |
345 |
AC_MSG_ERROR([unable to find teem]) |
AC_MSG_ERROR([unable to find teem; use --with-teem option to specify location]) |
346 |
|
fi |
347 |
|
dnl |
348 |
|
dnl check that unu supports the dnorm command |
349 |
|
dnl |
350 |
|
if test x"$TEEM_DIR" != xnone ; then |
351 |
|
AC_MSG_CHECKING([that \"unu dnorm\" works]) |
352 |
|
if test -x $TEEM_DIR/bin/unu ; then |
353 |
|
$TEEM_DIR/bin/unu dnorm > /dev/null 2> /dev/null |
354 |
|
if test $? -eq 0 ; then |
355 |
|
AC_MSG_RESULT([yes]) |
356 |
|
else |
357 |
|
AC_MSG_ERROR([\"unu dnorm\" is not supported; please update your teem installation]) |
358 |
|
fi |
359 |
|
else |
360 |
|
AC_MSG_ERROR([unable to find unu executable in $TEEM_DIR/bin"]) |
361 |
|
fi |
362 |
fi |
fi |
363 |
AC_SUBST(TEEM_DIR) |
AC_SUBST(TEEM_DIR) |
364 |
|
|
369 |
dnl |
dnl |
370 |
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])]) |
371 |
if test $SMLNJ_MAJOR_VERSION -lt 110 \ |
if test $SMLNJ_MAJOR_VERSION -lt 110 \ |
372 |
-o $SMLNJ_MINOR_VERSION -lt 73 |
-o $SMLNJ_MINOR_VERSION -lt 77 |
373 |
then |
then |
374 |
AC_MSG_ERROR([installation requires SML/NJ version 110.73+]) |
AC_MSG_ERROR([installation requires SML/NJ version 110.77+ (available from smlnj.org)]) |
375 |
fi |
fi |
376 |
AC_SUBST(SMLNJ_VERSION) |
AC_SUBST(SMLNJ_VERSION) |
377 |
|
|
402 |
fi |
fi |
403 |
AC_SUBST(ML_BUILD) |
AC_SUBST(ML_BUILD) |
404 |
|
|
405 |
|
dnl ******************** Documentation tools ******************** |
406 |
|
|
407 |
|
dnl check for doxygen |
408 |
|
dnl |
409 |
|
AC_ARG_WITH([doxygen], |
410 |
|
[AS_HELP_STRING([--with-doxygen=PATH], [specify location of doxygen executable])], |
411 |
|
[DOXYGEN=$with_doxygen], |
412 |
|
[DOXYGEN=none]) |
413 |
|
if test x$DOXYGEN = xnone ; then |
414 |
|
# see if we can find doxygen in the user's path |
415 |
|
AC_PATH_PROG(DOXYGEN, [doxygen], [none]) |
416 |
|
fi |
417 |
|
if test x$with_doxygen = xyes -o x$with_doxygen = xno ; then |
418 |
|
AC_MSG_ERROR([--with-doxygen option must specify directory argument]) |
419 |
|
elif test x$DOXYGEN != xnone -a ! -x $DOXYGEN ; then |
420 |
|
AC_MSG_ERROR([doxygen not found at $DOXYGEN]) |
421 |
|
elif test x$DOXYGEN != xnone ; then |
422 |
|
dnl |
423 |
|
dnl verify that $DOXYGEN is an absolute path |
424 |
|
dnl |
425 |
|
case $DOXYGEN in |
426 |
|
/*) ;; |
427 |
|
*) AC_MSG_ERROR([--with-doxygen path must be absolute]) ;; |
428 |
|
esac |
429 |
|
fi |
430 |
|
if test $DOXYGEN = xnone ; then |
431 |
|
DOXYGEN=: |
432 |
|
fi |
433 |
|
AC_SUBST(DOXYGEN) |
434 |
|
|
435 |
|
dnl check for asciidoc and related tools |
436 |
|
dnl |
437 |
|
AC_PATH_PROGS([ASCIIDOC], [asciidoc], [none]) |
438 |
|
AC_PATH_PROGS([A2X], [a2x], [none]) |
439 |
|
AC_PATH_PROGS([HIGHLIGHTER], [pygmentize], [none]) |
440 |
|
AC_PATH_PROGS([DBLATEX], [dblatex], [none]) |
441 |
|
|
442 |
|
dnl |
443 |
|
dnl get the path to the asciidoc cofiguration files |
444 |
|
dnl |
445 |
|
if test x"$ASCIIDOC" != xnone ; then |
446 |
|
AC_MSG_CHECKING([path to asciidoc configuration files]) |
447 |
|
ASCIIDOC_CONF_DIR=`$ASCIIDOC -v /dev/null 2>&1 | head -n 1 | sed 's|.*reading: \(.*\)/asciidoc.conf|\1|'` |
448 |
|
AC_MSG_RESULT([$ASCIIDOC_CONF_DIR]) |
449 |
|
fi |
450 |
|
AC_SUBST(ASCIIDOC) |
451 |
|
AC_SUBST(A2X) |
452 |
|
AC_SUBST(ASCIIDOC_CONF_DIR) |
453 |
|
AC_SUBST(HIGHLIGHTER) |
454 |
|
AC_SUBST(DBLATEX) |
455 |
|
|
456 |
|
|
457 |
dnl ******************** Paths ******************** |
dnl ******************** Paths ******************** |
458 |
|
|
459 |
DIDEROT_ROOT=`pwd` |
DIDEROT_ROOT=`pwd` |
483 |
dnl run the compiler tests in 64-bit mode |
dnl run the compiler tests in 64-bit mode |
484 |
dnl |
dnl |
485 |
save_CFLAGS=$CFLAGS |
save_CFLAGS=$CFLAGS |
486 |
CFLAGS="$CFLAGS $CFLAG_M64" |
CFLAGS="$CFLAGS $CFLAG_MXX" |
487 |
|
|
488 |
dnl |
dnl |
489 |
dnl check for gcc builtin atomic operations |
dnl check for gcc builtin atomic operations |
499 |
|
|
500 |
AC_C_BIGENDIAN |
AC_C_BIGENDIAN |
501 |
|
|
502 |
|
# |
503 |
|
# determine the sizes of the standard C types |
504 |
|
AC_CHECK_SIZEOF([int]) |
505 |
|
SIZEOF_C_INT=$ac_cv_sizeof_int |
506 |
|
AC_CHECK_SIZEOF([long]) |
507 |
|
SIZEOF_C_LONG=$ac_cv_sizeof_long |
508 |
|
AC_CHECK_SIZEOF([float]) |
509 |
|
SIZEOF_C_FLOAT=$ac_cv_sizeof_float |
510 |
|
AC_CHECK_SIZEOF([double]) |
511 |
|
SIZEOF_C_DOUBLE=$ac_cv_sizeof_double |
512 |
|
|
513 |
|
AC_SUBST(SIZEOF_C_INT) |
514 |
|
AC_SUBST(SIZEOF_C_LONG) |
515 |
|
AC_SUBST(SIZEOF_C_FLOAT) |
516 |
|
AC_SUBST(SIZEOF_C_DOUBLE) |
517 |
|
|
518 |
dnl |
dnl |
519 |
dnl restore CFLAGS |
dnl restore CFLAGS |
520 |
dnl |
dnl |
528 |
|
|
529 |
AH_TOP([ |
AH_TOP([ |
530 |
/* |
/* |
531 |
* COPYRIGHT (c) 2011 Diderot project. (http://diderot-language.cs.uchicago.edu) |
* COPYRIGHT (c) 2014 Diderot project. (http://diderot-language.cs.uchicago.edu) |
532 |
* All rights reserved. |
* All rights reserved. |
533 |
*/ |
*/ |
534 |
|
|
538 |
]) |
]) |
539 |
AH_BOTTOM([ |
AH_BOTTOM([ |
540 |
|
|
541 |
|
#ifdef NDEBUG |
542 |
|
#define STATIC_INLINE static inline |
543 |
|
#else |
544 |
|
#define STATIC_INLINE static |
545 |
|
#endif |
546 |
|
|
547 |
#endif /* !_DIDEROT_CONFIG_H_ */ |
#endif /* !_DIDEROT_CONFIG_H_ */ |
548 |
]) |
]) |
549 |
|
|
556 |
dnl ***** Makefiles ***** |
dnl ***** Makefiles ***** |
557 |
Makefile |
Makefile |
558 |
doc/Makefile |
doc/Makefile |
559 |
|
doc/man/Makefile |
560 |
src/clinfo/Makefile |
src/clinfo/Makefile |
|
src/dnorm/Makefile |
|
561 |
src/compiler/Makefile |
src/compiler/Makefile |
562 |
src/lib/build/Makefile |
src/lib/build/Makefile |
563 |
src/lib/build/mk/build.gmk:src/lib/build/mk/build_gmk.in |
src/lib/build/mk/build.gmk:src/lib/build/mk/build_gmk.in |
568 |
test/hlic/Makefile |
test/hlic/Makefile |
569 |
dnl |
dnl |
570 |
dnl ***** SML source files ***** |
dnl ***** SML source files ***** |
571 |
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 |
572 |
src/compiler/common/paths.sml:src/compiler/common/paths_sml.in |
src/compiler/common/paths.sml:src/compiler/common/paths_sml.in |
573 |
|
src/compiler/common/size-of.sml:src/compiler/common/size-of_sml.in |
574 |
) |
) |
575 |
|
|
576 |
AC_CONFIG_HEADERS(src/include/Diderot/config.h:config/config_h.in) |
AC_CONFIG_HEADERS(src/include/Diderot/config.h:config/config_h.in) |