[8] | 1 | # -*- Autoconf -*- |
---|
| 2 | # Process this file with autoconf to produce a configure script. |
---|
| 3 | |
---|
[41] | 4 | AC_PREREQ(2.63) |
---|
| 5 | AC_INIT([SystemCASS],[1.0.0]) |
---|
[8] | 6 | AC_CANONICAL_TARGET |
---|
| 7 | |
---|
| 8 | AC_CONFIG_HEADER([config.h]) |
---|
| 9 | |
---|
| 10 | AM_INIT_AUTOMAKE |
---|
| 11 | |
---|
| 12 | # Checks for programs. |
---|
| 13 | AC_PROG_CXX |
---|
| 14 | AC_PROG_CC |
---|
| 15 | AC_PROG_CPP |
---|
| 16 | AC_PROG_INSTALL |
---|
| 17 | AC_PROG_LN_S |
---|
| 18 | AC_PROG_MAKE_SET |
---|
| 19 | AC_PROG_LIBTOOL |
---|
| 20 | |
---|
[41] | 21 | AC_CHECK_PROG(has_latex, latex, yes) |
---|
| 22 | AC_CHECK_PROG(has_bibtex, bibtex, yes) |
---|
| 23 | AC_CHECK_PROG(has_fig2dev, fig2dev, yes) |
---|
| 24 | AC_CHECK_PROG(has_ps2pdf, ps2pdf, yes) |
---|
| 25 | AC_CHECK_PROG(has_dvips, dvips, yes) |
---|
| 26 | |
---|
[63] | 27 | AC_CONFIG_MACRO_DIR([m4]) |
---|
[41] | 28 | |
---|
[8] | 29 | # User choices |
---|
| 30 | AC_DEFUN([MY_ARG_ENABLE], |
---|
| 31 | [AC_ARG_ENABLE(m4_translit([[$1]], [_], [-]), |
---|
| 32 | [AS_HELP_STRING([--enable-m4_translit([$1], [_], [-])], |
---|
| 33 | [$2 (default is $3)])], |
---|
| 34 | [do_$1=${enableval}], |
---|
| 35 | [do_$1=$3]) |
---|
[39] | 36 | AS_IF([test x${do_$1} != "xno"], |
---|
[8] | 37 | AC_DEFINE(m4_toupper([CONFIG_$1]), [], [$2]), |
---|
| 38 | )]) |
---|
| 39 | |
---|
[34] | 40 | MY_ARG_ENABLE(debug, [Enable debugging], [no]) |
---|
[62] | 41 | MY_ARG_ENABLE(use_omp, [Compile with OpenMP activated], [no]) |
---|
[39] | 42 | |
---|
[34] | 43 | MY_ARG_ENABLE(default_runtime_compilation, [Compile scheduling code], [no]) |
---|
[8] | 44 | |
---|
| 45 | # Also set -DNDEBUG when not debugging, this disables assert()s |
---|
[62] | 46 | AS_IF([test "x$do_debug" = "xyes"], [CXXFLAGS="-g"], |
---|
[41] | 47 | [test "x$do_debug" != "xyes"], [CXXFLAGS="-O2 -DNDEBUG"]) |
---|
[8] | 48 | |
---|
| 49 | case $target_os in |
---|
| 50 | linux*) |
---|
| 51 | AC_DEFINE(CONFIG_OS_LINUX,1,We have a linux system) |
---|
| 52 | AC_SUBST(SC_LIB_TARGET,linux) |
---|
| 53 | ;; |
---|
| 54 | darwin*) |
---|
| 55 | AC_DEFINE(CONFIG_OS_DARWIN,1,We have a MacOS system) |
---|
| 56 | AC_SUBST(SC_LIB_TARGET,macosx) |
---|
| 57 | ;; |
---|
| 58 | *) |
---|
| 59 | AC_SUBST(SC_LIB_TARGET,unknown) |
---|
| 60 | ;; |
---|
| 61 | esac |
---|
| 62 | |
---|
| 63 | AC_ARG_WITH([pat], |
---|
| 64 | [AS_HELP_STRING([--with-pat=PATH], |
---|
| 65 | [Use PAT trace format, this needs Alliance in PATH])], |
---|
| 66 | [], |
---|
| 67 | [with_pat=no]) |
---|
| 68 | |
---|
| 69 | # Checks for libraries. |
---|
| 70 | AS_IF([test "x$with_pat" != "xno"], |
---|
[41] | 71 | ALLIANCE_CFLAGS="-I$with_pat/include" |
---|
[8] | 72 | [AC_CHECK_HEADER([pat.h],, |
---|
| 73 | [AC_MSG_ERROR([You asked for PAT trace format but no pat.h dnl |
---|
| 74 | can be found. Try --with-pat=/search/dir/])]) |
---|
| 75 | AC_SEARCH_LIBS([pat_message], [Pat], |
---|
| 76 | AC_DEFINE(CONFIG_PAT_TRACE_FORMAT,1,Use PAT trace format), |
---|
| 77 | AC_MSG_ERROR([You asked for PAT trace format but no libpat dnl |
---|
| 78 | can be found. Try --with-pat=/search/dir/]), |
---|
| 79 | [-lMut -lPpt -lPgn])] |
---|
| 80 | AC_SUBST(ALLIANCE_PATH, $withval) |
---|
| 81 | AC_SUBST(ALLIANCE_CFLAGS) |
---|
| 82 | ) |
---|
| 83 | |
---|
| 84 | AM_CONDITIONAL(WITH_ALLIANCE, test x$with_pat != xno) |
---|
| 85 | |
---|
| 86 | AC_ARG_WITH([soclib], |
---|
| 87 | [AS_HELP_STRING([--with-soclib=PATH], |
---|
| 88 | [Use SoCLib in PATH to compile examples])], |
---|
| 89 | [AC_SUBST(SOCLIB_PATH, $withval)], |
---|
| 90 | [with_soclib=no]) |
---|
| 91 | AM_CONDITIONAL(HAS_SOCLIB, test x$with_soclib != xno) |
---|
| 92 | |
---|
[41] | 93 | # OpenMP |
---|
[62] | 94 | AS_IF([test "x$do_use_omp" = "xyes"], |
---|
| 95 | [AC_OPENMP([C]) |
---|
| 96 | AC_CHECK_LIB(dl, dlopen, , ) |
---|
| 97 | AC_CHECK_LIB(gomp, omp_get_thread_num, , )] |
---|
| 98 | ) |
---|
[8] | 99 | |
---|
| 100 | AM_CONDITIONAL(BUILD_DOCS, |
---|
| 101 | [test x$has_latex$has_bibtex$has_fig2dev$has_ps2pdf$has_dvips = xyesyesyesyesyes]) |
---|
| 102 | |
---|
| 103 | # Checks for header files. |
---|
| 104 | AC_HEADER_STDC |
---|
| 105 | AC_CHECK_HEADERS([stdint.h stdlib.h sys/time.h unistd.h]) |
---|
| 106 | |
---|
| 107 | # Checks for typedefs, structures, and compiler characteristics. |
---|
| 108 | AC_HEADER_STDBOOL |
---|
| 109 | AC_C_CONST |
---|
| 110 | AC_C_INLINE |
---|
| 111 | AC_TYPE_INT32_T |
---|
| 112 | AC_TYPE_PID_T |
---|
| 113 | AC_TYPE_SIZE_T |
---|
| 114 | AC_STRUCT_TM |
---|
| 115 | AC_TYPE_UINT64_T |
---|
| 116 | |
---|
| 117 | # Checks for library functions. |
---|
| 118 | AC_FUNC_MALLOC |
---|
| 119 | AC_FUNC_REALLOC |
---|
| 120 | AC_FUNC_STRFTIME |
---|
| 121 | AC_CHECK_FUNCS([memset strchr strdup strstr]) |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | AC_CONFIG_FILES([ |
---|
| 125 | Makefile |
---|
| 126 | src/Makefile |
---|
| 127 | doc/Makefile |
---|
| 128 | ]) |
---|
| 129 | AC_OUTPUT |
---|
| 130 | |
---|