configure.ac 10.4 KB
Newer Older
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
AC_PREREQ(2.57)
AC_INIT(ocarina, 2.0w, ocarina-users@enst.fr)
AC_CONFIG_SRCDIR(src)
AC_CONFIG_AUX_DIR(support)

##########################################
# Initialization.
##########################################

AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([1.9 tar-pax])

##########################################
# Check fo various programs.
##########################################

AC_CHECK_PROG(MV, mv, mv)
AC_CHECK_PROG(RM, rm, rm)
AC_CHECK_PROG(CP, cp, cp)
AC_CHECK_PROG(GREP, grep, grep)
AC_CHECK_PROG(CHMOD, chmod, chmod)
AC_CHECK_TOOL([STRIP],[strip])
AC_PROG_RANLIB
AM_PROG_GNATMAKE
AM_CROSS_PROG_GNATMAKE
AM_PROG_WORKING_ADA
AM_CROSS_PROG_WORKING_ADA
AM_HAS_APDIR
AC_CHECK_PROG(GNATCLEAN, gnatclean, gnatclean)
AC_CHECK_PROG(GNATLS, gnatls, gnatls)
AC_EXEEXT
AM_PATH_PYTHON

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
dnl we need a GNU flavoured sed 
AC_CHECK_PROG(HAVE_GNUSED,gnused,yes,no)
AC_CHECK_PROG(HAVE_GSED,gsed,yes,no)
AC_CHECK_PROG(HAVE_SED,sed,yes,no)

if test "$HAVE_GNUSED" = yes; then
 SED=gnused
else
 if test "$HAVE_GSED" = yes; then
  SED=gsed
 else
  SED=sed
 fi
fi
AC_SUBST(SED)

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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
##########################################
# Check for the path kind used by GNAT
##########################################

AC_MSG_CHECKING([the path kind used by the Ada compiler])
PATH_KIND=`$GNATLS -v 2>&1 \
      | grep -A2 '^Source Search Path:' \
      | tail -1 | tr '[[A-Z]]' '[[a-z]]' \
      | sed -e 's, *[[a-z]]:[[/\\]].*,WINDOWS,g' \
      | sed -e 's, */.*,UNIX,g'`
case ${PATH_KIND} in
     "WINDOWS" | "UNIX" )
         AC_MSG_RESULT($PATH_KIND)
	 ;;
     * )
	 AC_MSG_WARN([gnatls ("$GNATLS") uses an unknown path kind: "${PATH_KIND}. Assuming UNIX path"])
	 PATH_KIND=UNIX
	 ;;
esac
AC_SUBST(PATH_KIND)

##########################################
# Check for GNU Make
##########################################

AM_GNU_MAKE

##########################################
# XML/Ada
##########################################

XMLADA_INCS=""
XMLADA_LIBS=""
XMLADA_FLAGS=""
XMLADA_PROJECT=""
has_xmlada=no

AC_MSG_CHECKING([XmlAda])
if xmlada-config --version 2>&1 | ${GREP} "^XmlAda" > /dev/null 2>&1; then
   XMLADA_CONFIG=xmlada-config
   XMLADA_INCS="`xmlada-config --cflags`"
   XMLADA_LIBS="`xmlada-config --libs`"
   XMLADA_PROJECT="`xmlada-config --prefix`/lib/gnat"
   has_xmlada=yes
else
   XMLADA_CONFIG=no
   has_xmlada=no
fi
AC_MSG_RESULT($has_xmlada)
AM_CONDITIONAL(HAS_XMLADA, [test "x$has_xmlada" = "xyes"])

AC_SUBST(XMLADA_INCS)
AC_SUBST(XMLADA_LIBS)
AC_SUBST(XMLADA_CONFIG)
AC_SUBST(XMLADA_PROJECT)

##########################################
# Check for maintainer (debug) mode.
##########################################

GNATFLAGS=""

define(DEBUG_OPTIONS, [dnl
  GNATFLAGS="-XBUILD=debug"
  debug=true])
define(NODEBUG_OPTIONS, [dnl
  GNATFLAGS="-XBUILD=release"
  debug=false])

AC_ARG_ENABLE(debug,
[  --enable-debug          Turn on debugging options],
[if [[ "$enableval" = "yes" ]]; then
  DEBUG_OPTIONS
else
  NODEBUG_OPTIONS
fi],
[NODEBUG_OPTIONS])

define(GCOV_OPTIONS, [dnl
  GCOV=""
  gcov=true])
define(NOGCOV_OPTIONS, [dnl
  GCOV="-- "
  gcov=false])

AC_ARG_ENABLE(gcov,
[  --enable-gcov           Turn on gcov],
[if [[ "$enableval" = "yes" ]]; then
  GCOV_OPTIONS
else
  NOGCOV_OPTIONS
fi],
[NOGCOV_OPTIONS])

AC_SUBST(GNATFLAGS)
AC_SUBST(GCOV)
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)


define(SHARED_LIBRARY_OPTIONS, [dnl
  GNAT_LIB_FLAGS="-XLIBRARY=dynamic"
  shared=true])
define(NO_SHARED_LIBRARY_OPTIONS, [dnl
  GNAT_LIB_FLAGS="-XLIBRARY=static"
  shared=false])

AC_ARG_ENABLE(shared,
[  --enable-shared         Build shared libraries],
[if [[ "$enableval" = "yes" ]]; then
  SHARED_LIBRARY_OPTIONS
else
  NO_SHARED_LIBRARY_OPTIONS
fi],
[NO_SHARED_LIBRARY_OPTIONS])

AC_SUBST(GNAT_LIB_FLAGS)
AM_CONDITIONAL(SHARED_LIBRARY, test x$shared = xtrue)

##########################################
# Windows requires specific targets
##########################################

case "$host_os" in
  *cygwin* | *mingw*)
    windows=true
    ;;
  *)
    windows=false
    ;;
esac
AM_CONDITIONAL(WINDOWS, test x$windows = xtrue)

case "$target_os" in
  *cygwin* | *mingw*)
    EXE_SUFFIX=.exe
    ;;
  *)
    EXE_SUFFIX=
    ;;
esac
AC_SUBST(EXE_SUFFIX)

######################################################
# See whether a unified tree build has been requested
######################################################

root="`dirname $0`"

AC_MSG_CHECKING([default services])
AC_ARG_WITH(ocarina-runtimes,
AS_HELP_STRING([--with-ocarina-runtimes=x], [enumerate runtimes]),
[
  RUNTIME_LIST=""
  AM_CONDITIONAL(PO_HI_ADA, false)
  AM_CONDITIONAL(PO_HI_C, false)
  AM_CONDITIONAL(PO_HI_JAVA, false)
  AM_CONDITIONAL(PO_QOS_ADA, false)
  AM_CONDITIONAL(POK, false)

  newwithval=`echo ${withval} | tr "[A-Z]" "[a-z]"`
  for R in ${newwithval}
  do
     case ${R} in
        all )
	    for P in polyorb-hi-ada polyorb-hi-c polyorb-qos-ada polyorb-hi-java
            do
	       if test -d ${root}/resources/runtime/${P}
     	       then
	          RUNTIME_LIST="${RUNTIME_LIST}${P} "
               else
                  AC_MSG_ERROR([runtime ${P} not found])
     	       fi
            done

            AM_CONDITIONAL(PO_HI_ADA, true)
	    AM_CONDITIONAL(PO_HI_C, true)
	    AM_CONDITIONAL(PO_HI_JAVA, true)
            AM_CONDITIONAL(PO_QOS_ADA, true)
	    ;;

        none )
	    AM_CONDITIONAL(PO_HI_ADA, false)
	    AM_CONDITIONAL(PO_HI_C, false)
            AM_CONDITIONAL(PO_QOS_ADA, false)
	    ;;
	 
	pok )
            if test -d ${root}/resources/runtime/${R}
            then
               RUNTIME_LIST="${RUNTIME_LIST}${R} "
            else
               AC_MSG_ERROR([runtime ${R} not found])
            fi
	    AM_CONDITIONAL(POK, true)
	    ;;

	polyorb-hi-ada )
            if test -d ${root}/resources/runtime/${R}
            then
               RUNTIME_LIST="${RUNTIME_LIST}${R} "
            else
               AC_MSG_ERROR([runtime ${R} not found])
            fi
	    AM_CONDITIONAL(PO_HI_ADA, true)
	    ;;

	polyorb-hi-c )
            if test -d ${root}/resources/runtime/${R}
            then
               RUNTIME_LIST="${RUNTIME_LIST}${R} "
            else
               AC_MSG_ERROR([runtime ${R} not found])
            fi
	    AM_CONDITIONAL(PO_HI_C, true)
	    ;;

	polyorb-hi-java )
            if test -d ${root}/resources/runtime/${R}
            then
               RUNTIME_LIST="${RUNTIME_LIST}${R} "
            else
               AC_MSG_ERROR([runtime ${R} not found])
            fi
	    AM_CONDITIONAL(PO_HI_JAVA, true)
	    ;;

	polyorb-qos-ada )
            if test -d ${root}/resources/runtime/${R}
            then
               RUNTIME_LIST="${RUNTIME_LIST}${R} "
            else
               AC_MSG_ERROR([runtime ${R} not found])
            fi
	    AM_CONDITIONAL(PO_QOS_ADA, true)
	    ;;

	* )
	    AC_MSG_ERROR([unknown runtime ${R}])
	    ;;
     esac
  done
  RUNTIME_LIST=`echo "$RUNTIME_LIST" | sed 's/ $//'`
],
[
  RUNTIME_LIST=""
  AM_CONDITIONAL(POK, test -d "${root}/resources/runtime/pok")
  AM_CONDITIONAL(PO_HI_ADA, test -d "${root}/resources/runtime/polyorb-hi-ada")
  AM_CONDITIONAL(PO_HI_C, test -d "${root}/resources/runtime/polyorb-hi-c")
  AM_CONDITIONAL(PO_HI_JAVA, test -d "${root}/resources/runtime/polyorb-hi-java")
  AM_CONDITIONAL(PO_QOS_ADA, test -d "${root}/resources/runtime/polyorb-qos-ada")
])
AC_MSG_RESULT(${RUNTIME_LIST})
AC_SUBST(RUNTIME_LIST)

AC_MSG_CHECKING([for default AADL version])
AC_ARG_WITH(aadl-version,
AS_HELP_STRING([--with-aadl-version=x], [choose AADL version (v1)]),
[
  AADL_VERSION="AADL_V1"
  newval=`echo ${withval} | tr "A-Z" "a-z"`
  case ${newval} in
  v1 )
     AADL_VERSION=AADL_V1
     ;;
  v2 )
     AADL_VERSION=AADL_V2
     ;;
  * )
     AC_MSG_ERROR([no such AADL version])
  esac
],
[
  AADL_VERSION="AADL_V1"
  newval="v1"
])
AC_MSG_RESULT(${newval})
AC_SUBST(AADL_VERSION)

##########################################
# Some version control stuff
##########################################

current_conf_dir="`dirname $0`"
AM_REVISION_UTILS([${current_conf_dir}])

##########################################
# Some final adjustments
##########################################

# Adjust the value of CYGPATH_W depending on the nature of the used
# compiler. On windows platforms, if the used Ada compiler has been
# compiled for target *cygwin*, there is no need for the "cygpath -w"
# path converter.

if test x"${PATH_KIND}" = x"UNIX"; then
   CYGPATH_W="echo"
   PATH_SEP=":"
else
   PATH_SEP=";"
fi;

# Substitute only PATH_SEP because CYGPATH_W is handled automatically
# by autoconf.

AC_SUBST(PATH_SEP)

if test x"$CYGPATH_W" = x"echo"; then
   CYGPATH_U="echo"
else
   CYGPATH_U="cygpath -u"
fi
AC_SUBST(CYGPATH_U)

363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
##########################################
# Build documentation
##########################################

AC_CHECK_PROGS(TEXI2HTML, texi2html)

DOC_DIR=

AC_ARG_ENABLE(doc,
[  --enable-doc            Build documentation [default=no]],
[if [[ "$enableval" = "yes" ]]; then
        DOC_DIR=doc
fi],
[])

AC_SUBST(DOC_DIR)

380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
##########################################
# Output generated files
##########################################

dnl Important! One file per line, nothing before
dnl or after except whitespace! This section
dnl may, one day, be edited automatically to remove 
dnl some entries.

AC_OUTPUT([
	Makefile
	doc/Makefile
	doc/real/Makefile
	examples/Makefile
	examples/petri_net/Makefile
	examples/petri_net/robot/Makefile
	examples/real/Makefile
	examples/real/lib/Makefile
	examples/real/resources/Makefile
	examples/real/safety/Makefile
	examples/real/security/Makefile
	projects/Makefile
	projects-distrib/Makefile
	resources/Makefile
	resources/behavioural_properties/Makefile
	resources/runtime/Makefile
406
	resources/runtime/cheddar/Makefile
407
	resources/runtime/aadl_xml/Makefile
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
	projects/ocarina.gpr
	src/main/Makefile
	src/main/ocarina-configuration.adb
	src/frontends/Makefile
	src/core/Makefile
	src/transfo/Makefile
	src/backends/Makefile
	src/Makefile
	support/Makefile
	support/strip_wrapper.sh
	tools/Makefile
	tools/gendoc.py
	tools/compare.py
	ocarina-config
])

AC_MSG_NOTICE(%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)
AC_MSG_NOTICE(Ocarina configuration is complete!)
AC_MSG_NOTICE(Including the following Ocarina modules: $OCARINA_MODULES)
AC_MSG_NOTICE(GNU make command name: "$GNU_MAKE")
AC_MSG_NOTICE(%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)

##########################################
# Some post-configure manipulations
##########################################

${CHMOD} a+x tools/gendoc.py
${CHMOD} a+x tools/compare.py
${CHMOD} a+x support/strip_wrapper.sh