configure.ac 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. AC_PREREQ([2.61])
  2. AC_INIT([PvFMM],[1.0.0],[dmalhotra@ices.utexas.edu])
  3. AC_CONFIG_MACRO_DIR([m4])
  4. AC_CONFIG_AUX_DIR([build-aux])
  5. AM_INIT_AUTOMAKE([-Wall no-define])
  6. AC_CONFIG_SRCDIR([src/tree_node.cpp])
  7. AM_CONFIG_HEADER([config.h]) # prep config.h from config.h.in
  8. AX_PREFIX_CONFIG_H([include/pvfmm_config.h]) # prep include/pvfmm_config.h from it..
  9. # Set language to C++
  10. AC_LANG([C++])
  11. # Checks for programs.
  12. AX_PROG_CXX_MPI(,[CXX=$MPICXX],[])
  13. AX_MPI([CXX=$MPICXX; CC=$MPICXX; CFLAGS=$CXXFLAGS],
  14. [AC_MSG_ERROR([Cannot find mpicxx. Make sure that MPI is installed and location of compiler is in PATH.])])
  15. AX_COMPILER_VENDOR
  16. AC_PROG_AWK
  17. AC_PROG_F77
  18. AC_PROG_INSTALL
  19. AC_PROG_MKDIR_P
  20. AC_PROG_LN_S
  21. AC_PROG_MAKE_SET
  22. AC_PROG_RANLIB
  23. #AM_PROG_AR
  24. # Check for CUDA
  25. AX_CHECK_CUDA
  26. # Checks for documentation build tools
  27. AC_CHECK_PROG([doxygen_ok], [doxygen], [yes], [no])
  28. AC_CHECK_PROG([pdflatex_ok], [pdflatex], [yes], [no])
  29. AC_CHECK_PROG([latex_ok], [latex], [yes], [no])
  30. AC_CHECK_PROG([dvips_ok], [dvips], [yes], [no])
  31. AC_CHECK_PROG([gs_ok], [gs], [yes], [no])
  32. if test "x$enable_html_doc" != xno; then
  33. test "x$doxygen_ok" != xyes && enable_html_doc=no
  34. test "x$latex_ok" != xyes && enable_html_doc=no
  35. test "x$dvips_ok" != xyes && enable_html_doc=no
  36. test "x$gs_ok" != xyes && enable_html_doc=no
  37. AC_PATH_PROG([PERL], [perl], [])
  38. fi
  39. AM_CONDITIONAL([LATEX_OK], [test "x$latex_ok" = xyes])
  40. AM_CONDITIONAL([PDFLATEX_OK], [test "x$pdflatex_ok" = xyes])
  41. AM_CONDITIONAL([HTML_DOC], [test "x$enable_html_doc" = xyes])
  42. AM_CONDITIONAL([DOXYGEN_OK], [test "x$doxygen_ok" = xyes])
  43. DX_HTML_FEATURE(ON)
  44. DX_CHM_FEATURE(OFF)
  45. DX_CHI_FEATURE(OFF)
  46. DX_MAN_FEATURE(OFF)
  47. DX_RTF_FEATURE(OFF)
  48. DX_XML_FEATURE(OFF)
  49. DX_PDF_FEATURE(OFF)
  50. DX_PS_FEATURE(OFF)
  51. DX_INIT_DOXYGEN($PACKAGE_NAME, Doxyfile, doc/doxygen)
  52. CHECK_QUAD_PRECISION
  53. # Check for math libs
  54. AC_CHECK_LIB([m],[cos])
  55. AC_CHECK_LIB([imf],[cos])
  56. # Check for X11
  57. AC_PATH_X
  58. if test "$no_x" = yes; then
  59. AC_MSG_WARN([Cannot find X Window System include files and libraries.
  60. Please specify their location using --x-includes=dir and --x-libraries=dir])
  61. else
  62. if test "$x_includes" != ""; then
  63. X_INCLUDES="-I$x_includes"
  64. fi
  65. if test "$x_libraries" != ""; then
  66. X_LIBS="-L$x_libraries"
  67. fi
  68. X_LIBS="$X_LIBS -lX11"
  69. AC_SUBST(X_INCLUDES)
  70. AC_SUBST(X_LIBS)
  71. fi
  72. # Check for OpenMP
  73. AC_LANG_WERROR([on])
  74. if $USE_OPENMP; then
  75. AC_ARG_WITH(openmp_flag,
  76. [AS_HELP_STRING([--with-openmp-flag="FLAGS"],
  77. [FLAGS to enable OpenMP])],
  78. [OPENMP_FLAG="-$withval"],
  79. [OPENMP_FLAG=""])
  80. # Check if OpenMP flag is already specified.
  81. CHECK_OPENMP($OPENMP_FLAG)
  82. # Check for all common OpenMP flags.
  83. if test "$cv_openmp" = no; then
  84. case "$ax_cv_cxx_compiler_vendor" in
  85. gnu)
  86. CHECK_OPENMP(-fopenmp)
  87. ;;
  88. intel)
  89. CHECK_OPENMP(-openmp)
  90. ;;
  91. pgi)
  92. CHECK_OPENMP(-mp)
  93. ;;
  94. msdosmsvc)
  95. ## FIXME is this the right flag for MSVC?
  96. CHECK_OPENMP(-openmp)
  97. ;;
  98. ## Add other compilers supporting OpenMP here
  99. esac
  100. fi
  101. # Error: OpenMP not available.
  102. if test "$cv_openmp" = no; then
  103. AC_MSG_ERROR([Don't know how to enable OpenMP.
  104. Please specify the OpenMP flag using: --with-openmp-flag=<flag>.]);
  105. fi
  106. fi
  107. AC_LANG_WERROR([off])
  108. # Check for Intel Xeon Phi
  109. CHECK_INTEL_OFFLOAD
  110. # Check for FFTW
  111. AC_CHECK_FFTW
  112. AC_CHECK_FFTWF
  113. #Check for BLAS LAPACK
  114. #AM_CONDITIONAL(BLAS_EQ_MKL, test "$BLAS" = "MKL")
  115. #AM_CONDITIONAL(BLAS_EQ_GSL, test "$BLAS" = "GSL")
  116. #if (test -r $PETSC_DIR/$PETSC_ARCH/conf/petscvariables) ; then
  117. # PETSC_BLASLAPACK_LIB=`grep "BLASLAPACK_LIB" $PETSC_DIR/$PETSC_ARCH/conf/petscvariables | sed -e 's/.*BLASLAPACK_LIB = //'`
  118. # if test "x$PETSC_BLASLAPACK_LIB" != x ; then
  119. # if test "x$with_blas" != "x" -a "$with_blas" != "$PETSC_BLASLAPACK_LIB" ; then
  120. # AC_MSG_WARN([BLAS flags specified by --with-blas appear to disagree with PETSc BLAS/LAPACK flags; using PETSc settings])
  121. # fi
  122. # if test "x$with_lapack" != "x" -a "$with_lapack" != "$PETSC_BLASLAPACK_LIB" ; then
  123. # AC_MSG_WARN([LAPACK flags specified by --with-lapack appear to disagree with PETSc BLAS/LAPACK flags; using PETSc settings])
  124. # fi
  125. # echo "using PETSc BLAS/LAPACK library flags: $PETSC_BLASLAPACK_LIB"
  126. # with_blas="$PETSC_BLASLAPACK_LIB"
  127. # with_lapack=""
  128. # fi
  129. # PETSC_BLASLAPACK_INCLUDE=`grep "BLASLAPACK_INCLUDE" $PETSC_DIR/$PETSC_ARCH/conf/petscvariables | sed -e 's/.*BLASLAPACK_INCLUDE = //'`
  130. # if test "x$PETSC_BLASLAPACK_INCLUDE" != x ; then
  131. # CPPFLAGS="${PETSC_BLASLAPACK_INCLUDE} $CPPFLAGS"
  132. # fi
  133. #fi
  134. AX_BLAS(acx_blas_ok=yes, AC_MSG_ERROR([Cannot find BLAS library.
  135. Please specify the location of the library using: --with-blas=LIB]))
  136. AX_LAPACK(acx_lapack_ok=yes, AC_MSG_ERROR([Cannot find LAPACK library.
  137. Please specify the location of the library using: --with-lapack=LIB]))
  138. AC_SUBST(LAPACK_LIBS)
  139. AC_SUBST(BLAS_LIBS)
  140. AC_SUBST(FLIBS)
  141. # Checks for header files.
  142. AC_CHECK_HEADERS([stdint.h stdlib.h stddef.h])
  143. # Checks for typedefs, structures, and compiler characteristics.
  144. AC_HEADER_STDBOOL
  145. AC_HEADER_STAT
  146. AC_C_INLINE
  147. AC_TYPE_INT32_T
  148. AC_TYPE_UINT16_T
  149. AC_TYPE_UINT8_T
  150. AC_TYPE_SIZE_T
  151. # Checks for library functions.
  152. AC_FUNC_ERROR_AT_LINE
  153. AC_FUNC_MALLOC
  154. AC_FUNC_STRTOD
  155. AC_CHECK_FUNCS([floor memset pow sqrt strtol strtoul])
  156. # Path for precomputed data files.
  157. AC_ARG_WITH(precomp-dir,
  158. [AS_HELP_STRING([--with-precomp-dir=DIR], [set directory for precomputed data files to DIR])],
  159. [PRECOMP_DIR="$withval"; AX_NORMALIZE_PATH([PRECOMP_DIR], ["/"]) ])
  160. AC_DEFINE_UNQUOTED(PRECOMP_DATA_PATH,"$PRECOMP_DIR",[Path for precomputed data files.])
  161. #AC_CONFIG_FILES([Makefile doc/doc/Makefile])
  162. AC_CONFIG_FILES([Makefile
  163. MakeVariables
  164. doc/doc/Makefile])
  165. AC_OUTPUT
  166. echo "
  167. ------------------------------------------------------------------------------
  168. $PACKAGE-$VERSION library configuration:
  169. ------------------------------------------------------------------------------
  170. External libs:
  171. - BLAS ........... : ${acx_blas_ok}
  172. - LAPACK ......... : ${acx_lapack_ok}
  173. - FFTW ........... : ${acx_fftw_ok}
  174. Compiler/linker flags/libs/defs:
  175. - MPICXX ......... : ${MPICXX}
  176. - CXXFLAGS ....... : ${CXXFLAGS}
  177. - LDFLAGS ........ : ${LDFLAGS}
  178. - LIBS ........... : ${LIBS}
  179. - BLAS ......... : ${BLAS_LIBS}
  180. - FFTW ......... : ${FFTW_LIB} ${FFTWF_LIB}
  181. - X11 .......... : ${X_LIBS}
  182. Documentation tools:
  183. - doxygen ........ : ${doxygen_ok}
  184. - latex .......... : ${latex_ok}
  185. - dvips .......... : ${dvips_ok}
  186. - ghostscript .... : ${gs_ok}
  187. "