|
|
1.1 root 1: dnl Process this file with autoconf to produce a configure script.
2:
3: dnl $Id: configure.in,v 1.6 2003/05/18 00:04:39 fredette Exp $
4:
5: dnl acinclude.m4 - additional tme autoconf macros:
6:
7: dnl Copyright (c) 2001, 2003 Matt Fredette
8: dnl All rights reserved.
9: dnl
10: dnl Redistribution and use in source and binary forms, with or without
11: dnl modification, are permitted provided that the following conditions
12: dnl are met:
13: dnl 1. Redistributions of source code must retain the above copyright
14: dnl notice, this list of conditions and the following disclaimer.
15: dnl 2. Redistributions in binary form must reproduce the above copyright
16: dnl notice, this list of conditions and the following disclaimer in the
17: dnl documentation and/or other materials provided with the distribution.
18: dnl 3. All advertising materials mentioning features or use of this software
19: dnl must display the following acknowledgement:
20: dnl This product includes software developed by Matt Fredette.
21: dnl 4. The name of the author may not be used to endorse or promote products
22: dnl derived from this software without specific prior written permission.
23: dnl
24: dnl THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25: dnl IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26: dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27: dnl DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
28: dnl INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29: dnl (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30: dnl SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31: dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32: dnl STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33: dnl ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34: dnl POSSIBILITY OF SUCH DAMAGE.
35:
36: dnl Checks that we are given a good source directory.
37: AC_INIT(ic/m68k/m68k-impl.h)
38: AC_CANONICAL_SYSTEM
39: AM_INIT_AUTOMAKE(tme, 0.0)
40:
41: dnl Write configuration out to config.h through config.h.in.
42: AM_CONFIG_HEADER(config.h)
43:
44: dnl Checks for programs.
45: AC_PROG_CC
46: AC_PROG_CPP
47: AC_PROG_YACC
48: AC_PROG_INSTALL
49: AC_PROG_MAKE_SET
50:
51: dnl Checks for header files.
52: AC_HEADER_STDC
53: AC_CHECK_HEADERS(unistd.h stdio.h memory.h stdarg.h)
54: AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h sys/socketio.h net/if_dl.h ioctls.h)
55:
56: dnl Checks for typedefs, structures, and compiler characteristics.
57: AC_C_BIGENDIAN
58: AC_C_CONST
59: AC_C_INLINE
60: AC_CHECK_SIZEOF(long, 4)
61: AC_CHECK_SIZEOF(int, 4)
62: AC_CHECK_SIZEOF(short, 2)
63: if test $ac_cv_sizeof_int != 4 && test $ac_cv_sizeof_long != 4; then
64: AC_MSG_ERROR([can't find a 32-bit type])
65: fi
66: if test $ac_cv_sizeof_int != 2 && test $ac_cv_sizeof_short != 2; then
67: AC_MSG_ERROR([can't find a 16-bit type])
68: fi
69: AC_CHECK_ALIGNOF(32)
70: AC_CHECK_ALIGNOF(16)
71: AC_CHECK_SHIFTMAX(8)
72: AC_CHECK_SHIFTMAX(16)
73: AC_CHECK_SHIFTMAX(32)
74: AC_SYS_SOCKADDR_SA_LEN
75:
76: dnl Checks for library functions and prototypes.
77: AC_PROG_GCC_TRADITIONAL
78: AC_FUNC_MEMCMP
79: AC_FUNC_MMAP
80:
81: dnl Checks for perl.
82: AC_PATH_PROGS(PERL, perl4.036 perl4 perl perl5, no)
83: AC_SUBST(PERL)
84:
85: dnl Checks for AF_LINK.
86: AC_MSG_CHECKING([for AF_LINK support])
87: AC_EGREP_CPP(_tme_has_af_link,
88: [
89: #include <sys/socket.h>
90: #ifdef AF_LINK
91: _tme_has_af_link
92: #endif
93: ], [
94: AC_MSG_RESULT(yes)
95: AC_DEFINE(HAVE_AF_LINK, [], [Define if you have AF_LINK.])
96: ], [
97: AC_MSG_RESULT(no)
98: ])
99:
100: dnl Checks for BPF.
101: tme_raw_type=
102: AC_CHECK_HEADER(net/bpf.h, [tme_raw_type=bpf])
103: AC_MSG_CHECKING([for raw Ethernet access method])
104: if test x$tme_raw_type = x; then
105: AC_MSG_ERROR([can't find any raw Ethernet access method])
106: fi
107: AC_MSG_RESULT($tme_raw_type)
108:
109: dnl Configures for the system(s) to emulate.
110: systems=all
111: if echo " ${systems} " | grep ' all ' > /dev/null 2>&1; then
112: systems="sun2"
113: fi
114: TME_MACHINE_SUBDIRS=
115: TME_IC_SUBDIRS=
116: TME_ICS=
117: TME_BUS_SUBDIRS=
118: for system in $systems; do
119:
120: # dispatch on the machine type to get more machines, ICs, and
121: # buses to compile:
122: case ${system} in
123:
124: # the sun2:
125: sun2)
126: machines="sun sun2"
127: ics="m68k am9513 mm58167 z8530"
128: buses="multibus"
129: ;;
130:
131: *)
132: AC_MSG_ERROR([don't know how to emulate ${machine}])
133: ;;
134: esac
135:
136: # add in the new machines, ICs, and buses to compile:
137: for machine in $machines; do
138: if echo " ${TME_MACHINE_SUBDIRS} " | grep " ${machine} " > /dev/null 2>&1; then :; else
139: TME_MACHINE_SUBDIRS="${TME_MACHINE_SUBDIRS} ${machine}"
140: fi
141: done
142: for ic in $ics; do
143: if test -d ic/$ic; then
144: if echo " ${TME_IC_SUBDIRS} " | grep " ${ic} " > /dev/null 2>&1; then :; else
145: TME_IC_SUBDIRS="${TME_IC_SUBDIRS} ${ic}"
146: fi
147: else
148: ic="tme_ic_${ic}.la"
149: if echo " ${TME_ICS} " | grep " ${ic} " > /dev/null 2>&1; then :; else
150: TME_ICS="${TME_ICS} ${ic}"
151: fi
152: fi
153: done
154: for bus in $buses; do
155: if echo " ${TME_BUS_SUBDIRS} " | grep " ${bus} " > /dev/null 2>&1; then :; else
156: TME_BUS_SUBDIRS="${TME_BUS_SUBDIRS} ${bus}"
157: fi
158: done
159: done
160: TME_HOSTS="posix bsd"
161: AC_SUBST(TME_MACHINE_SUBDIRS)
162: AC_SUBST(TME_IC_SUBDIRS)
163: AC_SUBST(TME_ICS)
164: AC_SUBST(TME_BUS_SUBDIRS)
165: AC_SUBST(TME_HOSTS)
166:
167: dnl Configure for libtool.
168: AC_LIBLTDL_INSTALLABLE
169: AC_SUBST(INCLTDL)
170: AC_SUBST(LIBLTDL)
171: AC_LIBTOOL_DLOPEN
172: AM_PROG_LIBTOOL
173: AC_SUBST(LTLIBOBJS)
174: AC_CONFIG_SUBDIRS(libltdl)
175: TME_PREOPEN=
176: if test $enable_shared = no; then
177: TME_PREOPEN='`sort -u $(top_builddir)/tme-preopen.txt`'
178: fi
179: AC_SUBST(TME_PREOPEN)
180:
181: dnl Configure debugging and/or warnings.
182: AC_ARG_ENABLE(debug,
183: [ --disable-debug don't compile debuggable libraries and programs (default=do)],
184: [ ], [enable_debug=yes])
185: if test "x$enable_debug" = "xyes"; then
186: CFLAGS="${CFLAGS-} -g -O0"
187: CXXFLAGS="${CXXFLAGS-} -g3 -O0"
188: fi
189: AC_ARG_ENABLE(warnings,
190: [ --disable-warnings don't compile with warnings turned on (default=do)],
191: [ ], [enable_warnings=yes])
192: if test "x$enable_warnings" = "xyes" -a "x$GCC" = "xyes"; then
193: CFLAGS="${CFLAGS-} -Wall -Werror"
194: CXXFLAGS="${CXXFLAGS-} -W"
195: fi
196:
197: dnl Generate tmeconfig.h. The whether-to-generate logic is cribbed
198: dnl from glib-1.2.1's configure.in.
199: dnl See that file for an explanation.
200: AC_OUTPUT_COMMANDS([
201:
202: ## Generate our configure-time sources in two
203: ## cases:
204: ## 1. `config.status' is run either explicitly, or via configure.
205: ## Esp. not when it is run in `Makefile' to generate makefiles and
206: ## config.h
207: ## 2. CONFIG_OTHER is set explicitly
208: ##
209: ## Case 1 is difficult. We know that `automake' sets one of
210: ## CONFIG_FILES or CONFIG_HEADERS to empty. This heuristic works
211: ## only when AM_CONFIG_HEADER is set, however.
212:
213: case "x$CONFIG_OTHER" in
214: *tmeconfig.h) gen_tmeconfig_h=yes
215: ;;
216: esac
217: if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then
218: # Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1
219: if test "x${CONFIG_OTHER}" = x; then
220: gen_tmeconfig_h=yes
221: fi
222: fi
223:
224: ## If we're generating tmeconfig.h:
225: if test "x$gen_tmeconfig_h" = xyes; then
226: outfile=tmeconfig.h
227: echo "$as_me: creating $outfile"
228: cat <<TMEEOF > ${outfile}-tmp
229: /* tmeconfig.h
230: *
231: * This is an automatically generated file - please modify 'configure.in'.
232: */
233:
234: #ifndef _TMECONFIG_H
235: #define _TMECONFIG_H
236:
237: TMEEOF
238: (for word in HAVE_ TIME_ PROTO_ ALIGNOF_ WORDS_BIGENDIAN; do \
239: grep $word config.h | sed 's/#define[ ]\{1,\}/&_TME_/' ; \
240: done) | sort | uniq >> ${outfile}-tmp
241: echo '#define TME_RELEASE_MAJOR (' \
242: `echo $VERSION | sed -e 's,^\([0-9][0-9]*\)\.[0-9][0-9]*$,\1,'` ')' >> ${outfile}-tmp
243: echo '#define TME_RELEASE_MINOR (' \
244: `echo $VERSION | sed -e 's,^[0-9][0-9]*\.\([0-9][0-9]*\)$,\1,'` ')' >> ${outfile}-tmp
245: echo '#define TME_BUILD_TARGET "'$target'"' >> ${outfile}-tmp
246: if test $ac_cv_sizeof_int = 4; then
247: echo 'typedef signed int tme_int32_t;' >> ${outfile}-tmp
248: echo 'typedef unsigned int tme_uint32_t;' >> ${outfile}-tmp
249: elif test $ac_cv_sizeof_long = 4; then
250: echo 'typedef signed long tme_int32_t;' >> ${outfile}-tmp
251: echo 'typedef unsigned long tme_uint32_t;' >> ${outfile}-tmp
252: fi
253: if test $ac_cv_sizeof_int = 2; then
254: echo 'typedef signed int tme_int16_t;' >> ${outfile}-tmp
255: echo 'typedef unsigned int tme_uint16_t;' >> ${outfile}-tmp
256: elif test $ac_cv_sizeof_short = 2; then
257: echo 'typedef signed short tme_int16_t;' >> ${outfile}-tmp
258: echo 'typedef unsigned short tme_uint16_t;' >> ${outfile}-tmp
259: fi
260: echo 'typedef signed char tme_int8_t;' >> ${outfile}-tmp
261: echo 'typedef unsigned char tme_uint8_t;' >> ${outfile}-tmp
262: cat <<TMEEOF >> ${outfile}-tmp
263:
264: /* features that aren't currently controlled by a configure option: */
265: #define TME_THREADS_SJLJ
266:
267: #endif /* !_TMECONFIG_H */
268: TMEEOF
269: if cmp -s ${outfile}-tmp $outfile; then
270: echo "$as_me: $outfile is unchanged"
271: rm -f ${outfile}-tmp
272: else
273: mv ${outfile}-tmp ${outfile}
274: fi
275: fi
276: ], [
277: PACKAGE="$PACKAGE"
278: VERSION="$VERSION"
279: target="$target"
280: ac_cv_sizeof_int="$ac_cv_sizeof_int"
281: ac_cv_sizeof_long="$ac_cv_sizeof_long"
282: ac_cv_sizeof_short="$ac_cv_sizeof_short"
283: ])
284:
285: dnl Writes files.
286: AC_OUTPUT(Makefile
287: tme/Makefile
288: tme/ic/Makefile
289: tme/machine/Makefile
290: tme/generic/Makefile
291: libtme/Makefile
292: ic/Makefile
293: ic/m68k/Makefile
294: machine/Makefile
295: machine/sun/Makefile
296: machine/sun2/Makefile
297: host/Makefile
298: host/posix/Makefile
299: host/bsd/Makefile
300: bus/Makefile
301: bus/multibus/Makefile
302: generic/Makefile
303: tmesh/Makefile)
304:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.