| 1 |
dnl Init. |
| 2 |
AC_INIT(dosbox,0.74-3) |
| 3 |
AC_PREREQ(2.50) |
| 4 |
AC_CONFIG_SRCDIR(README) |
| 5 |
|
| 6 |
dnl Detect the canonical host and target build environment |
| 7 |
AC_CANONICAL_HOST |
| 8 |
AC_CANONICAL_BUILD |
| 9 |
|
| 10 |
dnl Setup for automake |
| 11 |
AM_INIT_AUTOMAKE |
| 12 |
AC_CONFIG_HEADER(config.h) |
| 13 |
|
| 14 |
dnl Checks for programs. |
| 15 |
AC_PROG_MAKE_SET |
| 16 |
AC_PROG_CC |
| 17 |
AC_PROG_CPP |
| 18 |
AC_PROG_CXX |
| 19 |
AC_PROG_INSTALL |
| 20 |
AC_PROG_RANLIB |
| 21 |
|
| 22 |
dnl Some needed libaries for OS2 |
| 23 |
dnl perharps join this with the other target depended checks. move them upwards |
| 24 |
if test x$host = xi386-pc-os2-emx ; then |
| 25 |
CXXFLAGS="$CXXFLAGS -Zmt" |
| 26 |
LDFLAGS="$LDFLAGS -Zomf -Zmt" |
| 27 |
fi |
| 28 |
|
| 29 |
dnl Check for SDL |
| 30 |
SDL_VERSION=1.2.0 |
| 31 |
AM_PATH_SDL($SDL_VERSION, |
| 32 |
:, |
| 33 |
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) |
| 34 |
) |
| 35 |
LIBS="$LIBS $SDL_LIBS" |
| 36 |
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" |
| 37 |
|
| 38 |
dnl Check if SDL is 1.2.x (1.3 not supported) |
| 39 |
AC_MSG_CHECKING([SDL version only being 1.2.X]) |
| 40 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ |
| 41 |
#include "SDL.h" |
| 42 |
void blah(){ |
| 43 |
#if SDL_MINOR_VERSION != 2 |
| 44 |
#error "Only SDL 1.2 supported" |
| 45 |
#endif |
| 46 |
; |
| 47 |
} |
| 48 |
])],AC_MSG_RESULT([yes]),[ |
| 49 |
AC_MSG_RESULT([no]) |
| 50 |
AC_MSG_ERROR([Only libSDL 1.2.X supported])]) |
| 51 |
|
| 52 |
dnl Checks for header files. |
| 53 |
|
| 54 |
dnl Checks for typedefs, structures, and compiler characteristics. |
| 55 |
AC_C_CONST |
| 56 |
AC_C_INLINE |
| 57 |
AC_TYPE_SIZE_T |
| 58 |
AC_STRUCT_TM |
| 59 |
AC_CHECK_SIZEOF(unsigned char) |
| 60 |
AC_CHECK_SIZEOF(unsigned short) |
| 61 |
AC_CHECK_SIZEOF(unsigned int) |
| 62 |
AC_CHECK_SIZEOF(unsigned long) |
| 63 |
AC_CHECK_SIZEOF(unsigned long long) |
| 64 |
AC_CHECK_SIZEOF(int *) |
| 65 |
|
| 66 |
dnl some semi complex check for sys/socket so it works on darwin as well |
| 67 |
AC_CHECK_HEADERS([stdlib.h sys/types.h]) |
| 68 |
AC_CHECK_HEADERS([sys/socket.h netinet/in.h pwd.h], [], [], |
| 69 |
[#include <stdio.h> |
| 70 |
#ifdef STDC_HEADERS |
| 71 |
# include <stdlib.h> |
| 72 |
# include <stddef.h> |
| 73 |
#else |
| 74 |
# ifdef HAVE_STDLIB_H |
| 75 |
# include <stdlib.h> |
| 76 |
# endif |
| 77 |
#endif |
| 78 |
#ifdef HAVE_SYS_TYPES_H |
| 79 |
# include <sys/types.h> |
| 80 |
#endif |
| 81 |
]) |
| 82 |
|
| 83 |
dnl check for the socklen_t (darwin doesn't always have it) |
| 84 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ |
| 85 |
#include <stdio.h> |
| 86 |
#ifdef STDC_HEADERS |
| 87 |
# include <stdlib.h> |
| 88 |
# include <stddef.h> |
| 89 |
#else |
| 90 |
# ifdef HAVE_STDLIB_H |
| 91 |
# include <stdlib.h> |
| 92 |
# endif |
| 93 |
#endif |
| 94 |
#ifdef HAVE_SYS_TYPES_H |
| 95 |
# include <sys/types.h> |
| 96 |
#endif |
| 97 |
#ifdef HAVE_SYS_SOCKET_H |
| 98 |
#include <sys/socket.h> |
| 99 |
#endif |
| 100 |
])],[],[AC_DEFINE([socklen_t],[int],[Define to `int` if you don't have socklen_t])]) |
| 101 |
|
| 102 |
AC_MSG_CHECKING(if environ can be included) |
| 103 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 104 |
#include <unistd.h> |
| 105 |
#include <stdlib.h>]],[[*environ;]])], |
| 106 |
[AC_MSG_RESULT(yes);AC_DEFINE(ENVIRON_INCLUDED,1,[environ can be included])],AC_MSG_RESULT(no)) |
| 107 |
|
| 108 |
AC_MSG_CHECKING(if environ can be linked) |
| 109 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char ** environ;]],[[*environ;]])], |
| 110 |
[AC_MSG_RESULT(yes);AC_DEFINE(ENVIRON_LINKED,1,[environ can be linked])],AC_MSG_RESULT(no)) |
| 111 |
|
| 112 |
AC_MSG_CHECKING([if dirent includes d_type]) |
| 113 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ |
| 114 |
#include <sys/types.h> |
| 115 |
#include <dirent.h> |
| 116 |
void blah(){ |
| 117 |
struct dirent d_test; |
| 118 |
d_test.d_type = 0; |
| 119 |
}])],[AC_MSG_RESULT(yes);AC_DEFINE(DIRENT_HAS_D_TYPE,1,[struct dirent has d_type])],AC_MSG_RESULT(no)) |
| 120 |
|
| 121 |
|
| 122 |
dnl Check for powf |
| 123 |
AC_MSG_CHECKING(for powf in libm); |
| 124 |
LIBS_BACKUP=$LIBS; |
| 125 |
LIBS="$LIBS -lm"; |
| 126 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],[[ |
| 127 |
powf(1.0f, 1.0f); |
| 128 |
]])], [AC_MSG_RESULT(yes)], [AC_DEFINE([DB_HAVE_NO_POWF],[1],[libm doesn't include powf])]) |
| 129 |
LIBS=$LIBS_BACKUP |
| 130 |
|
| 131 |
|
| 132 |
dnl Checks for libraries. |
| 133 |
|
| 134 |
#Check if the compiler support attributes |
| 135 |
AH_TEMPLATE([C_HAS_ATTRIBUTE],[Determines if the compilers supports attributes for structures.]) |
| 136 |
AC_MSG_CHECKING(if compiler allows __attribute__) |
| 137 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 138 |
typedef struct { } __attribute__((packed)) junk;]], |
| 139 |
[[ ]])],[ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_ATTRIBUTE)],AC_MSG_RESULT(no)) |
| 140 |
|
| 141 |
|
| 142 |
#Check if the compiler supports certain attributes |
| 143 |
OLDCFLAGS="$CFLAGS" |
| 144 |
CFLAGS="-Werror" |
| 145 |
|
| 146 |
AH_TEMPLATE([C_ATTRIBUTE_ALWAYS_INLINE],[Determines if the compilers supports always_inline attribute.]) |
| 147 |
AC_MSG_CHECKING(if compiler allows __attribute__((always_inline)) ) |
| 148 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ inline void __attribute__((always_inline)) test(){} |
| 149 |
])],[ AC_MSG_RESULT(yes);AC_DEFINE(C_ATTRIBUTE_ALWAYS_INLINE)],AC_MSG_RESULT(no)) |
| 150 |
|
| 151 |
AH_TEMPLATE([C_ATTRIBUTE_FASTCALL],[Determines if the compilers supports fastcall attribute.]) |
| 152 |
AC_MSG_CHECKING(if compiler allows __attribute__((fastcall)) ) |
| 153 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ void __attribute__((fastcall)) test(){} |
| 154 |
])],[ AC_MSG_RESULT(yes);AC_DEFINE(C_ATTRIBUTE_FASTCALL)],AC_MSG_RESULT(no)) |
| 155 |
|
| 156 |
|
| 157 |
CFLAGS="$OLDCFLAGS" |
| 158 |
|
| 159 |
|
| 160 |
#Check if the compiler supports __builtin_expect |
| 161 |
#Switch language to c++ |
| 162 |
AC_LANG_PUSH(C++) |
| 163 |
AH_TEMPLATE([C_HAS_BUILTIN_EXPECT],[Determines if the compilers supports __builtin_expect for branch prediction.]) |
| 164 |
AC_MSG_CHECKING(if compiler allows __builtin_expect) |
| 165 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[ |
| 166 |
int x=10;if( __builtin_expect ((x==1),0) ) ; |
| 167 |
]])], [ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_BUILTIN_EXPECT)],AC_MSG_RESULT(no)) |
| 168 |
#switch language back |
| 169 |
AC_LANG_POP(C++) |
| 170 |
|
| 171 |
dnl test if compiler supports -mno-ms-bitfields as it is bugged |
| 172 |
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 |
| 173 |
BACKUP_CFLAGS="$CFLAGS" |
| 174 |
CFLAGS="-mno-ms-bitfields" |
| 175 |
AC_MSG_CHECKING(if compiler supports -mno-ms-bitfields) |
| 176 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ |
| 177 |
void blah(){ |
| 178 |
; |
| 179 |
} |
| 180 |
])],[ |
| 181 |
AC_MSG_RESULT([yes]) |
| 182 |
CXXFLAGS="$CXXFLAGS -mno-ms-bitfields" |
| 183 |
],[AC_MSG_RESULT([no])]) |
| 184 |
CFLAGS="$BACKUP_CFLAGS" |
| 185 |
|
| 186 |
dnl enable disable alsa and pass it's cflags to CXXFLAGS |
| 187 |
AC_ARG_ENABLE(alsa-midi, |
| 188 |
AC_HELP_STRING([--enable-alsa-midi],[compile with alsa midi support (default yes)]), |
| 189 |
[ case "${enableval}" in |
| 190 |
yes) alsa_midi=true;; |
| 191 |
no) alsa_midi=false;; |
| 192 |
esac], |
| 193 |
[alsa_midi=true]) |
| 194 |
if test x$alsa_midi = xtrue ; then |
| 195 |
AM_PATH_ALSA(0.9.0, AC_DEFINE(HAVE_ALSA,1,[Define to 1 to use ALSA for MIDI]) , : ) |
| 196 |
CXXFLAGS="$CXXFLAGS $ALSA_CFLAGS" |
| 197 |
fi |
| 198 |
|
| 199 |
#Check for big endian machine, should #define WORDS_BIGENDIAN if so |
| 200 |
AC_C_BIGENDIAN |
| 201 |
|
| 202 |
#Features to enable/disable |
| 203 |
AH_TEMPLATE(C_DEBUG,[Define to 1 to enable internal debugger, requires libcurses]) |
| 204 |
AH_TEMPLATE(C_HEAVY_DEBUG,[Define to 1 to enable heavy debugging, also have to enable C_DEBUG]) |
| 205 |
AC_ARG_ENABLE(debug,AC_HELP_STRING([--enable-debug],[Enable debug mode]),[ |
| 206 |
AC_CHECK_HEADER(curses.h,have_curses_h=yes,) |
| 207 |
AC_CHECK_LIB(curses, initscr, have_curses_lib=yes, , ) |
| 208 |
AC_CHECK_LIB(ncurses, initscr, have_ncurses_lib=yes, , ) |
| 209 |
AC_CHECK_LIB(pdcurses, initscr, have_pdcurses_lib=yes, , ) |
| 210 |
|
| 211 |
if test x$enable_debug = xno; then |
| 212 |
AC_MSG_RESULT([Debugger not enabled]) |
| 213 |
elif test x$have_ncurses_lib = xyes -a x$have_curses_h = xyes ; then |
| 214 |
LIBS="$LIBS -lncurses" |
| 215 |
AC_DEFINE(C_DEBUG,1) |
| 216 |
if test x$enable_debug = xheavy ; then |
| 217 |
AC_DEFINE(C_HEAVY_DEBUG,1) |
| 218 |
fi |
| 219 |
elif test x$have_curses_lib = xyes -a x$have_curses_h = xyes ; then |
| 220 |
LIBS="$LIBS -lcurses" |
| 221 |
AC_DEFINE(C_DEBUG,1) |
| 222 |
if test x$enable_debug = xheavy ; then |
| 223 |
AC_DEFINE(C_HEAVY_DEBUG,1) |
| 224 |
fi |
| 225 |
elif test x$have_pdcurses_lib = xyes -a x$have_curses_h = xyes ; then |
| 226 |
LIBS="$LIBS -lpdcurses" |
| 227 |
AC_DEFINE(C_DEBUG,1) |
| 228 |
if test x$enable_debug = xheavy ; then |
| 229 |
AC_DEFINE(C_HEAVY_DEBUG,1) |
| 230 |
fi |
| 231 |
else |
| 232 |
AC_MSG_ERROR([Can't find curses, which is required for debug mode]) |
| 233 |
fi |
| 234 |
],) |
| 235 |
|
| 236 |
AH_TEMPLATE(C_CORE_INLINE,[Define to 1 to use inlined memory functions in cpu core]) |
| 237 |
AC_ARG_ENABLE(core-inline,AC_HELP_STRING([--enable-core-inline],[Enable inlined memory handling in CPU Core]),[ |
| 238 |
if test x$enable_core_inline = xyes ; then |
| 239 |
AC_MSG_RESULT([enabling inlined memory handling in CPU Core]) |
| 240 |
AC_DEFINE(C_CORE_INLINE,1) |
| 241 |
fi |
| 242 |
],) |
| 243 |
|
| 244 |
|
| 245 |
dnl The target cpu checks for dynamic cores |
| 246 |
AH_TEMPLATE(C_TARGETCPU,[The type of cpu this target has]) |
| 247 |
AC_MSG_CHECKING(for target cpu type) |
| 248 |
case "$host_cpu" in |
| 249 |
x86_64 | amd64) |
| 250 |
AC_DEFINE(C_TARGETCPU,X86_64) |
| 251 |
AC_MSG_RESULT(x86-64 bit compatible) |
| 252 |
c_targetcpu="x86_64" |
| 253 |
c_unalignedmemory=yes |
| 254 |
;; |
| 255 |
i?86) |
| 256 |
AC_DEFINE(C_TARGETCPU,X86) |
| 257 |
AC_MSG_RESULT(x86 compatible) |
| 258 |
c_targetcpu="x86" |
| 259 |
c_unalignedmemory=yes |
| 260 |
;; |
| 261 |
powerpc*) |
| 262 |
AC_DEFINE(C_TARGETCPU,POWERPC) |
| 263 |
AC_MSG_RESULT(Power PC) |
| 264 |
c_targetcpu="powerpc" |
| 265 |
c_unalignedmemory=yes |
| 266 |
;; |
| 267 |
m68k*) |
| 268 |
AC_DEFINE(C_TARGETCPU,M68K) |
| 269 |
AC_MSG_RESULT(Motorola 68000) |
| 270 |
c_targetcpu="m68k" |
| 271 |
c_unalignedmemory=yes |
| 272 |
;; |
| 273 |
*) |
| 274 |
AC_DEFINE(C_TARGETCPU,UNKNOWN) |
| 275 |
AC_MSG_RESULT(unknown) |
| 276 |
c_unalignedmemory=no |
| 277 |
;; |
| 278 |
esac |
| 279 |
|
| 280 |
dnl check for size of pointer being 4 |
| 281 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ |
| 282 |
#if SIZEOF_INT_P != 4 |
| 283 |
#error size intp is not 4, this not something to worry about |
| 284 |
#endif |
| 285 |
void blah() { |
| 286 |
; |
| 287 |
} |
| 288 |
])],[c_sizep=4],[c_sizep=0]) |
| 289 |
|
| 290 |
|
| 291 |
dnl automake 1.14 and upwards rewrite the host to have always 64 bit unless i386 as host is passed |
| 292 |
dnl this can make building a 32 bit executable a bit tricky, as dosbox relies on the host to select the |
| 293 |
dnl dynamic/dynrec core |
| 294 |
AC_MSG_CHECKING([whether Apple user wants to override the build process to produce a 32 bit binary]) |
| 295 |
case "$host" in |
| 296 |
*-*-darwin*) |
| 297 |
if test x$c_targetcpu = xx86_64 -a x$c_sizep = x4 ; then |
| 298 |
AC_MSG_RESULT(yes) |
| 299 |
AC_DEFINE(C_TARGETCPU,X86) |
| 300 |
c_targetcpu="x86" |
| 301 |
else |
| 302 |
AC_MSG_RESULT(no) |
| 303 |
fi |
| 304 |
;; |
| 305 |
*) |
| 306 |
AC_MSG_RESULT([no, not on Apple]) |
| 307 |
;; |
| 308 |
esac |
| 309 |
|
| 310 |
AC_ARG_ENABLE(dynamic-core,AC_HELP_STRING([--disable-dynamic-core],[Disable all dynamic cores]),,enable_dynamic_core=yes) |
| 311 |
|
| 312 |
AH_TEMPLATE(C_DYNAMIC_X86,[Define to 1 to use x86 dynamic cpu core]) |
| 313 |
AC_ARG_ENABLE(dynamic-x86,AC_HELP_STRING([--disable-dynamic-x86],[Disable x86 dynamic cpu core]),,enable_dynamic_x86=yes) |
| 314 |
AC_MSG_CHECKING(whether x86 dynamic cpu core will be enabled) |
| 315 |
if test x$enable_dynamic_x86 = xno -o x$enable_dynamic_core = xno; then |
| 316 |
AC_MSG_RESULT(no) |
| 317 |
else |
| 318 |
if test x$c_targetcpu = xx86 ; then |
| 319 |
AC_DEFINE(C_DYNAMIC_X86,1) |
| 320 |
AC_MSG_RESULT(yes) |
| 321 |
else |
| 322 |
AC_MSG_RESULT(no) |
| 323 |
fi |
| 324 |
fi |
| 325 |
|
| 326 |
AH_TEMPLATE(C_DYNREC,[Define to 1 to use recompiling cpu core. Can not be used together with the dynamic-x86 core]) |
| 327 |
AC_ARG_ENABLE(dynrec,AC_HELP_STRING([--disable-dynrec],[Disable recompiling cpu core]),,enable_dynrec=yes) |
| 328 |
AC_MSG_CHECKING(whether recompiling cpu core will be enabled) |
| 329 |
if test x$enable_dynrec = xno -o x$enable_dynamic_core = xno; then |
| 330 |
AC_MSG_RESULT(no) |
| 331 |
else |
| 332 |
dnl x86 only enable it if dynamic-x86 is disabled. |
| 333 |
if test x$c_targetcpu = xx86 ; then |
| 334 |
if test x$enable_dynamic_x86 = xno ; then |
| 335 |
AC_DEFINE(C_DYNREC,1) |
| 336 |
AC_MSG_RESULT(yes) |
| 337 |
else |
| 338 |
AC_MSG_RESULT([no, using dynamic-x86]) |
| 339 |
fi |
| 340 |
else |
| 341 |
if test x$c_targetcpu = xx86_64 ; then |
| 342 |
AC_DEFINE(C_DYNREC,1) |
| 343 |
AC_MSG_RESULT(yes) |
| 344 |
else |
| 345 |
AC_MSG_RESULT(no) |
| 346 |
fi |
| 347 |
fi |
| 348 |
fi |
| 349 |
|
| 350 |
AH_TEMPLATE(C_FPU,[Define to 1 to enable floating point emulation]) |
| 351 |
AC_ARG_ENABLE(fpu,AC_HELP_STRING([--disable-fpu],[Disable fpu support]),,enable_fpu=yes) |
| 352 |
AC_MSG_CHECKING(whether fpu emulation will be enabled) |
| 353 |
if test x$enable_fpu = xyes ; then |
| 354 |
AC_MSG_RESULT(yes) |
| 355 |
AC_DEFINE(C_FPU,1) |
| 356 |
else |
| 357 |
AC_MSG_RESULT(no) |
| 358 |
fi |
| 359 |
|
| 360 |
AH_TEMPLATE(C_FPU_X86,[Define to 1 to use a x86 assembly fpu core]) |
| 361 |
AC_ARG_ENABLE(fpu-x86,AC_HELP_STRING([--disable-fpu-x86],[Disable x86 assembly fpu core]),,enable_fpu_x86=yes) |
| 362 |
AC_MSG_CHECKING(whether x86 assembly fpu core will be enabled) |
| 363 |
if test x$enable_fpu_x86 = xno ; then |
| 364 |
AC_MSG_RESULT(no) |
| 365 |
else |
| 366 |
if test x$enable_fpu = xyes; then |
| 367 |
if test x$c_targetcpu = xx86 ; then |
| 368 |
AC_DEFINE(C_FPU_X86,1) |
| 369 |
AC_MSG_RESULT(yes) |
| 370 |
else |
| 371 |
AC_MSG_RESULT(no) |
| 372 |
fi |
| 373 |
else |
| 374 |
AC_MSG_RESULT(no) |
| 375 |
fi |
| 376 |
fi |
| 377 |
|
| 378 |
AH_TEMPLATE(C_UNALIGNED_MEMORY,[Define to 1 to use a unaligned memory access]) |
| 379 |
AC_ARG_ENABLE(unaligned_memory,AC_HELP_STRING([--disable-unaligned-memory],[Disable unaligned memory access]),,enable_unaligned_memory=yes) |
| 380 |
AC_MSG_CHECKING(whether to enable unaligned memory access) |
| 381 |
if test x$enable_unaligned_memory = xyes -a x$c_unalignedmemory = xyes; then |
| 382 |
AC_DEFINE(C_UNALIGNED_MEMORY,1) |
| 383 |
AC_MSG_RESULT(yes) |
| 384 |
else |
| 385 |
AC_MSG_RESULT(no) |
| 386 |
fi |
| 387 |
|
| 388 |
AH_TEMPLATE(C_SSHOT,[Define to 1 to enable screenshots, requires libpng]) |
| 389 |
AC_CHECK_HEADER(png.h,have_png_h=yes,) |
| 390 |
AC_CHECK_LIB(png, png_get_io_ptr, have_png_lib=yes, ,-lz) |
| 391 |
if test x$have_png_lib = xyes -a x$have_png_h = xyes ; then |
| 392 |
LIBS="$LIBS -lpng -lz" |
| 393 |
AC_DEFINE(C_SSHOT,1) |
| 394 |
else |
| 395 |
AC_MSG_WARN([Can't find libpng, screenshot support disabled]) |
| 396 |
fi |
| 397 |
|
| 398 |
AH_TEMPLATE(C_MODEM,[Define to 1 to enable internal modem support, requires SDL_net]) |
| 399 |
AH_TEMPLATE(C_IPX,[Define to 1 to enable IPX over Internet networking, requires SDL_net]) |
| 400 |
AC_CHECK_HEADER(SDL_net.h,have_sdl_net_h=yes,) |
| 401 |
|
| 402 |
if test x$host = xi386-pc-os2-emx ; then |
| 403 |
AC_MSG_CHECKING(for SDLNet_Init in SDL_net); |
| 404 |
LIBS_BACKUP=$LIBS; |
| 405 |
LIBS="$LIBS -lSDL_Net"; |
| 406 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <SDL_Net.h>]],[[ |
| 407 |
SDLNet_Init (); |
| 408 |
]])], [AC_MSG_RESULT(yes); have_sdl_net_lib=yes], AC_MSG_RESULT(no)) |
| 409 |
LIBS=$LIBS_BACKUP |
| 410 |
else |
| 411 |
AC_CHECK_LIB(SDL_net, SDLNet_Init, have_sdl_net_lib=yes, , ) |
| 412 |
fi |
| 413 |
if test x$have_sdl_net_lib = xyes -a x$have_sdl_net_h = xyes ; then |
| 414 |
LIBS="$LIBS -lSDL_net" |
| 415 |
AC_DEFINE(C_MODEM,1) |
| 416 |
AC_DEFINE(C_IPX,1) |
| 417 |
else |
| 418 |
AC_MSG_WARN([Can't find SDL_net, internal modem and ipx disabled]) |
| 419 |
fi |
| 420 |
|
| 421 |
AH_TEMPLATE(C_X11_XKB,[define to 1 if you have XKBlib.h and X11 lib]) |
| 422 |
AC_CHECK_LIB(X11, main, have_x11_lib=yes, have_x11_lib=no, ) |
| 423 |
AC_CHECK_HEADER(X11/XKBlib.h, have_x11_h=yes, have_x11_h=no, ) |
| 424 |
AC_MSG_CHECKING(for XKBlib support) |
| 425 |
if test x$have_x11_lib = xyes -a x$have_x11_h = xyes ; then |
| 426 |
LIBS="$LIBS -lX11" |
| 427 |
AC_DEFINE(C_X11_XKB,1) |
| 428 |
AC_MSG_RESULT(yes) |
| 429 |
else |
| 430 |
AC_MSG_RESULT(no) |
| 431 |
fi |
| 432 |
|
| 433 |
AH_TEMPLATE(C_OPENGL,[Define to 1 to use opengl display output support]) |
| 434 |
AC_CHECK_LIB(GL, main, have_gl_lib=yes, have_gl_lib=no , ) |
| 435 |
AC_CHECK_LIB(opengl32, main, have_opengl32_lib=yes,have_opengl32_lib=no , ) |
| 436 |
AC_CHECK_HEADER(GL/gl.h, have_gl_h=yes , have_gl_h=no , ) |
| 437 |
AC_ARG_ENABLE(opengl,AC_HELP_STRING([--disable-opengl],[Disable opengl support]),,enable_opengl=yes) |
| 438 |
AC_MSG_CHECKING(whether opengl display output will be enabled) |
| 439 |
if test x$enable_opengl = xyes; then |
| 440 |
case "$host" in |
| 441 |
*-*-darwin*) |
| 442 |
AC_MSG_RESULT(yes) |
| 443 |
LIBS="$LIBS -framework OpenGL" |
| 444 |
AC_DEFINE(C_OPENGL,1) |
| 445 |
;; |
| 446 |
*) |
| 447 |
if test x$have_gl_h = xyes -a x$have_gl_lib = xyes ; then |
| 448 |
AC_MSG_RESULT(yes) |
| 449 |
LIBS="$LIBS -lGL" |
| 450 |
AC_DEFINE(C_OPENGL,1) |
| 451 |
elif test x$have_gl_h = xyes -a x$have_opengl32_lib = xyes ; then |
| 452 |
AC_MSG_RESULT(yes) |
| 453 |
LIBS="$LIBS -lopengl32" |
| 454 |
AC_DEFINE(C_OPENGL,1) |
| 455 |
else |
| 456 |
AC_MSG_RESULT(no) |
| 457 |
fi |
| 458 |
;; |
| 459 |
esac |
| 460 |
else |
| 461 |
AC_MSG_RESULT(no) |
| 462 |
fi |
| 463 |
|
| 464 |
AH_TEMPLATE(C_SDL_SOUND,[Define to 1 to enable SDL_sound support]) |
| 465 |
AC_CHECK_HEADER(SDL_sound.h,have_SDL_sound_h=yes,) |
| 466 |
AC_CHECK_LIB(SDL_sound, Sound_Init, have_SDL_sound_init=yes,,) |
| 467 |
AC_CHECK_LIB(SDL_sound, Sound_Seek, have_SDL_sound_seek=yes,,) |
| 468 |
if test x$have_SDL_sound_h = xyes -a x$have_SDL_sound_init = xyes ; then |
| 469 |
if test x$have_SDL_sound_seek = xyes ; then |
| 470 |
LIBS="-lSDL_sound $LIBS" |
| 471 |
AC_DEFINE(C_SDL_SOUND,1) |
| 472 |
else |
| 473 |
AC_MSG_WARN([Can't find SoundSeek in libSDL_Sound, libSDL_sound support disabled]) |
| 474 |
fi |
| 475 |
else |
| 476 |
AC_MSG_WARN([Can't find libSDL_sound, libSDL_sound support disabled]) |
| 477 |
fi |
| 478 |
|
| 479 |
dnl Check for mprotect. Needed for 64 bits linux |
| 480 |
AH_TEMPLATE(C_HAVE_MPROTECT,[Define to 1 if you have the mprotect function]) |
| 481 |
AC_CHECK_HEADER([sys/mman.h], [ |
| 482 |
AC_CHECK_FUNC([mprotect],[AC_DEFINE(C_HAVE_MPROTECT,1)]) |
| 483 |
]) |
| 484 |
|
| 485 |
dnl Check for realpath. Used on Linux |
| 486 |
AC_CHECK_FUNCS([realpath]) |
| 487 |
|
| 488 |
dnl Setpriority |
| 489 |
AH_TEMPLATE(C_SET_PRIORITY,[Define to 1 if you have setpriority support]) |
| 490 |
AC_MSG_CHECKING(for setpriority support) |
| 491 |
AC_LINK_IFELSE([AC_LANG_SOURCE([ |
| 492 |
#include <sys/resource.h> |
| 493 |
int main(int argc,char * argv[]) { |
| 494 |
return setpriority (PRIO_PROCESS, 0,PRIO_MIN+PRIO_MAX); |
| 495 |
}; |
| 496 |
])],AC_MSG_RESULT(yes);AC_DEFINE(C_SET_PRIORITY,1),AC_MSG_RESULT(no)) |
| 497 |
|
| 498 |
|
| 499 |
dnl Some target detection and actions for them |
| 500 |
case "$host" in |
| 501 |
*-*-cygwin* | *-*-mingw32*) |
| 502 |
LIBS="$LIBS -lwinmm" |
| 503 |
AC_CHECK_HEADERS(ddraw.h) |
| 504 |
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial passthrough support (Win32, Posix and OS/2 only).]) |
| 505 |
if test x$have_sdl_net_lib = xyes -a x$have_sdl_net_h = xyes ; then |
| 506 |
LIBS="$LIBS -lws2_32" |
| 507 |
fi |
| 508 |
;; |
| 509 |
*-*-darwin*) |
| 510 |
dnl We have a problem here: both Mac OS X and Darwin report |
| 511 |
dnl the same signature "powerpc-apple-darwin*" - so we have |
| 512 |
dnl to do more to distinguish them. |
| 513 |
dnl For now I am lazy and do not add proper detection code. |
| 514 |
AC_DEFINE(MACOSX, 1, [Compiling on Mac OS X]) |
| 515 |
LIBS="$LIBS -framework CoreMIDI -framework AudioUnit -framework AudioToolbox" |
| 516 |
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial passthrough support (Win32, Posix and OS/2).]) |
| 517 |
;; |
| 518 |
*-*-linux*) |
| 519 |
AC_DEFINE(LINUX, 1, [Compiling on GNU/Linux]) |
| 520 |
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial passthrough support (Win32, Posix and OS/2).]) |
| 521 |
;; |
| 522 |
*-*-freebsd* | *-*-dragonfly* | *-*-netbsd* | *-*-openbsd*) |
| 523 |
dnl Disabled directserial for now. It doesn't do anything without |
| 524 |
dnl specifying an extra ifdef in directserial_posix.* |
| 525 |
dnl directserial detection should be rewritten to test for the needed |
| 526 |
dnl functions and headers. I currently do not know |
| 527 |
dnl which ones are needed for BSD |
| 528 |
AC_DEFINE(BSD, 1, [Compiling on BSD]) |
| 529 |
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial passthrough support (Win32, Posix and OS/2).]) |
| 530 |
;; |
| 531 |
*-*-os2-emx*) |
| 532 |
AC_DEFINE(OS2, 1, [Compiling on OS/2 EMX]) |
| 533 |
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial passthrough support (Win32, Posix and OS/2).]) |
| 534 |
;; |
| 535 |
esac |
| 536 |
|
| 537 |
dnl Some stuff for the icon. |
| 538 |
case "$host" in |
| 539 |
*-*-cygwin* | *-*-mingw32*) |
| 540 |
dnl Some stuff for the ico |
| 541 |
AC_CHECK_TOOL(WINDRES, windres, :) |
| 542 |
;; |
| 543 |
*) |
| 544 |
WINDRES=":" |
| 545 |
;; |
| 546 |
esac |
| 547 |
AM_CONDITIONAL(HAVE_WINDRES, test "x$WINDRES" != "x:") |
| 548 |
AC_SUBST(WINDRES) |
| 549 |
|
| 550 |
|
| 551 |
AC_CONFIG_FILES([ |
| 552 |
Makefile |
| 553 |
src/Makefile |
| 554 |
src/cpu/Makefile |
| 555 |
src/cpu/core_full/Makefile |
| 556 |
src/cpu/core_normal/Makefile |
| 557 |
src/cpu/core_dyn_x86/Makefile |
| 558 |
src/cpu/core_dynrec/Makefile |
| 559 |
src/debug/Makefile |
| 560 |
src/dos/Makefile |
| 561 |
src/fpu/Makefile |
| 562 |
src/gui/Makefile |
| 563 |
src/hardware/Makefile |
| 564 |
src/hardware/mame/Makefile |
| 565 |
src/hardware/serialport/Makefile |
| 566 |
src/ints/Makefile |
| 567 |
src/libs/Makefile |
| 568 |
src/libs/zmbv/Makefile |
| 569 |
src/libs/gui_tk/Makefile |
| 570 |
src/misc/Makefile |
| 571 |
src/shell/Makefile |
| 572 |
src/platform/Makefile |
| 573 |
src/platform/visualc/Makefile |
| 574 |
visualc_net/Makefile |
| 575 |
include/Makefile |
| 576 |
docs/Makefile |
| 577 |
]) |
| 578 |
AC_OUTPUT |