summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 7626f1842526d7193396c4a3af44add181b61342 (plain) (blame)
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
AC_PREREQ(2.63)

m4_include(./m4/cvstag.m4)

AC_INIT(ssrlApps, TILLAC_CVSTAG([$Name$]), <strauman@slac.stanford.edu>)

AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

AM_INIT_AUTOMAKE([foreign 1.10])
AM_MAINTAINER_MODE

# Check for critical programs we need for building
TILLAC_RTEMS_CHECK_TOOLS

# Must add this BEFORE TILLAC_RTEMS_SETUP
# so that the dummy-top 'config.status' also
# knows how to make a config.h
AM_CONFIG_HEADER(config.h)

TILLAC_RTEMS_SETUP

AC_SUBST([enable_subdirs])
AC_SUBST([all_subdirs])
AC_SUBST([rtems_cpu],[$host_cpu])
AC_SUBST([rtems_bsp],[$enable_rtemsbsp])

# Let this configure and sub-configures search
# the temporary installdir for includes and libraries...
CPPFLAGS="$CPPFLAGS -I`pwd`/data/include"
LDFLAGS="$LDFLAGS -L`pwd`/data/lib"

dnl This doesn't work -- somehow automake gets confused
dnl (perhaps because we have both, a Makefile and a makefile):
dnl automake doesn't produce a Makefile.in. However, if
dnl we add AC_CONFIG_FILES([Makefile]) then it works...
dnl
dnl my_config_files=Makefile
dnl
AC_CONFIG_FILES([Makefile])
enable_subdirs=
all_subdirs=

TILLAC_M4_IF_PRESENT([libbspExt],
[if test -d $srcdir/libbspExt ; then
	have_bspext=yes
	AC_CONFIG_FILES([libbspExt/Makefile])
	all_subdirs="$all_subdirs libbspExt"
	case ${host_cpu} in
		powerpc | i386)
			enable_subdirs="${enable_subdirs} libbspExt"
			AC_DEFINE(HAVE_LIBBSPEXT,1,[Whether we have the libbspExt extension library])
		;;
		*)
		;;
	esac
fi]dnl
)

TILLAC_M4_IF_PRESENT([rtems-gdb-stub],
[if test -d $srcdir/rtems-gdb-stub; then
	AC_CONFIG_FILES([rtems-gdb-stub/Makefile])
	all_subdirs="$all_subdirs rtems-gdb-stub"
	case ${host_cpu} in
		powerpc | i386 | m68k)
			enable_subdirs="${enable_subdirs} rtems-gdb-stub"
		;;
		*)
		;;
	esac
fi]dnl
)

# Check for PCI support
AC_MSG_NOTICE([Checking for PCI support of your BSP])
# No use to use a 'CHECKING' message; AC_CHECK_FUNC already reports...
AC_CHECK_FUNC(pci_find_device)

# BSP_commandline_string is not a function but
# the macro just checks if it can link the symbol
# which is good enough
AC_CHECK_FUNCS([BSP_commandline_string])
AC_CHECK_DECL([BSP_commandline_string],
	[AC_DEFINE([DECL_BSP_COMMANDLINE_STRING],1,[Whether BSP_commandline_string is declared in <bsp.h>])],,
	[#include <rtems.h>
	#include <bsp.h>])

TILLAC_M4_IF_PRESENT([telnetd],
[if test -d $srcdir/telnetd ; then
	AC_CONFIG_FILES([telnetd/Makefile])
	all_subdirs="${all_subdirs} telnetd"
	enable_subdirs="${enable_subdirs} telnetd"
	AC_MSG_CHECKING([if bundled rtems_telnetd_initialize() takes 6 args])
	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <rtems.h>
	#include <rtems/telnetd.h>]],
	[[rtems_telnetd_initialize(0,0,0,0,0,0);]])],
	[AC_MSG_RESULT([Yes])
	 AC_CHECK_LIB([telnetd],[rtems_telnetd_initialize],
		[AC_MSG_NOTICE([Using bundled telnetd library])
		 have_bundled_telnetd=yes
		],
		[AC_MSG_NOTICE([Building unbundled telnetd support])
		 have_bundled_telnetd=no
		],
		TILLAC_RTEMS_CHECK_LIB_ARGS)
	],
	[AC_MSG_NOTICE([No; building unbundled telnetd support])]
	)
fi]dnl
)

TILLAC_M4_IF_PRESENT([miscUtils],
[if test -d $srcdir/miscUtils ; then
	AC_CONFIG_FILES([miscUtils/Makefile])
	enable_subdirs="${enable_subdirs} miscUtils"
	all_subdirs="${all_subdirs} miscUtils"
fi]dnl
)

TILLAC_M4_IF_PRESENT([monitor],
[if test -d $srcdir/monitor ; then
	AC_CONFIG_FILES([monitor/Makefile])
	all_subdirs="${all_subdirs} monitor"
	if test "${enable_tecla}" = "no" ; then
		AC_MSG_NOTICE(['monitor' package disabled because you disabled TECLA -- the monitor would depend on it])
	else
		enable_subdirs="${enable_subdirs} monitor"
	fi
fi]dnl
)

TILLAC_M4_IF_PRESENT([ntpNanoclock],
[if test -d $srcdir/ntpNanoclock ; then
	AC_CONFIG_FILES([ntpNanoclock/Makefile])
	all_subdirs="${all_subdirs} ntpNanoclock"
	enable_subdirs="${enable_subdirs} ntpNanoclock"
fi]dnl
)


if test -d $srcdir/cexp ; then
	all_subdirs="$all_subdirs cexp"
	enable_subdirs="$enable_subdirs cexp"
	AC_CONFIG_SUBDIRS([cexp])
	AC_DEFINE(HAVE_CEXP,1,[Whether CEXP is installed])
	have_cexp=yes
fi

TILLAC_M4_IF_PRESENT([svgmWatchdog],
[if test -d $srcdir/svgmWatchdog ; then
	AC_CONFIG_FILES([svgmWatchdog/Makefile])
	all_subdirs="${all_subdirs} svgmWatchdog"
	# Do we have BSP support for our watchdog
	AC_MSG_CHECKING([Looking for BSP support for the watchdog])
	if test -f $srcdir/svgmWatchdog/bsp_${enable_rtemsbsp}.c ; then
		AC_MSG_RESULT([OK, found BSP support])
		WATCHDOG_BSP_SUPPORT=bsp_${enable_rtemsbsp}
	# No BSP support - is this a known BSP with a E500 CPU ?
	elif case $enable_rtemsbsp in mvme3100 ) true ;; *) false;; esac ; then
		AC_MSG_RESULT([OK, using generic PPC-E500 support])
		WATCHDOG_BSP_SUPPORT=bsp_booke
	# No; if it is a i386 board then we hope it has SMIC
	elif test "${host_cpu}" = "i386" ; then
		AC_MSG_RESULT([MAYBE, using generic SMIC support; hoping your board has SMIC])
		WATCHDOG_BSP_SUPPORT=bsp_smic
	else
		AC_MSG_RESULT([FAILED. Watchdog not supported on this platform])
	fi
	if test "${WATCHDOG_BSP_SUPPORT+set}" = "set" ; then
		enable_subdirs="${enable_subdirs} svgmWatchdog"
		AC_SUBST([WATCHDOG_BSP_SUPPORT])
	fi
fi]dnl
)

TILLAC_M4_IF_PRESENT([coldfUtils],
[if test -d $srcdir/coldfUtils ; then
	AC_CONFIG_FILES([coldfUtils/Makefile])
	all_subdirs="${all_subdirs} coldfUtils"
	if test "${enable_rtemsbsp}" = "uC5282" ; then
		enable_subdirs="${enable_subdirs} coldfUtils"
	fi
fi]dnl
)

TILLAC_M4_IF_PRESENT([efence],
[if test -d $srcdir/efence ; then
	AC_CONFIG_FILES([efence/Makefile])
	all_subdirs="${all_subdirs} efence"
	if test "${host_cpu}" = "powerpc" ; then
# should really check if this is a >= 604 PPC
		AC_CHECK_HEADER([libcpu/pte121.h],
		[enable_subdirs="${enable_subdirs} efence"],
		[AC_MSG_NOTICE([No <libcpu/pte121.h> found; not building libefence])]dnl
		)
	fi
fi]dnl
)

TILLAC_M4_IF_PRESENT([altivec],
[if test -d $srcdir/altivec ; then
	AC_CONFIG_FILES([altivec/Makefile])
	all_subdirs="${all_subdirs} altivec"
	if test "${host_cpu}" = "powerpc" ; then
		AC_MSG_NOTICE([Checking if PPC_CACHE_ALIGNMENT is 32 bytes])
		AC_COMPILE_IFELSE(
			[AC_LANG_PROGRAM(
[[
#include <rtems.h>
#include <rtems/powerpc/powerpc.h>
#include <rtems/score/powerpc.h>
#if PPC_CACHE_ALIGNMENT != 32
#error "Altivec support assumes cache-line size of 32 bytes"
#endif
]],[[]])],
			[AC_MSG_RESULT([Ok])
			enable_subdirs="${enable_subdirs} altivec"],
			[AC_MSG_RESULT([No; not building AltiVec extension])]dnl
		)
	fi
fi]dnl
)

TILLAC_M4_IF_PRESENT([amdeth],
[if test -d $srcdir/amdeth ; then
	AC_CONFIG_FILES([amdeth/Makefile])
	all_subdirs="${all_subdirs} amdeth"
	if test "$ac_cv_func_pci_find_device" = "yes" ; then
		enable_subdirs="${enable_subdirs} amdeth"
	else
		AC_MSG_NOTICE([Your BSP doesn't seem to have PCI; not building the amdeth driver])
	fi
fi]dnl
)

TILLAC_M4_IF_PRESENT([drvLan9118],
[if test -d $srcdir/drvLan9118 ; then
	AC_CONFIG_FILES([drvLan9118/Makefile])
	all_subdirs="${all_subdirs} drvLan9118"
	case $enable_rtemsbsp in 
		uC5282 | beatnik)
			LANIPBASIC_SUPPORT="${enable_rtemsbsp}"
		;;
		*)
			if test "$ac_cv_func_pci_find_device" = "yes" ; then
				LANIPBASIC_SUPPORT=pci
			fi
		;;
	esac
	if test "${LANIPBASIC_SUPPORT+set}" = "set" ; then
		enable_subdirs="${enable_subdirs} drvLan9118"
		AC_SUBST(LANIPBASIC_SUPPORT)
	else
		AC_MSG_NOTICE([lanIpBasic package not supported by this BSP -- not built])
	fi
fi]dnl
)

TILLAC_M4_IF_PRESENT([rtemsNfs],
[if test -d $srcdir/rtemsNfs ; then
	AC_CONFIG_FILES([rtemsNfs/proto/Makefile])
	AC_CONFIG_FILES([rtemsNfs/Makefile])
	AC_CONFIG_FILES([rtemsNfs/src/Makefile])
	all_subdirs="${all_subdirs} rtemsNfs"
fi]dnl
)

# looking for bundled NFS;
build_rtems_nfs=no
AC_MSG_CHECKING([whether we should build unbundled NFS])
# Note the 5th argument; linking would fail because
# the application usually supplies rtems_bsdnet_config.
# In order to link, we create a dummy symbol.
AC_CHECK_LIB([nfs],[nfsMount],
	[AC_MSG_NOTICE([Using RTEMS bundled NFS])
	 AC_SUBST([NFSLIB],["-lnfs"])
	 if test -d $srcdir/rtemsNfs ; then
	 	AC_MSG_NOTICE([Building 'dirutils' only (from unbundled NFS)])
		build_rtems_nfs=dirutils_only
	 fi],
	[if test -d $srcdir/rtemsNfs ; then
		 AC_MSG_NOTICE([Building unbundled NFS])
		 build_rtems_nfs=yes
		 AC_SUBST([NFSLIB],["-lrtemsNfs -lnfsprot"])
	 fi],
	TILLAC_RTEMS_CHECK_LIB_ARGS
)
AC_MSG_RESULT([Building unbundled NFS: $build_rtems_nfs])

if test ! "$build_rtems_nfs" = "no" ; then
	enable_subdirs="${enable_subdirs} rtemsNfs"
fi

TILLAC_M4_IF_PRESENT([bsd_eth_drivers],
[if test -d $srcdir/bsd_eth_drivers ; then
	AC_CONFIG_FILES([bsd_eth_drivers/Makefile])
	AC_CONFIG_FILES([bsd_eth_drivers/libbsdport/Makefile])
	AC_CONFIG_FILES([bsd_eth_drivers/if_bge/Makefile])
	AC_CONFIG_FILES([bsd_eth_drivers/if_em/Makefile])
	AC_CONFIG_FILES([bsd_eth_drivers/if_le/Makefile])
	AC_CONFIG_FILES([bsd_eth_drivers/if_pcn/Makefile])
	AC_CONFIG_FILES([bsd_eth_drivers/if_re/Makefile])
	all_subdirs="${all_subdirs} bsd_eth_drivers"
	if test "$ac_cv_func_pci_find_device" = "yes" ; then
##		if test "${host_cpu}" = i386 && test ! "${have_bspext}" = yes ; then
##			AC_MSG_NOTICE([Not building bsd_eth_drivers; on i386 you need libbspExt])
##		else
			#FIXME: make these configurable options
			ENBL_82542_SUPPORT=NO
			ENBL_ICH8LAN_SUPPORT=YES
			AC_SUBST([ENBL_82542_SUPPORT])
			AC_SUBST([ENBL_ICH8LAN_SUPPORT])
			enable_subdirs="${enable_subdirs} bsd_eth_drivers"
##		fi
	fi
fi]dnl
)

TILLAC_M4_IF_PRESENT([netboot],
[if test -d $srcdir/netboot ; then
	AC_CONFIG_FILES([netboot/Makefile])
	all_subdirs="${all_subdirs} netboot"
	case "$enable_rtemsbsp" in
		svgm|beatnik|uC5282|mvme3100)
			if test "${enable_tecla}" = "no" ; then
				AC_MSG_NOTICE(['netboot' package disabled because you disabled TECLA -- the monitor would depend on it])
			else
				enable_subdirs="${enable_subdirs} netboot"
				case "$enable_rtemsbsp" in
					svgm)
						netboot_compressed=yes
					;;
					*)
					;;
				esac
			fi
	;;
		*)
	;;
	esac
fi]dnl
)

system_subdir=
TILLAC_M4_IF_PRESENT([system],
[if test -d $srcdir/system ; then
	all_subdirs="$all_subdirs system"
	case "$enable_rtemsbsp" in
		rce405)
		# real application is built somewhere else
		;;
		*)
			enable_subdirs="$enable_subdirs system"
			AC_CONFIG_FILES([ssrlApps.components])
			AC_CONFIG_SUBDIRS([system])
		;;
	esac
fi]dnl
)

AC_SUBST([system_subdir])

# an ugly hack so we can give programs that
# should run on the build host a different
# extension.
# The only way automake does not append $(EXEEXT)
# is if a PROGRAM is configure-substituted
# (see automake doc 'EXEEXT')
AC_SUBST([HOSTPROGRAM],['$(HOSTPROG)$(HOSTEXEEXT)'])
AC_SUBST([installexechostbinprogs],[install-exechostbinPROGRAMS])

AM_CONDITIONAL([HAVE_CEXP],             [test "$have_cexp"            = "yes"])
AM_CONDITIONAL([BUILD_RTEMS_NFS],       [test "$build_rtems_nfs"      = "yes"])
AM_CONDITIONAL([HAVE_BUNDLED_TELNETD],  [test "$have_bundled_telnetd" = "yes"])
AM_CONDITIONAL([NETBOOT_COMPRESSED],    [test "$netboot_compressed"   = "yes"])

AC_OUTPUT