-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
210 lines (157 loc) · 5.88 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
dnl -*- shell-script -*-
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_REVISION($Revision: 1.1 $)
AC_INIT([nocc.c], [0.2.0])
AC_PREREQ(2.12)
AC_GNU_SOURCE
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AM_CONFIG_HEADER(config.h)
AM_CONFIG_HEADER(include/noccconfig.h)
AM_INIT_AUTOMAKE
dnl Checks for programs.
AC_PROG_CC
AM_PROG_CC_STDC
AC_PROG_MAKE_SET
AC_PROG_RANLIB
dnl AC_CHECK_PROG(GPERF,gperf,gperf)
dnl internationalisation
AM_GNU_GETTEXT
dnl AM_C_PROTOTYPES
dnl Checks for libraries.
dnl Checks for header files.
dnl AC_PATH_XTRA
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h stdlib.h string.h stdarg.h sys/types.h fcntl.h malloc.h pwd.h sys/mman.h time.h)
dnl check for terminal library, borrowed from octave's config
unset tcap
for termlib in ncurses curses termcap terminfo termlib; do
AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
test -n "$tcap" && break
done
dnl check for readline/history libraries for interactive stuff
AC_CHECK_HEADER(readline/readline.h,[have_readline_h=yes],[have_readline_h=no])
AC_CHECK_HEADER(readline/history.h,[have_history_h=yes],[have_history_h=no])
AC_CHECK_LIB(readline,readline,[have_libreadline=yes],[have_libreadline=no])
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
AC_FUNC_VPRINTF
dnl AC_CHECK_FUNCS(select)
AC_CHECK_FUNCS(getpwuid)
AC_ARG_ENABLE(debug,[ --enable-debug enable compiler debugging (default disabled)],enable_opt_debug=yes,enable_opt_debug=no)
dnl Compilation flags
EXTRA_CFLAGS="-Wall -ggdb -O0 -fno-strict-aliasing"
EXTRA_LIBS=""
EXTRA_LDFLAGS=""
case "$host_cpu" in
i386)
AC_MSG_ERROR([only for 64-bit platforms])
;;
esac
dnl The default target is a virtual transputer
target_cpu="ETC/T800"
target_os="unknown"
target_vendor="unknown"
build_dir="$(pwd)"
dnl Check for gcrypt
AM_PATH_LIBGCRYPT([1.1.0],[usegcrypt=yes],[usegcrypt=no])
dnl AC_CHECK_HEADER(openssl/ssl.h,[have_ssl_h=yes],[have_ssl_h=no])
dnl AC_CHECK_HEADER(openssl/sha.h,[have_sha_h=yes],[have_sha_h=no])
dnl AC_SEARCH_LIBS(SHA1,ssl,[have_libssl=yes],[have_libssl=no])
AC_CHECK_HEADER(expat.h,[have_expat_h=yes],[have_expat_h=no])
AC_SEARCH_LIBS(XML_Parse,expat,[have_libexpat=yes],[have_libexpat=no])
AC_SEARCH_LIBS(dlsym,dl,[have_lib_dl=yes],[have_lib_dl=no])
AC_PATH_TOOL(LD,ld)
AC_PATH_TOOL(GPERF,gperf)
AC_PATH_TOOL(GPROLOG,gprolog)
AC_PATH_TOOL(GDB,gdb)
AC_PATH_TOOL(WGET,wget)
AC_DEFINE_UNQUOTED([HOST_CPU],"$host_cpu",[host CPU type])
AC_DEFINE_UNQUOTED([HOST_OS],"$host_os",[host OS])
AC_DEFINE_UNQUOTED([HOST_VENDOR],"$host_vendor",[host vendor])
AC_DEFINE_UNQUOTED([TARGET_CPU],"$target_cpu",[target CPU type])
AC_DEFINE_UNQUOTED([TARGET_OS],"$target_os",[target OS])
AC_DEFINE_UNQUOTED([TARGET_VENDOR],"$target_vendor",[target vendor])
AC_DEFINE_UNQUOTED([BUILD_PREFIX],"$prefix",[build prefix])
if test $usegcrypt = yes; then
AC_DEFINE([USE_LIBGCRYPT],1,[define to use libgcrypt])
AC_SEARCH_LIBS(gpg_strerror,gpg-error,,)
fi
dnl On Linux, let the linker export all symbols for dynamic loading later.
if test "x$host_os" = "xlinux-gnu"; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Xlinker --export-dynamic"
else
if test "x$host_os" = "xcygwin"; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Xlinker --export-all-symbols"
fi
fi
dnl if test $have_sha_h = yes; then
dnl if test $have_libssl = yes; then
dnl AC_DEFINE([USE_LIBSSL],1,[define to use SSL library])
dnl fi
dnl fi
AC_ARG_WITH([specs-file], AC_HELP_STRING([--with-specs-file=...],[Path to compiled-in specs file (default is ./nocc.specs.xml)]), [specsfile=$withval], [specsfile="./nocc.specs.xml"])
AC_MSG_CHECKING([for compiled-in specs-file path])
AC_MSG_RESULT($specsfile)
AC_DEFINE_UNQUOTED(SPECSFILE, "$specsfile", [compiled-in specs-file path])
dnl
dnl XXX: because KRoC will only work _well_ within a chroot environment, need to think about chroots for this
dnl
AC_ARG_WITH([kroc], AC_HELP_STRING([--with-kroc=...],[Path to KRoC script for CCCSP back-end]), [kroc=$withval], [kroc=none])
kroc=none
if test "x$kroc" = "xnone"; then
kroc_path=none
else
kroc_path="$kroc"
if test -x "$kroc_path"; then
# Note: will need to change here if KRoC's version output changes
kroc_version=$(($kroc_path --version 2>&1 || echo 'KRoC version 0.0.0') | head -1 | sed 's/^KRoC version \([[^ ]]*\).*$/\1/')
AC_MSG_CHECKING([for KRoC version])
AC_MSG_RESULT($kroc_version)
else
kroc_path=none
fi
AC_MSG_CHECKING([for location of KRoC script])
AC_MSG_RESULT($kroc_path)
fi
AC_ARG_WITH([kroc-ev3], AC_HELP_STRING([--with-kroc-ev3=...],[Path to dummy KRoC script for CCCSP EV3 back-end]), [kroc_ev3=$withval], [kroc_ev3=none])
if test "x$kroc_ev3" = "xnone"; then
kroc_ev3_path=none
else
kroc_ev3_path="$kroc_ev3"
AC_MSG_CHECKING([for location of KRoC/EV3 script])
AC_MSG_RESULT($kroc_ev3_path)
fi
if test $have_expat_h = yes; then
if test $have_libexpat = yes; then
AC_DEFINE([USE_LIBEXPAT],1,[define to use expat XML library])
else
AC_DEFINE([USE_BUILTINXML],1,[define to use built-in XML library])
fi
fi
if test $enable_opt_debug = yes; then
AC_DEFINE([DEBUG],1,[define to enable compiler debugging])
fi
if test $have_lib_dl = yes; then
AC_DEFINE([LIBDL],1,[define to enable use of dynamic linker])
fi
if test $have_libreadline = yes; then
if test $have_readline_h = yes; then
if test $have_history_h = yes; then
AC_DEFINE([USE_LIBREADLINE],1,[define to use GNU readline for interactive operation])
# EXTRA_CFLAGS="$EXTRA_CFLAGS -lreadline $tcap"
EXTRA_LIBS="$EXTRA_LIBS -lreadline $tcap"
fi
fi
fi
# additional compilation flag substitutions
AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(EXTRA_LIBS)
AC_SUBST(EXTRA_LDFLAGS)
# some substitutions for paths
AC_SUBST(build_dir)
AC_SUBST(kroc_path)
AC_SUBST(kroc_ev3_path)
AC_OUTPUT([Makefile include/Makefile misc/Makefile lexer/Makefile parser/Makefile extn/Makefile xml/Makefile frontend/Makefile backend/Makefile target/Makefile lang/Makefile tests/Makefile addons/Makefile nocc.specs.xml])