console: Format tabs semi-intelligently
[attac-man.git] / configure.ac
blob0a0611591d876a978e2d8f09fbf6688b29700a96
1 # $Id: configure.ac,v 1.5 2003/11/27 22:11:57 nsubtil Exp $
3 # Process this file with autoconf to produce a configure script.
4 AC_INIT([Attac-Man], 0.1, phro@alum.wpi.edu)
5 AC_CONFIG_SRCDIR([main.c])
6 AC_CONFIG_HEADER([config.h])
7 AC_CANONICAL_TARGET
8 AM_INIT_AUTOMAKE
11 # sanitize CFLAGS
12 if test "x${CFLAGS-notset}" = "xnotset"; then
13         CFLAGS=" "
14         export CFLAGS
17 AC_ARG_ENABLE(optimizations,    [  --enable-optimizations  Enable compiler optimizations (disable debugging)],
18                 [ CFLAGS="$CFLAGS -Wall -Wextra -Wshadow -Wstrict-prototypes -O2" ],
19                 [ CFLAGS="$CFLAGS -Wall -Wextra -Wshadow -Wstrict-prototypes -g"])
21 GAME_USER=games
22 AC_ARG_WITH(game_user, [  --with-user=user        User account to use for attac-man (default 'games')], [GAME_USER="$withval"])
23 AC_SUBST(GAME_USER)
24 GAME_GROUP=games
25 AC_ARG_WITH(game_group, [  --with-group=group     Group name to use for attac-man (default 'games')], [GAME_GROUP="$withval"])
26 AC_SUBST(GAME_GROUP)
28 # Checks for programs.
29 AC_PROG_CC
30 AC_PROG_CPP
31 AC_PROG_MAKE_SET
32 AC_PROG_RANLIB
34 # Checks for libraries.
36 # Checks for header files.
37 AC_HEADER_STDC
38 AC_CHECK_HEADERS([fcntl.h float.h limits.h stddef.h stdlib.h string.h sys/ioctl.h sys/time.h unistd.h])
40 # Checks for typedefs, structures, and compiler characteristics.
41 AC_C_CONST
42 AC_TYPE_SIZE_T
43 AC_HEADER_TIME
45 # Checks for library functions.
46 AC_PROG_GCC_TRADITIONAL
47 AC_FUNC_MALLOC
48 AC_FUNC_MEMCMP
49 AC_FUNC_STAT
50 AC_CHECK_FUNCS([memmove memset pow select sqrt strdup strerror strstr strtol])
52 # look for X
53 AC_PATH_XTRA
54 CFLAGS="$CFLAGS $X_CFLAGS"
55 LDFLAGS="$LDFLAGS $X_LIBS"
57 # check pthread style (-pthread / -lpthread)
58 AC_CACHE_CHECK([if compiler recognizes -pthread],
59         myapp_cv_gcc_pthread,
60         ac_save_CFLAGS=$CFLAGS
61         CFLAGS="$CFLAGS -pthread"
62         AC_LANG_SAVE
63         AC_LANG_C
64         AC_TRY_LINK([#include <pthread.h>],
65                 [void *p = pthread_create;],
66                 CFLAGS="$CFLAGS -pthread"
67                 myapp_cv_gcc_pthread=yes,
68                 myapp_cv_gcc_pthread=no
69         )
70         AC_LANG_RESTORE
71         CFLAGS=$ac_save_CFLAGS
73 if test $myapp_cv_gcc_pthread = yes
74 then
75         myapp_threads=""
76         CFLAGS="$CFLAGS -pthread"
77 else
78         dnl AC_CHECK_HEADERS(pthread.h) unreliable
79         AC_CHECK_LIB(pthread,pthread_create,myapp_threads=-lpthread,
80              [AC_CHECK_LIB(c_r,pthread_create,myapp_threads=-lc_r)])
83 # Check for SDL
84 AM_PATH_SDL(1.2.0,
85         [
86                 CFLAGS="$CFLAGS $SDL_CFLAGS"
87                 LDFLAGS="$LDFLAGS $SDL_LIBS"
88         ], [
89                 AC_MSG_ERROR([Attac-Man requires SDL 1.2])
90         ])
92 # Check for SDL_mixer
93 AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, [ LDFLAGS="$LDFLAGS -lSDL_mixer" ],
94                 [AC_MSG_ERROR([
95 *** SDL_mixer not found
96 Attac-Man requires SDL_mixer
97 ])])
99 # Check for SDL_net
100 AC_CHECK_LIB(SDL_net, SDLNet_Init, [ LDFLAGS="$LDFLAGS -lSDL_net" ],
101                 [AC_MSG_ERROR([
102 *** SDL_net not found
103 Attac-Man requires SDL_net
104 ])])
106 # Check for SDL_ttf
107 AC_CHECK_LIB(SDL_ttf, TTF_OpenFont, [ LDFLAGS="$LDFLAGS -lSDL_ttf" ],
108                 [AC_MSG_ERROR([
109 *** SDL_ttf not found
110 Attac-Man requires SDL_ttf
111 ])])
113 AC_CHECK_LIB(GL, glEnable, [ LDFLAGS="$LDFLAGS -lGL" ],
114                 [AC_MSG_ERROR([OpenGL libraries not found])
115                 ])
116 AC_CHECK_LIB(GLU, gluNewQuadric, [ LDFLAGS="$LDFLAGS -lGLU" ],
117                 [AC_MSG_ERROR([OpenGL libraries not found])
118                 ])
120 AC_CONFIG_FILES([Makefile])
121 AC_OUTPUT