1AC_PREREQ(2.50) 2dnl AC_INIT(src/powermanga.c) 3AC_INIT([Powermanga], [0.93.1], [http://sf.net/projects/powermanga/bugs], [powermanga]) 4AC_CONFIG_AUX_DIR(autotools) 5AC_CANONICAL_SYSTEM 6#AM_INIT_AUTOMAKE(powermanga,0.90) 7AM_INIT_AUTOMAKE([foreign]) 8AC_CONFIG_HEADER(config.h) 9 10dnl Check our build tools 11AC_PROG_CC 12AM_PROG_AS 13AC_HEADER_STDC 14AC_CHECK_HEADERS([fcntl.h stdlib.h unistd.h]) 15 16AC_ARG_ENABLE(x11, 17[ --enable-x11 X11 support (default disabled)], 18enable_x11=yes, enable_x11=no) 19AC_ARG_ENABLE(devel, 20[ --enable-devel Development version (default disabled)], 21enable_devel=yes, enable_devel=no) 22AC_ARG_ENABLE(sound, 23[ --disable-sound Disable sound], 24disable_sound=yes, disable_sound=no) 25AC_ARG_ENABLE(pngexport, 26[ --disable-pngexport Disables the option to export the sprites in PNG], 27disable_png_export=yes, disable_png_export=no) 28 29 30dnl Check for X 31if test "x${enable_x11}" = "xyes"; then 32 AC_MSG_RESULT([Use the Xlib library for display]); 33 AC_DEFINE(POWERMANGA_X11, 1, Define to enable X11 support) 34 AC_PATH_X 35 XLIB_CFLAGS="-I${x_includes}" 36 AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [ 37 XLIB_LIBS="-lXext -lX11 -lXxf86dga" 38 ],[ 39 AC_MSG_ERROR(Could not find -lXext -lX11) 40 ]) 41 AC_SUBST(XLIB_CFLAGS) 42 AC_SUBST(XLIB_LIBS) 43else 44 AC_DEFINE(POWERMANGA_SDL, 1, Define to enable SDL support) 45 AC_MSG_RESULT([Use the SDL for display]); 46fi 47 48dnl Check for SDL 49AM_PATH_SDL 50 51if test "x${enable_devel}" = "xyes"; then 52 dnl If defined [Ctrl] + [V], [Ctrl] + [P], [Ctrl] + [B] are available 53 AC_DEFINE(UNDER_DEVELOPMENT, 1, Define to enable development version) 54 AC_DEFINE(USE_MALLOC_WRAPPER, 1, Define to use a malloc wrapper) 55 CFLAGS="-Wall -pedantic -Wextra -std=gnu99 -g $CFLAGS" 56else 57 CFLAGS=" -Wall -Wextra -std=gnu99 $CFLAGS" 58fi 59 60dnl Check for SDL_mixer 61dnl LDFLAGS_save="${LDFLAGS} ${SDL_LIBS}" 62 63if test "x${disable_sound}" = "xno"; then 64 AC_DEFINE(USE_SDLMIXER, 1, [Enable sound (SDL Mixer)]) 65 AC_CHECK_LIB(SDL_mixer, Mix_GetChunk, [ 66 SDL_LIBS="-lSDL_mixer ${SDL_LIBS}" 67 ],[ 68 AC_MSG_ERROR(Could not find -lSDL_mixer) 69]) 70else 71 AC_MSG_RESULT([The sound has been disabled]); 72fi 73 74dnl ttf and sdl_image for shareware version only 75dnl AC_CHECK_LIB(SDL_ttf,TTF_Init,,[AC_MSG_ERROR([SDL_ttf])]) 76dnl SDL_LIBS="$SDL_LIBS -lSDL_ttf" 77dnl AC_CHECK_LIB(SDL_image, main, LIBS="$SDL_LIBS -lSDL_image", AC_MSG_ERROR([*** SDL_image library not found!]) 78dnl ) 79dnl AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR([*** zlib is missing])) 80 81dnl Check for PNG 82if test "x${disable_png_export}" = "xno"; then 83 AC_DEFINE(PNG_EXPORT_ENABLE, 1, [Enable option to export sprites to PNG)]) 84 AC_CHECK_HEADER(png.h,, 85 AC_MSG_ERROR([no png.h; please install libpng12-dev or equivalent])) 86 AC_CHECK_LIB(png, main, [ 87 LDFLAGS="-lpng ${LDFLAGS}" 88 SDL_LIBS="-lpng ${SDL_LIBS}" 89 ],[ 90 AC_MSG_ERROR(Could not find -lpng) 91 ]) 92fi 93 94dnl Check for asm support 95AC_MSG_CHECKING(for x86 assembly support for arch ${target_cpu}) 96case "${target_cpu}" in 97 i*86) ac_cv_need_asm=yes ;; 98 *) ac_cv_need_asm=no ;; 99esac 100ac_cv_need_asm=no 101AC_MSG_RESULT(${ac_cv_need_asm}) 102AM_CONDITIONAL(ASSEMBLY, test "${ac_cv_need_asm}" = "yes") 103 104AC_C_RESTRICT 105 106dnl Output makefiles 107AC_OUTPUT( 108 Makefile 109 data/curves/Makefile 110 data/levels/curves_phase/Makefile 111 data/levels/grids_phase/Makefile 112 data/Makefile 113 graphics/Makefile 114 graphics/bitmap/Makefile 115 graphics/bitmap/fonts/Makefile 116 graphics/sprites/Makefile 117 graphics/sprites/guardians/Makefile 118 graphics/sprites/spaceships/Makefile 119 graphics/sprites/stars/Makefile 120 graphics/sprites/meteors/Makefile 121 src/Makefile 122 sounds/Makefile 123 sounds/handheld_console/Makefile 124 texts/Makefile) 125 126 127echo " 128 129Powermanga ready for building! 130 131 enable-x11 : $enable_x11 132 enable_devel : $enable_devel 133 disable_sound : $disable_sound 134 disable_png_export: $disable_png_export 135 PNG_EXPORT_ENABLE : $PNG_EXPORT_ENABLE 136 LDFLAGS : $LDFLAGS 137 138Type 'make' to build. 139 140" 141