diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rwxr-xr-x | configure.ac | 99 | ||||
-rw-r--r-- | src/Makefile.am | 8 |
3 files changed, 57 insertions, 56 deletions
@@ -1,3 +1,9 @@ +2006-08-02 Guillaume Melquiond <guillaume.melquiond@gmail.com> + + * configure.ac, src/Makefile.am: Put object files in subdirectories. + Moved compilation flags to configure script. Added library header + checks. + 2006-08-02 Eugenio Favalli <elvenprogrammer@gmail.com> * src/gui/char_select.cpp, src/gui/char_select.h, src/gui/register.cpp, diff --git a/configure.ac b/configure.ac index d8f980d3..4c5a492a 100755 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,6 @@ AC_PREREQ(2.59) AC_INIT([The Mana World], [0.1.0], [elvenprogrammer@gmail.com], [tmw]) +AM_INIT_AUTOMAKE AC_CONFIG_HEADERS([config.h:config.h.in]) AC_LANG_CPLUSPLUS @@ -23,85 +24,83 @@ AC_FUNC_SELECT_ARGTYPES AC_FUNC_VPRINTF AC_CHECK_FUNCS([atexit floor getcwd gethostbyname memset mkdir select socket]) +# Search for *-config +AC_PATH_PROG(SDL_CONFIG, sdl-config) +AC_PATH_PROG(PKG_CONFIG, pkg-config) +AC_PATH_PROG(CURL_CONFIG, curl-config) + # Checks for libraries AC_CHECK_LIB([pthread], [pthread_create], , -AC_MSG_ERROR([ *** Unable to find pthread library ])) +AC_MSG_ERROR([ *** Unable to find pthread library])) AC_CHECK_LIB([guichan], [gcnGuichanVersion], , -AC_MSG_ERROR([ *** Unable to find Guichan library (guichan.sf.net)])) - -#AC_CHECK_LIB([guichan_sdl], [gcnSDL], , -#AC_MSG_ERROR([ *** Unable to find Guichan SDL library (guichan.sf.net)])) +AC_MSG_ERROR([ *** Unable to find Guichan library (http://guichan.sf.net/)])) +AC_CHECK_HEADERS([guichan.hpp], , +AC_MSG_ERROR([ *** Guichan library found but cannot find headers (http://guichan.sf.net/)])) -#AC_CHECK_LIB([guichan_opengl], [gcnOpenGL], , -#AC_MSG_ERROR([ *** Unable to find Guichan OpenGL library (guichan.sf.net)])) +if test -n "$SDL_CONFIG"; then + LIBS="$LIBS `$SDL_CONFIG --libs`" + CPPFLAGS="$CPPFLAGS `$SDL_CONFIG --cflags`" +fi +AC_CHECK_LIB([SDL], [SDL_Init], , +AC_MSG_ERROR([ *** Unable to find SDL library (http://www.libsdl.org/)])) +AC_CHECK_HEADERS([SDL.h], , +AC_MSG_ERROR([ *** SDL library found but cannot find headers (http://www.libsdl.org/)])) AC_CHECK_LIB([physfs], [PHYSFS_init], , -AC_MSG_ERROR([ *** Unable to find PhysFS library (icculus.org/physfs/)])) +AC_MSG_ERROR([ *** Unable to find PhysFS library (http://icculus.org/physfs/)])) +AC_CHECK_HEADERS([physfs.h], , +AC_MSG_ERROR([ *** PhysFS library found but cannot find headers (http://icculus.org/physfs/)])) +if test -n "$CURL_CONFIG"; then + LIBS="$LIBS `$CURL_CONFIG --libs`" + CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`" +fi AC_CHECK_LIB([curl], [curl_global_init], , AC_MSG_ERROR([ *** Unable to find CURL library (http://curl.haxx.se/)])) -CURL_LIBS=" `curl-config --libs`" -CURL_CFLAGS=" `curl-config --cflags` " -AC_SUBST(CURL_LIBS) -AC_SUBST(CURL_CFLAGS) +AC_CHECK_HEADERS([curl/curl.h], , +AC_MSG_ERROR([ *** CURL library found but cannot find headers (http://curl.haxx.se/)])) +if test -n "$PKG_CONFIG"; then + LIBS="$LIBS `$PKG_CONFIG --libs libxml-2.0`" + CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags libxml-2.0`" +fi AC_CHECK_LIB([xml2], [xmlInitParser], , -AC_MSG_ERROR([ *** Unable to find libxml2 library (xmlsoft.org)])) +AC_MSG_ERROR([ *** Unable to find libxml2 library (http://xmlsoft.org/)])) +AC_CHECK_HEADERS([libxml/xmlreader.h], , +AC_MSG_ERROR([ *** libxml2 library found but cannot find headers (http://xmlsoft.org/)])) -AC_CHECK_LIB(SDL_image, IMG_LoadPNG_RW, , -AC_MSG_ERROR([ *** Unable to find SDL_image library with PNG support -(http://www.libsdl.org/projects/SDL_image/)])) +AC_CHECK_LIB([SDL_image], [IMG_LoadPNG_RW], , +AC_MSG_ERROR([ *** Unable to find SDL_image library with PNG support (http://www.libsdl.org/projects/SDL_image/)])) -AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, , -AC_MSG_ERROR([ *** Unable to find SDL_mixer library -(http://www.libsdl.org/projects/SDL_mixer/)])) +AC_CHECK_LIB([guichan_sdl], [gcnSDL], , +AC_MSG_ERROR([ *** Unable to find Guichan SDL library (http://guichan.sf.net/)])) + +AC_CHECK_LIB([SDL_mixer], [Mix_OpenAudio], , +AC_MSG_ERROR([ *** Unable to find SDL_mixer library (http://www.libsdl.org/projects/SDL_mixer/)])) AC_CHECK_LIB([enet], [enet_initialize], , -AC_MSG_ERROR([ *** Unable to find enet library (enet.bespin.org)])) +AC_MSG_ERROR([ *** Unable to find enet library (http://enet.bespin.org/)])) AC_CHECK_LIB(png, png_write_info, , -AC_MSG_ERROR([ *** Unable to find png library])) +AC_MSG_ERROR([ *** Unable to find png library (http://www.libpng.org/)])) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([arpa/inet.h fcntl.h malloc.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h]) -# Check for guichan headers -AC_CHECK_HEADERS([guichan.hpp], , -AC_MSG_ERROR([*** Library found but cannot find headers (guichan.sf.net) *** ])) - -AM_INIT_AUTOMAKE - # Option to enable OpenGL -AC_ARG_WITH(opengl,[ --with-opengl use OpenGL ] ) +AC_ARG_WITH(opengl, AS_HELP_STRING([--with-opengl],[use OpenGL (default is no)])) if test "x$with_opengl" == "xyes"; then - with_opengl=yes - OPENGL_CFLAGS=' -DUSE_OPENGL' - OPENGL_LIBS=' -lGL -lguichan_opengl' - AC_SUBST(OPENGL_CFLAGS) - AC_SUBST(OPENGL_LIBS) + AC_CHECK_LIB([GL], [glBegin], , + AC_MSG_ERROR([ *** Unable to find OpenGL library])) + AC_CHECK_LIB([guichan_opengl], [gcnOpenGL], , + AC_MSG_ERROR([ *** Unable to find Guichan OpenGL library (guichan.sf.net)])) + AC_DEFINE(USE_OPENGL, 1, [Defines if tmw should use an OpenGL display]) else with_opengl=no fi -# Search for sdl-config -AC_PATH_PROG(LIBSDL_CONFIG, sdl-config) - -if test -n "$LIBSDL_CONFIG"; then - LIBSDL_LIBS="`$LIBSDL_CONFIG --libs` -lSDL_image -lSDL_mixer" - LIBSDL_CFLAGS="`$LIBSDL_CONFIG --cflags`" - AC_SUBST(LIBSDL_LIBS) - AC_SUBST(LIBSDL_CFLAGS) - - AC_DEFINE_UNQUOTED(HAVE_LIBSDL, 1, - [Defines if your system has the LIBSDL library]) -else - AC_DEFINE_UNQUOTED(HAVE_LIBSDL, 0, - [Defines if your system has the LIBSDL library]) - AC_MSG_ERROR([Could not find sdl-config, check http://www.libsdl.org]) -fi - AC_CONFIG_FILES([ Makefile src/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 42e72829..13ec7308 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,5 @@ +AUTOMAKE_OPTIONS = subdir-objects + bin_PROGRAMS = tmw tmw_SOURCES = graphic/imagerect.h \ gui/browserbox.cpp \ @@ -240,9 +242,3 @@ tmw_SOURCES = graphic/imagerect.h \ INCLUDES = \ $(all_includes) \ -DTMW_DATADIR=\""$(pkgdatadir)/"\" - -# the library search path. -tmw_LDFLAGS = $(all_libraries) $(LIBSDL_RPATH) `pkg-config --libs libxml-2.0` -tmw_CXXFLAGS = -Wall -Werror $(OPENGL_CFLAGS) $(LIBSDL_CFLAGS) `pkg-config --cflags libxml-2.0` $(CURL_CFLAGS) -tmw_LDADD = $(LIBSDL_LIBS) -lguichan_sdl $(OPENGL_LIBS) $(CURL_LIBS) -tmw_TARGET = tmw |