source: branches/with_autoconf/configure.ac @ 12

Last change on this file since 12 was 8, checked in by nipo, 16 years ago

Checkin autotools magic

File size: 3.5 KB
Line 
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.60)
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
21# User choices
22AC_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
32MY_ARG_ENABLE(check_fsm_rules, [Enable FSM rule checking], [no])
33MY_ARG_ENABLE(check_multiwriting2port, [Report if port is written twice], [no])
34MY_ARG_ENABLE(check_multiwriting2register, [Report if unconnected signal is written twice], [no])
35MY_ARG_ENABLE(debug, [Enable debugging], [yes])
36MY_ARG_ENABLE(default_runtime_compilation, [Default is to compile scheduling code], [yes])
37
38# Also set -DNDEBUG when not debugging, this disables assert()s
39AS_IF([test "x$do_debug" != xyes],
40CXXFLAGS="-DNDEBUG")
41
42case $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                ;;
54esac
55
56AC_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.
63AS_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
70can 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
74can 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
83AM_CONDITIONAL(WITH_ALLIANCE, test x$with_pat != xno)
84
85AC_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])
90AM_CONDITIONAL(HAS_SOCLIB, test x$with_soclib != xno)
91
92AC_CHECK_PROG(has_latex, latex, yes)
93AC_CHECK_PROG(has_bibtex, bibtex, yes)
94AC_CHECK_PROG(has_fig2dev, fig2dev, yes)
95AC_CHECK_PROG(has_ps2pdf, ps2pdf, yes)
96AC_CHECK_PROG(has_dvips, dvips, yes)
97
98AM_CONDITIONAL(BUILD_DOCS,
99[test x$has_latex$has_bibtex$has_fig2dev$has_ps2pdf$has_dvips = xyesyesyesyesyes])
100
101# Checks for header files.
102AC_HEADER_STDC
103AC_CHECK_HEADERS([stdint.h stdlib.h sys/time.h unistd.h])
104
105# Checks for typedefs, structures, and compiler characteristics.
106AC_HEADER_STDBOOL
107AC_C_CONST
108AC_C_INLINE
109AC_TYPE_INT32_T
110AC_TYPE_PID_T
111AC_TYPE_SIZE_T
112AC_STRUCT_TM
113AC_TYPE_UINT64_T
114
115# Checks for library functions.
116AC_FUNC_MALLOC
117AC_FUNC_REALLOC
118AC_FUNC_STRFTIME
119AC_CHECK_FUNCS([memset strchr strdup strstr])
120
121
122AC_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])
130AC_OUTPUT
131
Note: See TracBrowser for help on using the repository browser.