dnl Process this file with autoconf to produce a configure script. AC_INIT AC_CONFIG_SRCDIR([VIC.cpp]) AC_PREREQ(2.52d) dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PROG_CPP AC_PROG_MAKE_SET dnl Don't want the default "-O2 -g" that autoconf uses for gcc. if [[ x"$GXX" = "xyes" ]]; then CFLAGS="-O2 -g -fomit-frame-pointer -Wall -Wno-unused -Wno-format" fi UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown HPUX_REV=0 if [[ x$UNAME_SYSTEM = "xHP-UX" ]]; then HPUX_REV=`echo $UNAME_RELEASE | sed -e 's/[^.]*.[0B]*//' -e 's/\..*$//'` fi AC_AIX AC_ISC_POSIX dnl Checks for libraries. HAVE_BEBOX=no AC_CHECK_LIB(amiga, OpenLibrary, HAVE_AMIGA_LIB=yes, HAVE_AMIGA_LIB=no) AC_CHECK_LIB(vga, vga_setmode, HAVE_SVGA_LIB=yes, HAVE_SVGA_LIB=no) AM_PATH_SDL(1.2.0, HAVE_SDL=yes, HAVE_SDL=no) AC_PATH_XTRA AC_CONFIG_HEADER(sysconfig.h) AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/types.h utime.h string.h strings.h values.h ncurses.h) AC_CHECK_HEADERS(sys/vfs.h sys/mount.h sys/select.h sys/param.h sys/statfs.h sys/statvfs.h sys/stat.h linux/joystick.h) AC_CHECK_SIZEOF(char) AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_MODE_T AC_TYPE_OFF_T AC_TYPE_PID_T AC_STRUCT_ST_BLOCKS AC_HEADER_TIME AC_STRUCT_TM dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_FUNC_UTIME_NULL AC_CHECK_FUNCS(gettimeofday sigaction mkdir rmdir select strerror strstr statfs usleep) KBD_LANG=0 AC_ARG_ENABLE(kbd-lang-de,[ --enable-kbd-lang-de Use german keyboard layout],[KBD_LANG=1],[]) AC_ARG_ENABLE(kbd-lang-us,[ --enable-kbd-lang-us Use american keyboard layout],[KBD_LANG=0],[]) AC_MSG_CHECKING(which target to use) if [[ x"$HAVE_BEBOX" = "xyes" ]]; then AC_MSG_RESULT([BeBox]) TARGET=be elif [[ x"$HAVE_AMIGA_LIB" = "xyes" ]]; then AC_MSG_RESULT([AmigaOS]) TARGET=amigaos elif [[ x"$no_x" = "xyes" ]]; then if [[ x"$HAVE_SVGA_LIB" = "xyes" ]]; then AC_MSG_RESULT([SVGAlib]) TARGET=svgalib CFLAGS="$CFLAGS -D__svgalib__" LIBS="$LIBS -lvga" else AC_MSG_RESULT([Ummm...]) AC_MSG_ERROR([Neither X nor SVGAlib found, don't know what target to use.]) fi elif [[ x"$HAVE_SDL" = "xyes" ]]; then AC_MSG_RESULT([SDL]) TARGET=sdl CFLAGS="$CFLAGS $SDL_CFLAGS -DHAVE_SDL" LIBS="$LIBS $SDL_LIBS" else AC_MSG_RESULT([X Window System]) TARGET=x11 CFLAGS="$CFLAGS $X_CFLAGS -I$ac_cv_x_include" LIBS="$LIBS $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS" fi dnl Find out some things about the system dnl - whether we have GCC 2.7 or better. dnl - what CPU we have (to use some assembly hacks on the x86) HAVEGCC27=n HAVEI386=n cat >conftest.cpp << EOF #include int main() { #if defined(__GNUC__) && defined(__GNUC_MINOR__) #if __GNUC__ > 2 || __GNUC_MINOR__ > 6 printf("GNU\n"); #endif #endif return 0; } EOF $CXX conftest.cpp -c -o conftest.o $CXX conftest.o -o conftest ./conftest >conftest.file if grep GNU conftest.file >/dev/null; then HAVEGCC27=y echo "Good news. Found GCC 2.7 or better." elif [[ "$CC" = "gcc" ]]; then echo "I suggest you upgrade to at least version 2.7 of GCC" else echo "Couldn't find GCC. Frodo may or may not compile and run correctly." fi cat >conftest.c << EOF #include int main() { #ifdef __i386__ printf("386\n"); #endif return 0; } EOF $CC conftest.c -c -o conftest.o $CC conftest.o -o conftest ./conftest >conftest.file if grep 386 conftest.file >/dev/null; then HAVEI386=y echo "You seem to be using a x86 CPU" else echo "No special hacks for your CPU, sorry." fi rm -f conftest* if [[ "$HAVEGCC27" = "y" -a "$HAVEI386" = "y" ]]; then # Don't want strength-reduce on the i386, makes the code slower usually. CFLAGS="$CFLAGS -fno-strength-reduce -DREGPARAM=\"__attribute__((regparm(3)))\"" elif [[ "$TARGET" = "amigaos" ]]; then CFLAGS="$CFLAGS -DREGPARAM=\"__attribute__((regargs(4)))\" " else CFLAGS="$CFLAGS -DREGPARAM=" fi CC=$CXX AC_SUBST(TARGET) AC_SUBST(SET_MAKE) AC_SUBST(top_srcdir) AC_SUBST(HPUX_REV) AC_SUBST(KBD_LANG) dnl Generate Makefile. AC_CONFIG_FILES([Makefile]) AC_OUTPUT dnl Print summary. echo echo "Configuration done. Now type \"make\"."