File: configure.ac

package info (click to toggle)
faumachine 20180503-4
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 61,272 kB
  • sloc: ansic: 272,290; makefile: 6,199; asm: 4,251; sh: 3,022; perl: 886; xml: 563; pascal: 311; lex: 214; vhdl: 204
file content (606 lines) | stat: -rw-r--r-- 17,833 bytes parent folder | download
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
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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
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
406
407
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
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
# FAUmachine build configuration
#
# Copyright (C) 2004-2017 FAUmachine Team <info@faumachine.org>.
# This program is free software. You can redistribute it and/or modify it
# under the terms of the GNU General Public License, either version 2 of
# the License, or (at your option) any later version. See COPYING.

AC_PREREQ(2.59)
AC_INIT([FAUmachine],[CURRENT],[info@faumachine.org])
AC_CONFIG_MACRO_DIR([m4])
#AC_CONFIG_SRCDIR(node-pc/frontend.c)
AC_CONFIG_AUX_DIR(scripts)

# reset CFLAGS; user-defined CFLAGS are unsupported
if test -n "$CFLAGS" ; then
	AC_MSG_WARN([[user-defined CFLAGS are unsupported and will be ignored]])
	$as_unset CFLAGS || test "${CFLAGS+set}" != set || { CFLAGS=; export CFLAGS; }
fi

AM_INIT_AUTOMAKE(1.9 foreign)
AC_CONFIG_HEADERS([config.h])

# search for libraries in /usr/local by default, too.
: ${LDFLAGS=-L/usr/lib -L/usr/local/lib}
export LDFLAGS


AC_SUBST([xpmdir],	'${datadir}/AC_PACKAGE_TARNAME/xpm')
AC_SUBST([pngdir],	'${datadir}/AC_PACKAGE_TARNAME/png')
AC_SUBST([vhdldir],	'${datadir}/AC_PACKAGE_TARNAME/vhdl')
AC_SUBST([faumdatadir],	'${datadir}/AC_PACKAGE_TARNAME')
AC_SUBST([docdir],	'${datadir}/doc/AC_PACKAGE_TARNAME')
AC_SUBST([keymapdir],	'${datadir}/AC_PACKAGE_TARNAME/keymaps')
AC_SUBST([experimentsdir],	'${faumdatadir}/experiments')
AC_SUBST([examplesdir],	'${docdir}/examples')
AC_SUBST([toolsdir],	'${libdir}/AC_PACKAGE_TARNAME/tools')
AC_SUBST([romdir],	'${datadir}/AC_PACKAGE_TARNAME/roms')

AC_SUBST([BINLAUNCHER],	[faum])
AC_SUBST([BINNODE],	[faum-node-pc])
AC_SUBST([BINMERGECOW],	[faum-mergecow])

# check command line parameters

AC_ARG_ENABLE(build-encoder,
	AS_HELP_STRING([--disable-build-encoder],[disable build encoder]),
	[build_encoder=$enableval], [build_encoder=maybe]
)

AC_ARG_ENABLE(build-userguide,
	AS_HELP_STRING([--enable-build-userguide],[force to rebuild userguide]),
	[build_userguide=$enableval], [build_userguide=auto]
)

AC_ARG_ENABLE(build-bios,
	      AS_HELP_STRING([--disable-build-bios],[disable build bioses]),
	      [build_bios=$enableval], [build_bios=maybe]
)

AC_ARG_ENABLE(build-at-bios,
	      AS_HELP_STRING([--disable-build-at-bios],[disable build at bios]),
	      [build_at_bios=$enableval], [build_at_bios=maybe]
)

AC_ARG_ENABLE(build-gtk-gui,
	      AS_HELP_STRING([--disable-build-gtk-gui],[disable build of gtk+ gui]),
	      [build_gtk_gui=$enableval], [build_gtk_gui=maybe]
)

# FIXME: default should be compile_with_werror=yes
AC_ARG_ENABLE(werror,
	AS_HELP_STRING([--enable-werror],[treat compiler warnings as errors]),
	[compile_with_werror=$enableval], [compile_with_werror=no]
)

AC_ARG_ENABLE(kvm-support,
	      AS_HELP_STRING([--enable-kvm-support],[enable kvm support]),
	      [kvm_support=$enableval], [kvm_support=no]
)

dnl iASL = intel ACPI Source Language optimizing compiler and disassembler
AC_ARG_WITH(iasl-dir,
	AS_HELP_STRING([--with-iasl-dir=PATH],[use PATH to search for Intel ASL Compiler]),
	[IASL_DIR=$withval],
	[IASL_DIR=/usr/bin]
)

dnl check for fauhdli directory argument
AC_ARG_WITH(fauhdli-dir,
	AS_HELP_STRING([--with-fauhdli-dir=PATH],
		[use PATH to search for fauhdli]),
	[FAUHDLI_DIR=$withval],
	[FAUHDLI_DIR=$prefix]
)

if test    -e $FAUHDLI_DIR/include/fauhdli.h \
	-a -e $FAUHDLI_DIR/lib/libfauhdli.a \
        -a -e $FAUHDLI_DIR/include/basetypes.h
then
	CAN_USE_FAUHDLI=yes
	LIBFAUHDLI_LIBS=$FAUHDLI_DIR/lib/libfauhdli.a
	LIBFAUHDLI_CFLAGS=-I$FAUHDLI_DIR/include/
	AC_DEFINE(HAVE_FAUHDLI, 1, [define to 1 if fauhdli is present])
else
	CAN_USE_FAUHDLI=no
	LIBFAUHDLI_LIBS=""
	LIBFAUHDLI_CFLAGS=""
fi

dnl substibute additional flags for libfauhdli
AC_SUBST(LIBFAUHDLI_CFLAGS)
AC_SUBST(LIBFAUHDLI_LIBS)
AM_CONDITIONAL(HAVE_FAUHDLI, test "$CAN_USE_FAUHDLI" != no)

dnl check for zuse sources
AC_ARG_WITH(zuse-dir,
	AS_HELP_STRING([--with-zuse-dir=PATH],
		[use PATH to search for zuse sources]),
	[ZUSE_DIR=$withval],
	[ZUSE_DIR=$prefix]
)

if test -e $ZUSE_DIR/src/plan2vhdl/zuse_matrix.xml \
     -a -e $ZUSE_DIR/src/plan2vhdl/zuse_li.xml \
     -a -e $ZUSE_DIR/src/plan2vhdl/zuse_lii.xml \
     -a -e $ZUSE_DIR/src/plan2vhdl/zuse_ri.xml \
     -a -e $ZUSE_DIR/src/plan2vhdl/zuse_rii.xml
then
	CAN_USE_ZUSE=yes
	AC_DEFINE(HAVE_ZUSE, 1, [define to 1 if zuse sources are present])
else
	CAN_USE_ZUSE=no
fi

dnl substibute additional flags for zuse
AC_SUBST(ZUSE_DIR)
AM_CONDITIONAL(HAVE_ZUSE, test "$CAN_USE_ZUSE" != no)

# Check host system
AC_GNU_SOURCE
AC_SYS_LARGEFILE
AC_CANONICAL_HOST
AC_MSG_RESULT([Your system type: $host])

dnl Don't depend on pkg-config
m4_ifdef([PKG_CHECK_MODULES], [], [
	m4_errprint([warning: pkg-config checks are not available
])
	m4_defun([PKG_CHECK_MODULES], [
		# pkg-config check is not available
		# we simply pretend that it failed:
		AC_MSG_WARN([pkg-config not available, cannot check for $2])
		$4
	])
])

# Checks for programs.
AM_PROG_AS
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_MAKE_SET
AM_PROG_LEX
AC_PROG_YACC
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PATH_PROG(perl, perl)
AC_CHECK_PROGS(NM, nm)
AC_CHECK_PROGS(OBJDUMP, objdump)
AC_CHECK_PROGS(OBJCOPY, objcopy)
AC_CHECK_PROGS(PDFLATEX, pdflatex)
AC_CHECK_PROGS(FIG2DEV, fig2dev)
AC_CHECK_PROGS(BIBTEX, bibtex)
AC_CHECK_PROGS(CONVERT, convert)
AC_CHECK_PROGS(DVIPS, dvips)
AC_CHECK_PROGS(PSTOPS, pstops)
AC_CHECK_PROGS(PS2PDF, ps2pdf)
AC_CHECK_PROGS(XMLTO, xmlto)
AC_CHECK_PROGS(FAUCC, faucc)
AC_CHECK_PROGS(CPPCHECK, cppcheck, false --)
AC_PATH_PROGS(IASL, iasl, , $IASL_DIR)
AC_CHECK_PROGS([ARMGCC], [arm-none-eabi-gcc], [])
dnl check if etherboot provided ne2000.rom.gz should be used.
AC_CHECK_FILE([/usr/share/etherboot/ne.rom.gz],
	      [NE_ROM=/usr/share/etherboot/ne.rom.gz])

AM_CONDITIONAL(HAVE_IASL, test -n "$IASL")
AM_CONDITIONAL(HAVE_ARMGCC, test -n "$ARMGCC")
AM_CONDITIONAL(HAVE_NE_ROM, test -n "$NE_ROM")

if test -z "$FAUCC"; then
	LIBFAUCC=""
	build_at_bios=no
else
	LIBFAUCC=`$FAUCC -print-libfaucc-file-name`
	if test "x$build_at_bios" = "xmaybe"; then
		build_at_bios=yes
	fi
fi

AC_SUBST(LIBFAUCC)
AM_CONDITIONAL(BUILD_AT_BIOS, test "x$build_at_bios" != xno)

# check if we build ROMs
AM_CONDITIONAL(HAVE_OBJDUMP, test -n "$OBJDUMP")

if test "x$build_bios" = "xmaybe"; then
	if test -n "$OBJDUMP" ; then
		build_bios=yes
	else
		build_bios=no
	fi
fi
AM_CONDITIONAL(BUILD_BIOS, test "x$build_bios" != xno)

PKG_CHECK_MODULES(THEORA, [theora],, [MISSING_ENCODER_DEPENDENCIES="${MISSING_ENCODER_DEPENDENCIES} theora"])
AC_SUBST(THEORA_CFLAGS)
AC_SUBST(THEORA_LIBS)

if test "x${build_encoder}" = "xmaybe" ; then
	if test -z "${MISSING_ENCODER_DEPENDENCIES}" ; then
		build_encoder=yes
	else
		build_encoder=no
	fi
fi
AM_CONDITIONAL(BUILD_ENCODER, test "x$build_encoder" != xno)

# we don't yet use automakes 'make dist' feature and depend on
# lex and yacc to build expect, so check for it:
if test -z "$LEX"; then
	AC_MSG_ERROR([Please install flex or lex!])
fi
if test -z "$YACC"; then
	AC_MSG_ERROR([Please install bison or yacc!])
fi

# Checks for header files.
AC_PATH_XTRA
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h malloc.h sys/time.h unistd.h byteswap.h)
AC_CHECK_HEADERS(pty.h termios.h util.h)
AC_CHECK_HEADERS(linux/if_tun.h net/if_tun.h netinet/in_systm.h)
AC_CHECK_HEADERS(netpacket/packet.h)

if test "x${kvm_support}" = "xyes" ; then
	AC_CHECK_HEADERS(linux/kvm.h)
	if test -z "$HAVE_LINUX_KVM_H" ; then
		kvm_support=no
	fi
fi
AM_CONDITIONAL(BUILD_KVM, test "x$kvm_support" = "xyes")

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_CHECK_SIZEOF(int *)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long)

AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
if test "$ENDIAN" = big; then
	AC_DEFINE(WORDS_BIGENDIAN, 1, [Is this a big endian system?])
fi

# check for host operating system
case "${host}" in
*-linux*)
	hostsystem="LINUX"
	AC_DEFINE(LINUX, 1, [define to 1 if this is a Linux host system])
	;;

*-*-cygwin*)
	hostsystem="CYGWIN"
	AC_DEFINE(CYGWIN, 1, [define to 1 if this is a Cygwin host system])
	;;

*-*-openbsd*)
	hostsystem="OPENBSD"
	AC_DEFINE(OPENBSD, 1, [define to 1 if this is an OpenBSD host system])
	;;

*-apple-darwin*)
	hostsystem="DARWIN"
	AC_DEFINE(DARWIN, 1, [define to 1 if this is an Darwin/Mac OS X host system])
	;;

*)
	AC_MSG_WARN([Unknown OS!])
	hostsystem="UNKNOWN"
	AC_DEFINE(UNKNOWN, 1, [define to 1 if this is an unknown host system])
	;;
esac


# Check if we're on x86_64...
AC_MSG_CHECKING(if this is a x86-64 system)
case "$ac_cv_sizeof_void_p" in
4)
	cpu="i386"
	;;
8)
	cpu="x86_64"
	;;
*)
	cpu="unknown"
	;;
esac
if test "$cpu" = x86_64; then
	HOST_X86_64=yes
	AC_DEFINE(HOST_X86_64, 1, [define to 1 if this is a x86_64 host system])
else
	HOST_X86_64=no
	AC_DEFINE(HOST_I386, 1, [define to 1 if this is a i386 host system])
fi
AC_MSG_RESULT($HOST_X86_64)
AM_CONDITIONAL([HOST_X86_64], [test "$HOST_X86_64" = yes])
AM_CONDITIONAL([HOST_I386], [test "${cpu}" = i386])

# On Darwin / Mac OS X, some special flags/options are needed
AM_CONDITIONAL(DARWIN, test "${hostsystem}" = DARWIN)

# Checks for library functions.

AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gettimeofday select socket strerror strstr strtoul)
AC_CHECK_FUNCS(posix_fallocate)

# check for libraries

# do we need -lossaudio for _oss_ioctl?
AC_USE_LIB(OSSAUDIO, ossaudio, _oss_ioctl)
AC_SUBST(OSSAUDIO_LIBS)

PKG_CHECK_MODULES(X11, x11, HAVE_X11=yes, HAVE_X11=no)
AC_SUBST(X11_CFLAGS)
AC_SUBST(X11_LIBS)

PKG_CHECK_MODULES(GTK, gtk+-2.0, HAVE_GTK=yes, HAVE_GTK=no)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

if test "x$build_gtk_gui" = "xmaybe"; then
	if test "$HAVE_GTK" = yes; then
		build_gtk_gui=yes
	else
		build_gtk_gui=no
	fi
fi

AM_CONDITIONAL(GUI_GTK, test "x$build_gtk_gui" != xno)
if test "$build_gtk_gui" = yes; then
	AC_DEFINE(HAVE_GTK, 1, [Do we have the gtk library available?])
fi

#PKG_CHECK_MODULES(PNG, libpng12, [
PKG_CHECK_MODULES(PNG, libpng, [
	AC_DEFINE(HAVE_PNG, 1, [Do we have libpng available?])
], [
	AC_MSG_WARN([$PNG_PKG_ERRORS])
])
AC_SUBST(PNG_CFLAGS)
AC_SUBST(PNG_LIBS)

TARGETS=

# OSS
CHECK_OSS

# ALSA
CHECK_ALSA
AC_DEFINE(MAX_OUTBURST, 65536, [ set up max. outburst. use 65536 for ALSA0.5, for others 16384 is enough])
AC_DEFINE(OUTBURST, 512, [audio outburst, no clue what this means])

# PULSE
CHECK_PULSE

# Mac OS X
CHECK_MACOSX_AUDIO

# pThreads, will set HAVE_PTHREAD
AX_PTHREAD

# check for doc
if test "$build_userguide" = auto; then
	AC_MSG_CHECKING([if we are able to build the user guide])
	build_userguide=yes
	if test -z "$PDFLATEX"; then build_userguide=no; fi
	if test -z "$FIG2DEV"; then build_userguide=no; fi
	if test -z "$BIBTEX"; then build_userguide=no; fi
	if test -z "$CONVERT"; then build_userguide=no; fi
	if test -z "$DVIPS"; then build_userguide=no; fi
	if test -z "$PSTOPS"; then build_userguide=no; fi
	if test -z "$PS2PDF"; then build_userguide=no; fi
	AC_MSG_RESULT([$build_userguide])
fi
if test "$build_userguide" = yes; then TARGETS="$TARGETS doc/userguide"; fi
AM_CONDITIONAL(BUILD_USERGUIDE, test "$build_userguide" = yes)

# check for docbook processing
AC_MSG_CHECKING([for docbook documentation to build])
if test "$XMLTO"; then
	BUILD_DOCBOOK=yes
	TARGETS="$TARGETS doc/docbook";
else
	BUILD_DOCBOOK=no
fi
AM_CONDITIONAL(BUILD_DOCBOOK, test "$BUILD_DOCBOOK" = yes)
AC_MSG_RESULT($BUILD_DOCBOOK)

# Compiler code generation options needed.
# Compiler code generation options go into $CFLAGS!

# Next option needed to speed up compilation.
# Otherwise compiling system.c will take hours!
AC_PROG_CC_OPTION(-fno-dse, CFLAGS="$CFLAGS -fno-dse")

# Next two options needed to *not* generate PIC code.
# Otherwise dyngen will fail!
AC_PROG_CC_OPTION(-fno-pie, CFLAGS="$CFLAGS -fno-pie")
AC_PROG_CC_OPTION(-no-pie, CFLAGS="$CFLAGS -no-pie")

if test "$hostsystem" = "DARWIN"; then
	AC_PROG_CC_OPTION(-mdynamic-no-pic, CFLAGS="$CFLAGS -mdynamic-no-pic")
fi

AC_PROG_CC_OPTION([-falign-functions=0], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -falign-functions=0"])
AC_PROG_CC_OPTION([-falign-labels=0], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -falign-labels=0"])
AC_PROG_CC_OPTION([-falign-jumps=0], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -falign-jumps=0"])
AC_PROG_CC_OPTION([-falign-loops=0], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -falign-loops=0"])
AC_PROG_CC_OPTION([-fno-optimize-sibling-calls], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -fno-optimize-sibling-calls"])
AC_PROG_CC_OPTION([-fno-strict-aliasing], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -fno-strict-aliasing"])
AC_PROG_CC_OPTION([-fno-reorder-blocks], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -fno-reorder-blocks"])
AC_PROG_CC_OPTION([-fno-ipa-icf], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -fno-ipa-icf"])
AC_PROG_CC_OPTION([-fno-gcse], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -fno-gcse"])
# AC_PROG_CC_OPTION([-mno-mmx], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -mno-mmx"])
# AC_PROG_CC_OPTION([-mno-sse2], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -mno-sse2"])
AC_SUBST([fm_jit_gen_cflags])

# Compiler warnings (not needed but nice to have).
# Compiler warnings go into $CC!
AC_PROG_CC_OPTION(-Wchar-subscripts)
AC_PROG_CC_OPTION(-Wcomment)
AC_PROG_CC_OPTION(-Wformat)
AC_PROG_CC_OPTION(-Wnonnull)
AC_PROG_CC_OPTION(-Wimplicit-int)
AC_PROG_CC_OPTION(-Wimplicit-function-declaration)
AC_PROG_CC_OPTION(-Wimplicit)
AC_PROG_CC_OPTION(-Wmain)
AC_PROG_CC_OPTION(-Wmissing-braces)
AC_PROG_CC_OPTION(-Wparentheses)
AC_PROG_CC_OPTION(-Wsequence-point)
AC_PROG_CC_OPTION(-Wreturn-type)
AC_PROG_CC_OPTION(-Wswitch)
AC_PROG_CC_OPTION(-Wtrigraphs)
AC_PROG_CC_OPTION(-Wunused-function)
AC_PROG_CC_OPTION(-Wunused-label)
AC_PROG_CC_OPTION(-Wunused-variable)
AC_PROG_CC_OPTION(-Wunused-value)
AC_PROG_CC_OPTION(-Wuninitialized)
AC_PROG_CC_OPTION(-Wunknown-pragmas)
# AC_PROG_CC_OPTION(-Wstrict-aliasing)
AC_PROG_CC_OPTION(-Wundef)
AC_PROG_CC_OPTION(-Wendif-labels)
AC_PROG_CC_OPTION(-Wshadow)
AC_PROG_CC_OPTION(-Wpointer-arith)
AC_PROG_CC_OPTION(-Wcast-qual)
AC_PROG_CC_OPTION(-Wcast-align)
AC_PROG_CC_OPTION(-Wwrite-strings)
AC_PROG_CC_OPTION(-Waggregate-return)
AC_PROG_CC_OPTION(-Wstrict-prototypes)
AC_PROG_CC_OPTION(-Wmissing-noreturn)
AC_PROG_CC_OPTION(-Wnested-externs)
AC_PROG_CC_OPTION(-Wunused-local-typedefs)
# AC_PROG_CC_OPTION(-D_FORTIFY_SOURCE=2)
if test "$hostsystem" != "OPENBSD"; then
	AC_PROG_CC_OPTION(-Wredundant-decls)
fi
# FIXME VOSSI
# AC_PROG_CC_OPTION(-Wunreachable-code)
# AC_PROG_CC_OPTION(-Wconversion)
# AC_PROG_CC_OPTION(-Wmissing-prototypes)
# AC_PROG_CC_OPTION(-Wsign-compare)
AC_PROG_CC_OPTION(-Wno-pointer-sign)

if test "$compile_with_werror" = yes ; then
	CC="$CC -Werror"
fi

# installation dirs, for use by the software itself
AS_AC_EXPAND(MANDIR, $mandir)
AS_AC_EXPAND(DOCDIR, $docdir)
AS_AC_EXPAND(KEYMAPDIR, $keymapdir)
AS_AC_EXPAND(EXAMPLESDIR, $examplesdir)
AS_AC_EXPAND(PNGDIR, $pngdir)
AS_AC_EXPAND(VHDLDIR, $vhdldir)
AS_AC_EXPAND(FAUMDATADIR, $faumdatadir)
AS_AC_EXPAND(EXPERIMENTSDIR, $experimentsdir)
AS_AC_EXPAND(TOOLSDIR, $toolsdir)
AS_AC_EXPAND(ROMDIR, $romdir)

# add these variables to the config.h file
AC_DEFINE_UNQUOTED(DOCDIR, "$DOCDIR", [Directory for Documentation])
AC_DEFINE_UNQUOTED(KEYMAPDIR, "$KEYMAPDIR", [Directory for keymaps])
AC_DEFINE_UNQUOTED(PNGDIR, "$PNGDIR", [Directory for PNGs])
AC_DEFINE_UNQUOTED(VHDLDIR, "$VHDLDIR", [Directory for VHDL scripts])
AC_DEFINE_UNQUOTED(FAUMDATADIR, "$FAUMDATADIR", [General directory for FAUmachine stuff])
AC_DEFINE_UNQUOTED(EXPERIMENTSDIR, "$EXPERIMENTSDIR", [Directory for experiments])
AC_DEFINE_UNQUOTED(TOOLSDIR, "$TOOLSDIR", [Directory for tools])
AC_DEFINE_UNQUOTED(ROMDIR, "$ROMDIR", [Directory for ROM binaries])
AC_DEFINE_UNQUOTED(BINNODE, "$BINNODE", [name of simulator executable])
AC_DEFINE_UNQUOTED(BINNODE_REAL, "$BINNODE_REAL", [name of real simulator executable])
AC_DEFINE_UNQUOTED(BINNODE_SSH, "$BINNODE_SSH", [name of ssh simulator executable])
AC_DEFINE_UNQUOTED(BINNODE_UML, "$BINNODE_UML", [name of uml simulator executable])

# don't abort if a dependency file is missing
if test "$am__include" = "include"; then
	am__include="-include"
fi

# process all .in files
AC_CONFIG_FILES([
	Makefile
	sig/Makefile
	conn/Makefile
	chips/Makefile
	chips/qemu/Makefile
	comps/Makefile
	schem/Makefile
	roms/Makefile
	roms/dimm168_gen_256M_eeprom/Makefile
	roms/dimm240_gen_1G_eeprom/Makefile
	roms/mb_foxconn_945p7aa_8ekrs2/Makefile
	roms/mb_fujitsu_D2817_bios/Makefile
	roms/mb_ga_686dlx_bios/Makefile
	roms/mb_ga_ep45t_ud3lr_bios/Makefile
	roms/mb_ibm_at_bios/Makefile
	roms/cirrus_vga_bios/Makefile
	roms/chip_ti_am1808/Makefile
	roms/umvga_bios/Makefile
	roms/isa_gen_ne2000_bios/Makefile
	roms/pci_intel_eepro100_bios/Makefile
	roms/pci_lsi_20810_bios/Makefile
	roms/monitor_amt_3055_eeprom/Makefile
	roms/monitor_eizo_flexscan_f67_eeprom/Makefile
	lib/Makefile
	lib/pattern-matcher/Makefile
	sim/Makefile
	vhdl/Makefile
	experiments/Makefile
	doc/Makefile
	doc/faum.desktop
	doc/docbook/Makefile
	doc/docbook/main.xml
	doc/userguide/Makefile
	doc/userguide/installpaths.sty
	scripts/Makefile
	scripts/encoder/Makefile
	scripts/plotter/Makefile
	scripts/test-FAUmachine/test-engine/Makefile
])

AC_CONFIG_FILES([
	scripts/build.sh
	scripts/faum
], [
	chmod +x $ac_file
])

AC_OUTPUT

# ========================================================================
echo
echo "  $PACKAGE_NAME configuration"
echo
echo "  prefix:             		$prefix"
echo "  Build BIOSes:			$build_bios"
echo "  Build AT BIOS:      		$build_at_bios"
echo "  Build encoder:      		$build_encoder"
echo "  Use fauhdli in build:		$CAN_USE_FAUHDLI"
echo "  Use zuse sources in build:	$CAN_USE_ZUSE"

echo "  Additional targets: "
if test -z "$TARGETS"; then
	echo "<none>"
else
	echo "  $TARGETS"
fi

case "$CC" in
*-Werror*)
	echo "  Using -Werror during compile."
	;;
*)
	echo "  Not using -Werror during compile."
	;;
esac
echo
echo "Now type 'make' to build $PACKAGE_NAME"