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])
12 if test "x${CFLAGS-notset}" = "xnotset"; then
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"])
22 AC_ARG_WITH(game_user, [ --with-user=user User account to use for attac-man (default 'games')], [GAME_USER="$withval"])
25 AC_ARG_WITH(game_group, [ --with-group=group Group name to use for attac-man (default 'games')], [GAME_GROUP="$withval"])
28 # Checks for programs.
34 # Checks for libraries.
36 # Checks for header files.
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.
45 # Checks for library functions.
46 AC_PROG_GCC_TRADITIONAL
50 AC_CHECK_FUNCS([memmove memset pow select sqrt strdup strerror strstr strtol])
54 CFLAGS="$CFLAGS $X_CFLAGS"
55 LDFLAGS="$LDFLAGS $X_LIBS"
57 # check pthread style (-pthread / -lpthread)
58 AC_CACHE_CHECK([if compiler recognizes -pthread],
60 ac_save_CFLAGS=$CFLAGS
61 CFLAGS="$CFLAGS -pthread"
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
71 CFLAGS=$ac_save_CFLAGS
73 if test $myapp_cv_gcc_pthread = yes
76 CFLAGS="$CFLAGS -pthread"
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)])
86 CFLAGS="$CFLAGS $SDL_CFLAGS"
87 LDFLAGS="$LDFLAGS $SDL_LIBS"
89 AC_MSG_ERROR([Attac-Man requires SDL 1.2])
93 AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, [ LDFLAGS="$LDFLAGS -lSDL_mixer" ],
95 *** SDL_mixer not found
96 Attac-Man requires SDL_mixer
100 AC_CHECK_LIB(SDL_net, SDLNet_Init, [ LDFLAGS="$LDFLAGS -lSDL_net" ],
102 *** SDL_net not found
103 Attac-Man requires SDL_net
107 AC_CHECK_LIB(SDL_ttf, TTF_OpenFont, [ LDFLAGS="$LDFLAGS -lSDL_ttf" ],
109 *** SDL_ttf not found
110 Attac-Man requires SDL_ttf
113 AC_CHECK_LIB(GL, glEnable, [ LDFLAGS="$LDFLAGS -lGL" ],
114 [AC_MSG_ERROR([OpenGL libraries not found])
116 AC_CHECK_LIB(GLU, gluNewQuadric, [ LDFLAGS="$LDFLAGS -lGLU" ],
117 [AC_MSG_ERROR([OpenGL libraries not found])
120 AC_CONFIG_FILES([Makefile])