1
AC_PREREQ(2.59)
2
AC_INIT([The Mana World], [0.0.29.1], [themanaworld-devel@lists.sourceforge.net], [tmw])
3
AM_INIT_AUTOMAKE([1.9])
4
AC_CONFIG_HEADERS([config.h:config.h.in])
5
AC_LANG_CPLUSPLUS
6
7
# Checks for programs.
8
AC_PROG_CXX
9
AC_PROG_INSTALL
10
11
# Checks for typedefs, structures, and compiler characteristics.
12
AC_HEADER_TIME
13
14
# Checks for library functions.
15
AC_FUNC_ERROR_AT_LINE
16
AC_FUNC_MALLOC
17
AC_FUNC_REALLOC
18
AC_FUNC_SELECT_ARGTYPES
19
AC_FUNC_VPRINTF
20
AC_CHECK_FUNCS([atexit floor getcwd gethostbyname memset mkdir select socket])
21
22
# Checks for internationalization support
23
AM_GNU_GETTEXT([external])
24
AM_GNU_GETTEXT_VERSION([0.16.1])
25
26
# Search for *-config
27
AC_PATH_PROG(SDL_CONFIG, sdl-config)
28
AC_PATH_PROG(PKG_CONFIG, pkg-config)
29
AC_PATH_PROG(CURL_CONFIG, curl-config)
30
31
# Checks for libraries
32
AC_CHECK_LIB([pthread], [pthread_create], ,
33
AC_MSG_ERROR([ *** Unable to find pthread library]))
34
35
AC_CHECK_LIB([guichan], [gcnGuichanVersion], ,
36
AC_MSG_ERROR([ *** Unable to find Guichan library (http://guichan.sf.net/)]))
37
AC_CHECK_HEADERS([guichan.hpp], ,
38
AC_MSG_ERROR([ *** Guichan library found but cannot find headers (http://guichan.sf.net/)]))
39
40
if test -n "$SDL_CONFIG"; then
41
    LIBS="$LIBS `$SDL_CONFIG --libs`"
42
    CPPFLAGS="$CPPFLAGS `$SDL_CONFIG --cflags`"
43
fi
44
AC_CHECK_LIB([SDL], [SDL_Init], ,
45
AC_MSG_ERROR([ *** Unable to find SDL library (http://www.libsdl.org/)]))
46
AC_CHECK_HEADERS([SDL.h], ,
47
AC_MSG_ERROR([ *** SDL library found but cannot find headers (http://www.libsdl.org/)]))
48
49
AC_CHECK_LIB([z], [inflate], ,
50
AC_MSG_ERROR([ *** Unable to find zlib (http://www.gzip.org/zlib/)]))
51
52
AC_CHECK_LIB([physfs], [PHYSFS_init], ,
53
AC_MSG_ERROR([ *** Unable to find PhysFS library (http://icculus.org/physfs/)]))
54
AC_CHECK_HEADERS([physfs.h], ,
55
AC_MSG_ERROR([ *** PhysFS library found but cannot find headers (http://icculus.org/physfs/)]))
56
57
if test -n "$CURL_CONFIG"; then
58
    LIBS="$LIBS `$CURL_CONFIG --libs`"
59
    CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
60
fi
61
AC_CHECK_LIB([curl], [curl_global_init], ,
62
AC_MSG_ERROR([ *** Unable to find CURL library (http://curl.haxx.se/)]))
63
AC_CHECK_HEADERS([curl/curl.h], ,
64
AC_MSG_ERROR([ *** CURL library found but cannot find headers (http://curl.haxx.se/)]))
65
66
if test -n "$PKG_CONFIG"; then
67
    LIBS="$LIBS `$PKG_CONFIG --libs libxml-2.0`"
68
    CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags libxml-2.0`"
69
fi
70
AC_CHECK_LIB([xml2], [xmlInitParser], ,
71
AC_MSG_ERROR([ *** Unable to find libxml2 library (http://xmlsoft.org/)]))
72
AC_CHECK_HEADERS([libxml/xmlreader.h], ,
73
AC_MSG_ERROR([ *** libxml2 library found but cannot find headers (http://xmlsoft.org/)]))
74
75
AC_CHECK_LIB(png, png_write_info, ,
76
AC_MSG_ERROR([ *** Unable to find png library]))
77
78
AC_CHECK_LIB(SDL_image, IMG_LoadPNG_RW, ,
79
AC_MSG_ERROR([ *** Unable to find SDL_image library with PNG support
80
(http://www.libsdl.org/projects/SDL_image/)]))
81
82
AC_CHECK_LIB(SDL_ttf, TTF_Quit, ,
83
AC_MSG_ERROR([ *** Unable to find SDL_ttf library (http://www.libsdl.org/projects/SDL_ttf/)]))
84
85
AC_CHECK_LIB([SDL_mixer], [Mix_OpenAudio], ,
86
AC_MSG_ERROR([ *** Unable to find SDL_mixer library (http://www.libsdl.org/projects/SDL_mixer/)]))
87
88
AC_CHECK_LIB([guichan_sdl], [gcnSDL], ,
89
AC_MSG_ERROR([ *** Unable to find Guichan SDL library (http://guichan.sf.net/)]))
90
91
# Checks for header files.
92
AC_HEADER_STDC
93
AC_CHECK_HEADERS([arpa/inet.h fcntl.h malloc.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])
94
95
# Option to enable OpenGL
96
AC_ARG_WITH(opengl,[  --without-opengl        don't use OpenGL ] )
97
if test "x$with_opengl" == "xno"; then
98
    with_opengl=no
99
else
100
    with_opengl=yes
101
    AC_CHECK_LIB([GL], [glBegin], ,
102
    AC_MSG_ERROR([ *** Unable to find OpenGL library]))
103
    AC_DEFINE(USE_OPENGL, 1, [Defines if tmw should use an OpenGL display])
104
fi
105
106
# Enable either tmwserv or eAthena
107
AC_ARG_WITH(
108
    [server],
109
    AS_HELP_STRING(
110
        [--with-server=ARG],
111
        [which server to use [[ARG=tmwserv,eathena]]
112
        [(default=eathena)]]
113
    ),
114
    [if test "$withval" = "yes"; then
115
        # default is eathena
116
        with_server="eathena"
117
     elif test "$withval" = "no"; then
118
        AC_MSG_ERROR([$PACKAGE_NAME cannot run without a server.])
119
     else
120
         with_server="$withval"
121
     fi],
122
    [with_server="eathena"]
123
)
124
125
if test "$with_server" = "tmwserv"; then
126
    AC_CHECK_LIB([enet], [enet_initialize], ,
127
    AC_MSG_ERROR([ *** Unable to find enet library (http://enet.bespin.org/)]))
128
    AC_DEFINE(TMWSERV_SUPPORT, 1, [Defines if tmwserv support is enabled])
129
elif test "$with_server" = "eathena"; then
130
    AC_CHECK_LIB(SDL_net, SDLNet_Init, ,
131
    AC_MSG_ERROR([ *** Unable to find SDL_net library]))
132
    AC_DEFINE(EATHENA_SUPPORT, 1, [Defines if eAthena support is enabled])
133
else
134
    AC_MSG_ERROR([unknown server: $with_server])
135
fi
136
137
AM_CONDITIONAL(SERVER_TMWSERV, test "$with_server" = "tmwserv")
138
AM_CONDITIONAL(SERVER_EATHENA, test "$with_server" = "eathena")
139
140
AC_CONFIG_FILES([
141
Makefile
142
src/Makefile
143
data/Makefile
144
data/fonts/Makefile
145
data/graphics/Makefile
146
data/graphics/gui/Makefile
147
data/graphics/images/Makefile
148
data/help/Makefile
149
data/icons/Makefile
150
docs/Makefile
151
po/Makefile.in
152
])
153
154
AC_OUTPUT
155
156
echo
157
echo "Build with OpenGL: $with_opengl"
158
echo "Supported server:  $with_server"
159
echo
160
echo "configure complete, now type \"make\""
161
echo