Advertisement
garyp

PSS configure.ac

Jun 1st, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dnl --------------------------------
  2. dnl Initialization macros.
  3. dnl --------------------------------
  4.  
  5.  
  6. #gap as instructed by autoreconf:
  7. AC_CONFIG_MACRO_DIR([m4])
  8.  
  9.  
  10. # The file passed into the following macro must exist or it will fail
  11. AC_INIT(src/matrixlib.h)
  12. # Store the config files in a separate subdirectory
  13. AC_CONFIG_AUX_DIR(linux/config)
  14. # Get the host system information to enable Mac OS X define checking
  15. AC_CANONICAL_HOST
  16. # if we're using autoconf, we assume (for now) that we're on a unix system. I.E., on windows we'll use Visual Studio
  17. AC_DEFINE([ML_OS_UNIX], [], [UNIX OS])
  18. AC_LANG_CPLUSPLUS
  19.  
  20. # check the host information acquired above and #define ML_OS_MACOSX if appropriate
  21. host_is_mac=no
  22. case "$host_os" in
  23.         *darwin*)
  24.             host_is_mac=yes
  25.             AC_DEFINE([ML_OS_MACOSX], [], [Mac OS X])
  26.             LFLAGS="${LFLAGS} -framework Accelerate"
  27.             CXXFLAGS="-falign-loops=16 ${CXXFLAGS}"
  28.         ;;
  29.         *linux*)
  30.             AC_DEFINE([ML_OS_LINUX], [], [Linux OS])
  31.         ;;
  32.         cygwin)
  33.             AC_DEFINE([ML_OS_LINUX], [], [Linux OS])
  34.             AC_DEFINE([ML_OS_CYGWIN], [], [Cygwin OS])
  35.             AC_DEFINE([ML_OS_UNIX], [], [Unix OS])
  36.     ;;
  37.         *)
  38.         ;;
  39. esac
  40.  
  41. AC_MSG_ERROR([Canonical host info  $host_cpu $host_vendor $host_os])
  42.  
  43. CXXFLAGS="-Wall -Wno-deprecated -O3 ${CXXFLAGS}"
  44.  
  45. # create a special configuration header for automake that will contain all preprocessor #defines
  46. AM_CONFIG_HEADER(config.h)
  47. AM_CONFIG_HEADER(src/matrix.h)
  48. # need config.h in one more place (with differnent name)
  49. AC_CONFIG_HEADER(ml_os_defines.h:config.h.in)
  50.  
  51. dnl --------------------------------
  52. dnl Compile time options.
  53. dnl --------------------------------
  54.  
  55. AC_CHECK_HEADER([math.h], , [])
  56.  
  57. AC_ARG_ENABLE([dbg],
  58.     AC_HELP_STRING([--enable-dbg], [Enable debug information in library, default=no]),
  59.     enable_dbg=$enableval, enable_dbg=no)
  60. if test "$enable_dbg" = yes; then
  61.     CXXFLAGS="${CXXFLAGS} -g"
  62. fi
  63.  
  64. AC_ARG_ENABLE([dbgwarn],
  65.     AC_HELP_STRING([--enable-dbgwarn], [Enable debug warnings, default=no]),
  66.     enable_dbgwarn=$enableval, enable_dbgwarn=no)
  67. if test "$enable_dbgwarn" = yes; then
  68.     AC_DEFINE([ML_ERR_WARN], [], [Display debug information for inappropriate matrix usage.])
  69.     CXXFLAGS="${CXXFLAGS} -g -O0"
  70. fi
  71.  
  72. AC_ARG_ENABLE([dbgabrt],
  73.     AC_HELP_STRING([--enable-dbgabrt], [Enable debug SIGABRT, default=no]),
  74.     enable_dbgabrt=$enableval, enable_dbgabrt=no)
  75. if test "$enable_dbgabrt" = yes; then
  76.     AC_DEFINE([ML_ERR_WARN], [], [Display debug information for inappropriate matrix usage.])
  77.     AC_DEFINE([ML_ERR_ABRT], [], [Deliver SIGABRT on inappropriate matrix usage.])
  78.     CXXFLAGS="${CXXFLAGS} -g -O0"
  79. fi
  80.  
  81. AC_ARG_ENABLE([blas],
  82.     AC_HELP_STRING([--enable-blas], [Enable use of a local BLAS library, if found, default=no]),
  83.     enable_blas=$enableval, enable_blas=no)
  84. if test "$enable_blas" = yes; then
  85.     AC_DEFINE([ML_USE_BLAS], [], [Use the BLAS if detected.])
  86. fi
  87.  
  88. AC_ARG_ENABLE([lapack],
  89.     AC_HELP_STRING([--enable-lapack], [Enable use of a local LAPACK library, if found; implies --enable-blas=yes, default=no]),
  90.     enable_lapack=$enableval, enable_lapack=no)
  91. if test "$enable_lapack" = yes; then
  92.     AC_DEFINE([ML_USE_BLAS], [], [Use the BLAS if detected.])
  93.     AC_DEFINE([ML_USE_LAPACK], [], [Use the LAPACK if detected.])
  94. fi
  95.  
  96. AC_ARG_ENABLE([rowmajor],
  97.     AC_HELP_STRING([--enable-rowmajor], [Cause the library to use a row-major storage format rather than column major, default=no]),
  98.     enable_rowmajor=$enableval, enable_rowmajor=no)
  99. if test "$enable_rowmajor" = no; then
  100.     AC_DEFINE([ML_COLUMN_MAJOR], [], [Column major storage format.])
  101. fi
  102.  
  103. AC_ARG_ENABLE([demo],
  104.     AC_HELP_STRING([--enable-demo], [Cause the library to use a row-major storage format rather than column major, default=no]),
  105.     enable_demo=$enableval, enable_demo=no)
  106. if test "$enable_rowmajor" = yes; then
  107.     AC_DEFINE([ML_DEMO], [], [Demo version.])
  108. fi
  109.  
  110.  
  111. dnl -----------------------------------------------
  112. dnl Package name and version number (user defined)
  113. dnl -----------------------------------------------
  114.  
  115. #release versioning
  116. ML_MAJOR_VERSION=3
  117. ML_MINOR_VERSION=0
  118. ML_MICRO_VERSION=0
  119.  
  120. # the base form of the library name (minus "lib", suffix (dylib/la) and version info
  121. ML_LIBRARY_NAME=pssmatrix
  122. ML_RELEASE=$ML_MAJOR_VERSION.$ML_MINOR_VERSION.$ML_MICRO_VERSION
  123. AC_SUBST(ML_LIBRARY_NAME)
  124. AC_SUBST(ML_RELEASE)
  125.  
  126. AC_DEFINE_UNQUOTED([ML_VERSION_STRING], "$ML_LIBRARY_NAME $ML_RELEASE", [Version information])
  127. AC_DEFINE_UNQUOTED([ML_DATE_STRING], "$(date)", [Build date])
  128.  
  129. AM_INIT_AUTOMAKE($ML_LIBRARY_NAME, $ML_RELEASE, no-define)
  130.  
  131. dnl -----------------------------------------------
  132. dnl Checks for programs.
  133. dnl -----------------------------------------------
  134.  
  135. # make sure we have a c compiler (generally gcc)
  136. AC_PROG_CXX
  137. AC_PROG_CC
  138. # make sure we have libtool
  139. #AC_DISABLE_STATIC
  140. AM_PROG_LIBTOOL
  141.  
  142. dnl -----------------------------------------------
  143. dnl Checks for libraries.
  144. dnl -----------------------------------------------
  145.  
  146. AC_CHECK_LIB([c], [fopen])
  147.  
  148. # make sure the standard headers are present
  149. AC_HEADER_STDC
  150. # we also need these headers
  151. AC_CHECK_HEADERS([stdlib.h string.h sys/time.h math.h ctype.h assert.h], , [AC_MSG_ERROR([Unable to locate required header.])])
  152.  
  153. dnl -----------------------------------------------
  154. dnl Checks for typedefs, structures, and compiler characteristics.
  155. dnl -----------------------------------------------
  156.  
  157. AC_HEADER_STDBOOL
  158. AC_C_CONST
  159. AC_C_INLINE
  160. AC_TYPE_MODE_T
  161. AC_TYPE_PID_T
  162. AC_TYPE_SIZE_T
  163. AC_HEADER_TIME
  164. AC_STRUCT_TM
  165.  
  166. dnl -----------------------------------------------
  167. dnl Checks for library functions.
  168. dnl -----------------------------------------------
  169.  
  170. AC_FUNC_MALLOC
  171. AC_FUNC_REALLOC
  172. AC_CHECK_FUNCS([memset sqrt])
  173.  
  174. dnl -----------------------------------------------
  175. dnl Generates Makefile's, configuration files and scripts
  176. dnl -----------------------------------------------
  177.  
  178. AC_OUTPUT(Makefile \
  179.          src/Makefile
  180. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement