source: sources/configure.ac @ 65

Last change on this file since 65 was 64, checked in by bouyer, 5 years ago

Build with -O3 by default

File size: 3.3 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
27AC_CONFIG_MACRO_DIR([m4])
28
29# User choices
30AC_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])
36             AS_IF([test x${do_$1} != "xno"],
37                         AC_DEFINE(m4_toupper([CONFIG_$1]), [], [$2]),
38                         )])
39
40MY_ARG_ENABLE(debug, [Enable debugging], [no])
41MY_ARG_ENABLE(use_omp, [Compile with OpenMP activated], [no])
42
43MY_ARG_ENABLE(default_runtime_compilation, [Compile scheduling code], [no])
44
45# Also set -DNDEBUG when not debugging, this disables assert()s
46AS_IF([test "x$do_debug"  = "xyes"], [CXXFLAGS="-g"],
47      [test "x$do_debug" != "xyes"], [CXXFLAGS="-O3 -DNDEBUG"])
48
49case $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                ;;
61esac
62
63AC_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.
70AS_IF([test "x$with_pat" != "xno"],
71          ALLIANCE_CFLAGS="-I$with_pat/include"
72          [AC_CHECK_HEADER([pat.h],,
73                   [AC_MSG_ERROR([You asked for PAT trace format but no pat.h dnl
74can 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
78can be found. Try --with-pat=/search/dir/]),
79                   [-lMut -lPpt -lPgn])]
80          AC_SUBST(ALLIANCE_PATH, $withval)
81          AC_SUBST(ALLIANCE_CFLAGS)
82)
83
84AM_CONDITIONAL(WITH_ALLIANCE, test x$with_pat != xno)
85
86AC_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])
91AM_CONDITIONAL(HAS_SOCLIB, test x$with_soclib != xno)
92
93# OpenMP
94AS_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)
99
100AM_CONDITIONAL(BUILD_DOCS,
101[test x$has_latex$has_bibtex$has_fig2dev$has_ps2pdf$has_dvips = xyesyesyesyesyes])
102
103# Checks for header files.
104AC_HEADER_STDC
105AC_CHECK_HEADERS([stdint.h stdlib.h sys/time.h unistd.h])
106
107# Checks for typedefs, structures, and compiler characteristics.
108AC_HEADER_STDBOOL
109AC_C_CONST
110AC_C_INLINE
111AC_TYPE_INT32_T
112AC_TYPE_PID_T
113AC_TYPE_SIZE_T
114AC_STRUCT_TM
115AC_TYPE_UINT64_T
116
117# Checks for library functions.
118AC_FUNC_MALLOC
119AC_FUNC_REALLOC
120AC_FUNC_STRFTIME
121AC_CHECK_FUNCS([memset strchr strdup strstr])
122
123
124AC_CONFIG_FILES([
125  Makefile
126  src/Makefile
127  doc/Makefile
128])
129AC_OUTPUT
130
Note: See TracBrowser for help on using the repository browser.