summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 2b79d4261dd48e01e518a74ffa22860a7654ba34 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
AC_PREREQ(2.59)
AC_INIT([ManaPlus], [1.1.3.20], [akaras@inbox.ru], [manaplus])
AM_INIT_AUTOMAKE([1.9])
AC_CONFIG_HEADERS([config.h:config.h.in])
AC_LANG_CPLUSPLUS

# Checks for programs.
AC_PROG_CXX
AC_PROG_INSTALL

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([atexit floor getcwd gethostbyname memset mkdir select socket])

# Checks for internationalization support
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.16.1])

# 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_CHECK_LIB([guichan], [gcnGuichanVersion], ,
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_HEADERS([guichan/widgetlistener.hpp], ,
AC_MSG_ERROR([ *** Guichan library version is found  but version is < 0.8.0 (http://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([z], [inflate], ,
AC_MSG_ERROR([ *** Unable to find zlib (http://www.gzip.org/zlib/)]))

AC_CHECK_LIB([physfs], [PHYSFS_init], ,
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/)]))
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 (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(png, png_write_info, ,
AC_MSG_ERROR([ *** Unable to find png library]))

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_ttf, TTF_Quit, ,
AC_MSG_ERROR([ *** Unable to find SDL_ttf library (http://www.libsdl.org/projects/SDL_ttf/)]))

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_gfx, rotozoomSurfaceXY, ,
AC_MSG_ERROR([ *** Unable to find SDL_gfx library (http://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx)]))
AC_CHECK_HEADERS(SDL_rotozoom.h, ,)

# === Check for X11 (check borrowed from Wormux) ========================
# Deactivated on purpose under OSX (in case X11 SDK is installed)
if test "x$OSX" != "xyes" ; then
  AC_CHECK_HEADER(X11/Xlib.h, check_x11="yes",check_x11="no")
  if test x${check_x11} = xno ; then
    AC_CHECK_HEADER(X11R6/Xlib.h,
                    [ check_x11="yes"
                      LDFLAGS="-L/usr/X11R6/include $CFLAGS"],
                    check_x11="no")
  fi
  if test x${check_x11} = xyes ; then
    AC_CHECK_LIB(X11, XOpenDisplay,
                 [ LIBS="$LIBS -lX11"
                   AC_DEFINE(USE_X11, 1, [Define to use X11 copy'n'paste]) ],
                 [])
  fi
fi

# 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])

# Option to enable OpenGL
AC_ARG_WITH(opengl,[  --without-opengl        don't use OpenGL ] )
if test "x$with_opengl" == "xno"; then
    with_opengl=no
else
    with_opengl=yes
    AC_CHECK_LIB([GL], [glBegin], ,
    AC_MSG_ERROR([ *** Unable to find OpenGL library]))
    AC_DEFINE(USE_OPENGL, 1, [Defines if Mana should have OpenGL support])
fi

AC_CHECK_LIB(SDL_net, SDLNet_Init, ,
AC_MSG_ERROR([ *** Unable to find SDL_net library]))

AC_CHECK_LIB(rt, shm_open, ,
AC_MSG_ERROR([ *** Unable to find librt library]))

# Enable manaserv
AC_ARG_ENABLE(manaserv,
[  --enable-manaserv    Turn on manaserv],
[case "${enableval}" in
  yes) with_manaserv=true ;;
  no)  with_manaserv=false ;;
  *) AC_MSG_ERROR(bad value ${enableval} for --enable-manaserv) ;;
esac],[with_manaserv=false])

AM_CONDITIONAL(ENABLE_MANASERV, test x$with_manaserv = xtrue)

AC_CONFIG_FILES([
Makefile
src/Makefile
data/Makefile
data/fonts/Makefile
data/graphics/Makefile
data/graphics/gui/Makefile
data/graphics/images/Makefile
data/graphics/sprites/Makefile
data/sfx/Makefile
data/sfx/system/Makefile
data/themes/Makefile
data/themes/blackwood/Makefile
data/themes/classic/Makefile
data/themes/enchilado/Makefile
data/themes/pink/Makefile
data/themes/redandblack/Makefile
data/themes/wood/Makefile
data/help/Makefile
data/icons/Makefile
docs/Makefile
po/Makefile.in
])

AC_OUTPUT

echo
echo "Build with OpenGL: $with_opengl"
echo
echo "configure complete, now type \"make\""
echo