/[pearpc]/configure.in
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /configure.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations)
Wed Sep 5 17:11:21 2007 UTC (16 years, 6 months ago) by dpavlin
File size: 14769 byte(s)
import upstream CVS
1 dpavlin 1 dnl Process this file with autoconf to produce a configure script.
2     AC_INIT(src/system/types.h)
3    
4     PACKAGE=pearpc
5     VERSION=0.5pre
6    
7     dnl Check the system.
8     AC_CANONICAL_SYSTEM
9    
10     AC_SUBST(PACKAGE)
11     AC_SUBST(VERSION)
12    
13     AC_ARG_ENABLE(release,
14     [ --enable-release make an optimized build [default=yes]],,enable_release="yes")
15     AC_ARG_ENABLE(fpo,
16     [ --enable-fpo compile with -fomit-frame-pointer [default=yes]],,enable_fpo="yes")
17     AC_ARG_ENABLE(profiling,
18     [ --enable-profiling make a profile build (implies debug) [default=no]],,enable_profiling="no")
19     AC_ARG_ENABLE(debug,
20     [ --enable-debug make a debug build [default=yes]],,enable_debug="yes")
21     AC_ARG_ENABLE(cpu,
22     [ --enable-cpu choose cpu (generic or jitc_x86) [default=<YOUR-ARCH> or generic]],,enable_cpu="")
23     AC_ARG_ENABLE(ui,
24     [ --enable-ui choose ui (beos, gtk, qt, sdl, win32, or x11) [system-specific defaults]],,enable_ui="no")
25    
26     PPC_CFLAGS="-Wundef -Wall -fsigned-char"
27     PPC_CXXFLAGS="-Wundef -Wall -Woverloaded-virtual -fsigned-char"
28     PPC_LDADD=""
29     PPC_LDFLAGS="$LDFLAGS"
30     PPC_CCASFLAGS=""
31    
32     if test "x$enable_release" = "xyes"; then
33     PPC_CFLAGS="$CFLAGS $PPC_CFLAGS -O2"
34     PPC_CXXFLAGS="$CXXFLAGS $PPC_CXXFLAGS -O2"
35     else
36     PPC_CFLAGS="$PPC_CFLAGS -O0"
37     PPC_CXXFLAGS="$PPC_CXXFLAGS -O0"
38     fi
39    
40     if test "x$enable_fpo" = "xyes"; then
41     PPC_CFLAGS="$PPC_CFLAGS -fomit-frame-pointer"
42     PPC_CXXFLAGS="$PPC_CXXFLAGS -fomit-frame-pointer"
43     fi
44    
45     if test "x$enable_profiling" = "xyes"; then
46     dnl profiling implies debug
47     enable_debug = "yes"
48     PPC_CFLAGS="$PPC_CFLAGS -pg -g"
49     PPC_CXXFLAGS="$PPC_CXXFLAGS -pg -g"
50     else
51     if test "x$enable_debug" = "xyes"; then
52     PPC_CFLAGS="$PPC_CFLAGS -g -fno-inline"
53     PPC_CXXFLAGS="$PPC_CXXFLAGS -g -fno-inline"
54     fi
55     fi
56    
57     AM_INIT_AUTOMAKE($PACKAGE,$VERSION,no-define)
58     AM_CONFIG_HEADER(config.h)
59    
60     dnl Check OS specifica
61    
62     case "$target_os" in
63     linux* | gnu* | k*bsd*-gnu)
64     OSAPI_DIR=posix
65     if test "x$enable_ui" = "xno"; then
66     enable_ui="x11"
67     fi
68     AC_MSG_RESULT([*** GNU, building POSIX version. we need pthread and rt.])
69     PPC_LDADD="$PPC_LDADD -lpthread -lrt"
70     ;;
71     freebsd*)
72     OSAPI_DIR=posix
73     if test "x$enable_ui" = "xno"; then
74     enable_ui="x11"
75     fi
76     AC_MSG_RESULT([*** FREEBSD, building native FreeBSD version. we need pthread.])
77     PPC_LDFLAGS="$PPC_LDFLAGS -pthread"
78     ;;
79     cygwin*)
80     OSAPI_DIR=win32
81     if test "x$enable_ui" = "xno"; then
82     enable_ui="win32"
83     fi
84     AC_MSG_RESULT([*** CYGWIN, building native Win32 version (without cygwin.dll)])
85     PPC_CFLAGS="$PPC_CFLAGS -mno-cygwin"
86     PPC_CXXFLAGS="$PPC_CXXFLAGS -mno-cygwin"
87     PPC_LDADD="$PPC_LDADD -lgdi32 -lcomdlg32 -lwinmm"
88     PPC_CCASFLAGS="-DPREFIX=_"
89     ;;
90     mingw32*)
91     OSAPI_DIR=win32
92     if test "x$enable_ui" = "xno"; then
93     enable_ui="win32"
94     fi
95     AC_MSG_RESULT([*** MinGW, building native Win32 version])
96     PPC_LDADD="$PPC_LDADD -lgdi32 -lcomdlg32 -lwinmm"
97     PPC_CCASFLAGS="-DPREFIX=_"
98     ;;
99     darwin*)
100     OSAPI_DIR=posix
101     if test "x$enable_ui" = "xno"; then
102     enable_ui="x11"
103     fi
104     AC_MSG_RESULT([*** DARWIN, building native Darwin version (X11)])
105     PPC_CCASFLAGS="-DPREFIX=_"
106     PPC_CFLAGS="$PPC_CFLAGS -mdynamic-no-pic"
107     PPC_CXXFLAGS="$PPC_CXXFLAGS -mdynamic-no-pic"
108     ;;
109     beos*)
110     OSAPI_DIR=beos
111     if test "x$enable_ui" = "xno"; then
112     enable_ui="beos"
113     fi
114     AC_MSG_RESULT([*** BEOS, building native BeOS version])
115     PPC_LDFLAGS="-lbe -lgame"
116     PPC_CFLAGS="$PPC_CFLAGS -Wno-multichar"
117     PPC_CXXFLAGS="$PPC_CXXFLAGS -Wno-multichar"
118     ;;
119     *)
120     AC_MSG_WARN([configure: warning: $target_os: unknown target OS, assuming POSIX-compatible...])
121     OSAPI_DIR=posix
122     AC_MSG_WARN([*** assuming POSIX OS, we need pthread])
123     PPC_LDADD="$PPC_LDADD -lpthread"
124     ;;
125     esac
126    
127     case "$enable_cpu" in
128     jitc_x86*)
129     CPU_DIR="cpu_jitc_x86"
130     ;;
131     generic*)
132     CPU_DIR="cpu_generic"
133     ;;
134     *)
135     CPU_DIR=""
136     ;;
137     esac
138    
139     case "$target" in
140     i?86*)
141     AC_MSG_RESULT([*** x86 target system])
142     ARCH_DIR=x86
143     if test -z "$CPU_DIR"; then
144     CPU_DIR="cpu_jitc_x86"
145     fi
146     ;;
147     *)
148     ARCH_DIR=generic
149     if test -z "$CPU_DIR"; then
150     CPU_DIR="cpu_generic"
151     fi
152     ;;
153     esac
154    
155     AC_DEFINE_UNQUOTED(SYSTEM_OSAPI_SPECIFIC_TYPES_HDR, "system/osapi/$OSAPI_DIR/types.h", [Location of system/osapi/$OSAPI_DIR/types.h])
156     AC_DEFINE_UNQUOTED(SYSTEM_ARCH_SPECIFIC_FEATURES_DIR, "system/arch/$ARCH_DIR/sysfeatures.h", [Location of system/arch/$ARCH_DIR/sysfeatures.h])
157     AC_DEFINE_UNQUOTED(SYSTEM_ARCH_SPECIFIC_ENDIAN_DIR, "system/arch/$ARCH_DIR/sysendian.h", [Location of system/arch/$ARCH_DIR/sysendian.h])
158    
159     PPC_CFLAGS="$PPC_CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -pipe";
160     PPC_CXXFLAGS="$PPC_CXXFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -pipe";
161    
162     AM_CONDITIONAL(USE_OSAPI_BEOS, test x$OSAPI_DIR = xbeos)
163     AM_CONDITIONAL(USE_OSAPI_POSIX, test x$OSAPI_DIR = xposix)
164     AM_CONDITIONAL(USE_OSAPI_WIN32, test x$OSAPI_DIR = xwin32)
165    
166     AM_CONDITIONAL(USE_CPU_GENERIC, test x$CPU_DIR = xcpu_generic)
167     AM_CONDITIONAL(USE_CPU_JITC_X86, test x$CPU_DIR = xcpu_jitc_x86)
168    
169     dnl Checks for programs.
170     AC_PROG_RANLIB
171     AC_PATH_PROGS(MAKE, gmake make, :)
172     AC_PROG_MAKE_SET
173     AC_PROG_CC
174     AC_PROG_CXX
175     AC_PROG_CPP
176     AM_PROG_AS
177    
178     dnl To ensure backward compatibility, Automake's `AM_PROG_LEX' invokes
179     dnl (indirectly) this macro twice, which will cause an annoying but
180     dnl benign "`AC_PROG_LEX' invoked multiple times" warning. Future
181     dnl versions of Automake will fix this issue; meanwhile, just ignore
182     dnl this message.
183     dnl --- GNU Autoconf (version 2.58, 18 March 2004)
184     AM_PROG_LEX
185    
186     AC_PROG_YACC
187     AC_PATH_PROG(AR, ar)
188     AC_PATH_PROG(AR, gar)
189    
190     AC_DEFINE(HOST_ENDIANESS_BE, 1234, [big-endian byte-order helper constant])
191     AC_DEFINE(HOST_ENDIANESS_LE, 4321, [little-endian byte-order helper constant])
192    
193     dnl Figure out what version of the posix system timers to use
194     if test "x$OSAPI_DIR" = "xposix"; then
195     AC_CHECK_LIB(rt, clock_settime,
196     [
197     AC_DEFINE(USE_POSIX_REALTIME_CLOCK, 1, [Prefer POSIX realtime clock API])
198     PPC_LDADD="$PPC_LDADD -lrt"
199     AC_EGREP_CPP(yes,
200     [
201     #include <signal.h>
202     #ifdef SIGRTMIN
203     yes
204     #endif
205     ], syssignal=SIGRTMIN, syssignal=SIGALRM
206     )
207     ], [
208     AC_CHECK_LIB(c, setitimer,
209     [
210     AC_DEFINE(USE_POSIX_SETITIMER, 1, [Use interval timer clock API])
211     syssignal=SIGALRM
212     PPC_LDADD="$PPC_LDADD"
213     ], [
214     AC_MSG_ERROR([*** Unable to find timer mechanism, should have either POSIX realtime API or BSD interval timer API ***])
215     ]
216     )
217     ]
218     )
219     AC_DEFINE_UNQUOTED(SYSTIMER_SIGNAL, $syssignal, [Which signal to use for clock timer])
220     fi
221    
222     AC_C_BIGENDIAN(
223     AC_DEFINE(HOST_ENDIANESS, HOST_ENDIANESS_BE, [Which host endianess/byte-order?]),
224     AC_DEFINE(HOST_ENDIANESS, HOST_ENDIANESS_LE, [Which host endianess/byte-order?]),
225     [
226     AC_MSG_WARN([couldn't determine host endianess/byte-order. assuming your machine is little-endian.])
227     AC_DEFINE(HOST_ENDIANESS, HOST_ENDIANESS_LE, [Which host endianess/byte-order?])
228     ]
229     )
230    
231     dnl This non-sense is needed to work around the fact, that autoconf-2.13 provides
232     dnl a different AC_C_BIGENDIAN macro (without parameters) and doesn't moan when
233     dnl giving them anyway. GRRRRR. autoconf-2.5 works OK.
234     case "$ac_cv_c_bigendian" in
235     yes*)
236     AC_DEFINE(HOST_ENDIANESS, HOST_ENDIANESS_BE, [Which host endianess/byte-order?])
237     ;;
238     no*)
239     AC_DEFINE(HOST_ENDIANESS, HOST_ENDIANESS_LE, [Which host endianess/byte-order?])
240     ;;
241     esac
242     dnl /non-sense
243    
244     if test -z "$AR"; then
245     AC_MSG_ERROR([*** 'ar' and 'gar' missing, please install one of them or fix your \$PATH ***])
246     fi
247    
248     dnl Checks for libraries.
249    
250     UI_DIR="$enable_ui"
251     case "$enable_ui" in
252     x11)
253     AC_PATH_X
254     AC_PATH_XTRA
255    
256     AC_CHECK_LIB(X11, XOpenDisplay,
257     [
258     AC_SUBST(X_CFLAGS)
259     PPC_LDADD="$PPC_LDADD -lX11"
260     PPC_LDFLAGS="$PPC_LDFLAGS $X_LIBS"
261     ],
262     AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.]),
263     $X_LIBS
264     )
265     ;;
266     qt)
267     dnl Check for QTDIR environment variable.
268     AC_MSG_CHECKING([whether QTDIR environment variable is set])
269     if test -z "$QTDIR"; then
270     AC_MSG_RESULT([no])
271     AC_MSG_ERROR([QTDIR must be properly set.])
272     else
273     AC_MSG_RESULT([$QTDIR])
274     fi
275    
276     dnl Checks for Qt library.
277     AC_CACHE_CHECK([for Qt library],
278     ac_qtlib, [
279     for X in qt-mt qt; do
280     if test -z "$ac_qtlib"; then
281     if test -f $QTDIR/lib/lib$X.so -o -f $QTDIR/lib/lib$X.a; then
282     ac_qtlib=$X
283     fi
284     fi
285     done
286     ])
287     if test -z "$ac_qtlib"; then
288     AC_MSG_ERROR([Qt library not found. Maybe QTDIR isn't properly set.])
289     fi
290    
291     dnl Check for Qt multi-thread support.
292     if test "x$ac_qtlib" = "xqt-mt"; then
293     ac_thread="thread"
294     fi
295     AC_SUBST(ac_thread)
296    
297     CFLAGS="$CFLAGS -I$QTDIR/include"
298     LIBS="-L$QTDIR/lib -L/usr/X11R6/lib"
299    
300     AC_CACHE_CHECK(
301     [for Qt library version >= 3.0.0], ac_qtlib_version,
302     [ AC_TRY_LINK(
303     [
304     #include "qglobal.h"
305     ],
306     [
307     #if QT_VERSION < 0x030000
308     #error Qt library 3.0.0 or greater required.
309     #endif
310     ],
311     [
312     ac_qtlib_version="yes"
313     QT_CFLAGS="$CFLAGS"
314     QT_LIBS="-l$ac_qtlib"
315     QT_LDFLAGS="$LIBS"
316     ],
317     [
318     QT_CFLAGS=""
319     QT_LIBS=""
320     QT_LDFLAGS=""
321     AC_MSG_ERROR([*** QT version 3.0.0 is required for QT gui. Upgrade or try a different --enable-ui option.])
322     ])
323     CFLAGS="$ac_save_CFLAGS"
324     LIBS="$ac_save_LIBS"
325     ]
326     )
327    
328     AC_SUBST(QT_CFLAGS)
329    
330     dnl A common error message:
331     dnl ac_qtdir_errmsg="not found in current PATH. Maybe QT development environment isn't available (qt3-devel)."
332    
333     PPC_LDADD="$PPC_LDADD $QT_LIBS"
334     PPC_LDFLAGS="$PPC_LDFLAGS $QT_LDFLAGS"
335     ;;
336     gtk)
337     ;;
338     beos)
339     ;;
340     sdl)
341     SDL_VERSION=1.2.0
342    
343     AM_PATH_SDL($SDL_VERSION,
344     :,
345     AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
346     )
347    
348     SDL_CFLAGS=`echo "$SDL_CFLAGS" | sed 's/-Dmain=SDL_main//'`
349     SDL_LIBS=`echo "$SDL_LIBS" | sed 's/-mwindows//' | sed 's/-lmingw32//'`
350     LDFLAGS="$LDFLAGS $SDL_LIBS"
351     PPC_CFLAGS="$PPC_CFLAGS $SDL_CFLAGS"
352     PPC_CXXFLAGS="$PPC_CXXFLAGS $SDL_CFLAGS"
353     PPC_LDADD="$PPC_LDADD $SDL_LIBS"
354     PPC_LDFLAGS="$PPC_LDFLAGS $SDL_LIBS"
355     ;;
356     win32)
357     ;;
358     *)
359     AC_MSG_ERROR([Invalid parameter to --enable-ui: '$enable_ui'. Run './configure --help' for a list of valid parameters.])
360     ;;
361     esac
362    
363     AM_CONDITIONAL(USE_ARCH_X86, test x$ARCH_DIR = xx86)
364     AM_CONDITIONAL(USE_ARCH_GENERIC, test x$ARCH_DIR = xgeneric)
365    
366     AM_CONDITIONAL(USE_UI_QT, test x$UI_DIR = xqt)
367     AM_CONDITIONAL(USE_UI_GTK, test x$UI_DIR = xgtk)
368     AM_CONDITIONAL(USE_UI_BEOS, test x$UI_DIR = xbeos)
369     AM_CONDITIONAL(USE_UI_SDL, test x$UI_DIR = xsdl)
370     AM_CONDITIONAL(USE_UI_WIN32, test x$UI_DIR = xwin32)
371     AM_CONDITIONAL(USE_UI_X11, test x$UI_DIR = xx11)
372    
373     dnl Checks for some functions.
374     AC_CHECK_FUNCS([gettimeofday memset setenv])
375    
376     AC_CHECK_FUNCS(log2, , AC_MSG_CHECKING(for log2 in math.h)
377     AC_TRY_LINK([#include <math.h>],
378     [ log2(1.0); ],
379     AC_DEFINE(HAVE_LOG2) AC_MSG_RESULT(yes),
380     AC_MSG_RESULT(no)))
381    
382     AC_CHECK_FUNCS(exp2, , AC_MSG_CHECKING(for exp2 in math.h)
383     AC_TRY_LINK([#include <math.h>],
384     [ exp2(0.0); ],
385     AC_DEFINE(HAVE_EXP2) AC_MSG_RESULT(yes),
386     AC_MSG_RESULT(no)))
387    
388     dnl Checks for header files.
389     AC_HEADER_STDC
390     AC_CHECK_HEADERS(pthread.h, AC_DEFINE(PTHREAD_HDR, <pthread.h>, [Have pthread.h?]))
391     AC_CHECK_HEADERS([sys/socket.h])
392     AC_CHECK_HEADERS([asm/types.h])
393     AC_CHECK_HEADERS([stdint.h])
394    
395     case "$target_os" in
396     linux*)
397     AC_CHECK_HEADERS([asm/types.h])
398    
399     dnl Have Linux TUN?
400     AC_CHECK_HEADERS(linux/netlink.h, AC_DEFINE(HAVE_LINUX_TUN, 1, [Have TUN/TAP headers?]),,
401     [[
402     #if HAVE_ASM_TYPES_H
403     # include <asm/types.h>
404     #endif
405     #if HAVE_SYS_SOCKET_H
406     # include <sys/socket.h>
407     #endif
408     ]])
409     ;;
410     beos*)
411     echo "BEOS CFLAGS=$CFLAGS"
412     echo "BEOS CPPFLAGS=$CPPFLAGS"
413     echo "BEOS CXFLAGS=$CXXFLAGS"
414     dnl Have BeOS TUN ? (same API as Linux, except the device path)
415     dnl might be in linux/ for compatibility
416     AC_CHECK_HEADERS(linux/if_tun.h, AC_DEFINE(HAVE_BEOS_TUN, 1, [Have TUN/TAP headers?]))
417     dnl but it really makes more sense in net/ (WTF does Linux put that in linux/ ?)
418     dnl AC_CHECK_HEADERS(net/if_tun.h, AC_DEFINE(HAVE_BEOS_TUN, 1, [Have TUN/TAP headers?]))
419     dnl needed to enumerate interfaces under BONE
420     AC_CHECK_LIB(socket, socket, [PPC_LDFLAGS="$PPC_LDFLAGS -lsocket"])
421     ;;
422     darwin*)
423     AC_CHECK_HEADERS(mach/clock.h, AC_DEFINE(HAVE_MACH_CLOCK_H, 1, [Have mach/clock.h]))
424     ;;
425     esac
426    
427     dnl AC_CONFIG_HEADER(config.h)
428    
429     CFLAGS="$PPC_CFLAGS"
430     CXXFLAGS="$PPC_CXXFLAGS"
431     CCASFLAGS="$PPC_CCASFLAGS"
432    
433     dnl Makefile vars.
434     AC_SUBST(ARCH_DIR)
435     AC_SUBST(CPU_DIR)
436     AC_SUBST(UI_DIR)
437     AC_SUBST(OSAPI_DIR)
438     AC_SUBST(CFLAGS)
439     AC_SUBST(CXXFLAGS)
440     AC_SUBST(PPC_LDADD)
441     AC_SUBST(PPC_LDFLAGS)
442    
443     dnl Checks for typedefs, structures, and compiler characteristics.
444     AC_C_CONST
445    
446     AC_CHECK_SIZEOF(char, 1)
447     AC_CHECK_SIZEOF(short, 2)
448     AC_CHECK_SIZEOF(int, 4)
449     AC_CHECK_SIZEOF(long int, 4)
450     AC_CHECK_SIZEOF(long long, 8)
451    
452     #AC_SUBST(PTHREAD_FLAGS)
453    
454     AC_OUTPUT([
455     Makefile
456     doc/Makefile
457     scripts/Makefile
458     src/Makefile
459     src/cpu/Makefile
460     src/cpu/cpu_generic/Makefile
461     src/cpu/cpu_jitc_x86/Makefile
462     src/debug/Makefile
463     src/io/Makefile
464     src/io/3c90x/Makefile
465     src/io/ide/Makefile
466     src/io/graphic/Makefile
467     src/io/rtl8139/Makefile
468     src/io/prom/Makefile
469     src/io/prom/fs/Makefile
470     src/io/prom/fs/hfs/Makefile
471     src/io/prom/fs/hfsplus/Makefile
472     src/io/cuda/Makefile
473     src/io/pci/Makefile
474     src/io/pic/Makefile
475     src/io/macio/Makefile
476     src/io/nvram/Makefile
477     src/io/usb/Makefile
478     src/io/serial/Makefile
479     src/system/Makefile
480     src/system/arch/Makefile
481     src/system/arch/x86/Makefile
482     src/system/arch/generic/Makefile
483     src/system/osapi/Makefile
484     src/system/osapi/beos/Makefile
485     src/system/osapi/posix/Makefile
486     src/system/osapi/win32/Makefile
487     src/system/ui/Makefile
488     src/system/ui/beos/Makefile
489     src/system/ui/gtk/Makefile
490     src/system/ui/qt/Makefile
491     src/system/ui/sdl/Makefile
492     src/system/ui/win32/Makefile
493     src/system/ui/x11/Makefile
494     src/tools/Makefile
495     ])
496    
497     AC_MSG_RESULT([])
498     AC_MSG_RESULT([$0 successful.])
499     AC_MSG_RESULT([])
500     AC_MSG_RESULT([================================================================================])
501     AC_MSG_RESULT([ Configuration summary])
502     AC_MSG_RESULT([================================================================================])
503     AC_MSG_RESULT([])
504     AC_MSG_RESULT([cpu emulation method: $CPU_DIR])
505     AC_MSG_RESULT([compiled for architecture: $ARCH_DIR])
506     AC_MSG_RESULT([compiled for OS-API: $OSAPI_DIR])
507     AC_MSG_RESULT([compiled for UI system: $UI_DIR])
508     AC_MSG_RESULT([enable debug: $enable_debug])
509     AC_MSG_RESULT([enable profiling: $enable_profiling])
510     AC_MSG_RESULT([make release build: $enable_release])
511     AC_MSG_RESULT([omit frame pointer: $enable_fpo])
512     AC_MSG_RESULT([final C compiler flags: $PPC_CFLAGS])
513     AC_MSG_RESULT([final C++ compiler flags: $PPC_CXXFLAGS])
514     AC_MSG_RESULT([final linker flags: $PPC_LDFLAGS])
515     AC_MSG_RESULT([final linker add: $PPC_LDADD])
516     AC_MSG_RESULT([])
517     AC_MSG_RESULT([================================================================================])

  ViewVC Help
Powered by ViewVC 1.1.26