source: sources/configure.ac @ 62

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