File: configure.in

package info (click to toggle)
gltron 0.61-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,948 kB
  • ctags: 1,175
  • sloc: ansic: 7,580; perl: 168; makefile: 149; sh: 15
file content (133 lines) | stat: -rw-r--r-- 3,604 bytes parent folder | download
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
dnl Process this file with autoconf to produce a configure script.

dnl any file will do
AC_INIT(camera.c)


dnl Checks for programs.

dnl Checks for libraries.
dnl Replace `main' with a function in -lGL:
LIBS='-L/usr/X11R6/lib'

AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

CFLAGS=""

AC_ARG_ENABLE(warn,
[ --enable-warn                Enable compiler warnings [default=on]],
	enable_warn=$enableval, enable_warn=yes)
if test "x$enable_warn" = xyes; then
	CFLAGS="$CFLAGS -Wall"
fi

AC_ARG_ENABLE(debug,
[ --enable-debug               Enable debugging [default=off]],
	enable_debug=$enableval, enable_debug=off)
if test "x$enable_debug" = xyes; then
	CFLAGS="$CFLAGS -g3"
fi

AC_ARG_ENABLE(profile,
[ --enable-profile             Enable profiling [default=off]],
	enable_profile=$enableval, enable_profile=off)
if test "x$enable_profile" = xyes; then
	if test "x$GCC" = xyes; then
		CFLAGS="$CFLAGS -pg"
	else
		CFLAGS="$CFLAGS -p"
	fi
fi

AC_ARG_ENABLE(optimize,
[ --enable-optimize=[level]    Enable optimization [default=2]],
	enable_optmize=$enableval, enable_optimize=2)
if test "x$enable_optimize" ; then
	CFLAGS="$CFLAGS -O$enable_optimize"
fi

AC_ARG_ENABLE(network,
[ --enable-network             Experimental network mode [default=off]],
	enable_network=$enableval, enable_network=off)
if test "x$enable_network" = xyes; then
AC_CHECK_LIB(SDL_net, main,, AC_MSG_ERROR(SDL_net is needed))
	${LN_S} -f system_net_sdl.c system_net.c
	${LN_S} -f system_net_sdl.h system_net.h
	CFLAGS="$CFLAGS -DNETWORK"
	LIBS="$LIBS -lSDL_net"
	NETWORK_FILES="network.c system_net.c"
	AC_SUBST(NETWORK_FILES)
fi

AC_ARG_ENABLE(sound,
[ --disable-sound              Dont compile in sound [default=off]],
   use_sound=no, use_sound=yes)

AC_CHECK_LIB(m, main,, AC_MSG_ERROR(libm is needed))
AC_CHECK_LIB(X11, main,, AC_MSG_ERROR(X11 is needed, course))
AC_CHECK_LIB(GL, main,, AC_MSG_ERROR(OpenGL is needed))
dnl AC_CHECK_LIB(GLU, main,, AC_MSG_ERROR(GLU should come with OpenGL))
dnl AC_CHECK_LIB(pthread, main,, AC_MSG_ERROR(SDL needs pthread to run properly))

AC_CHECK_LIB(SDL, main, 
${LN_S} -f system_sdl.c system.c ; \
${LN_S} -f system_sdl.h system.h ; \
LIBS="$LIBS `sdl-config --libs`" ; \
CFLAGS="$CFLAGS `sdl-config --cflags`" ; \
HAVE_SDL=1,
AC_CHECK_LIB(glut, main, 
${LN_S} -f system_glut.c system.c ; \
${LN_S} -f system_glut.h system.h ; \
LIBS="$LIBS -lglut", \
AC_MSG_ERROR(Neither SDL or glut is installed!)))

if test "x$use_sound" = xyes; then
	SOUND_FILE="sound.c sound3d.c"
	AC_SUBST(SOUND_FILE)
	AC_CHECK_LIB(SDL_mixer, main,
	${LN_S} -f sound_sdl.c sound.c ; \
	${LN_S} -f sound_sdl.h sound.h ; \
	CFLAGS="$CFLAGS -DSOUND"; \
	LIBS="$LIBS -lSDL_mixer", 
	AC_CHECK_LIB(mikmod, main,
	${LN_S} -f sound_libmikmod.c sound.c ; \
	${LN_S} -f sound_libmikmod.h sound.h ; \
	CFLAGS="$CFLAGS -DSOUND"; \
	LIBS="$LIBS -lmikmod",
	AC_MSG_ERROR(Neither SDL_mixer nor libmikmod is installed!)))
fi

AC_CHECK_LIB(z, main,, AC_MSG_ERROR(libz is needed))
AC_CHECK_LIB(png, main,, AC_MSG_ERROR(libpng is needed))

AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)

AC_CHECK_HEADERS(GL/gl.h,,
 AC_CHECK_HEADERS(/usr/X11R6/include/GL/gl.h,
	includes_in_x=1,
 AC_CHECK_HEADERS(/usr/local/include/GL/gl.h,
	includes_in_local=1,
AC_MSG_ERROR(cant find GL headers))))

if test "$includes_in_x" = 1 ; then
	INCS="$INCS -I/usr/X11R6/include"
fi

if test "$includes_in_local" = 1; then
	INCS="$INCS -I/usr/local/include"
fi

AC_SUBST(INCS)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

dnl Checks for library functions.
AC_CHECK_FUNCS(strstr)

AC_OUTPUT(Makefile)