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