File: configure.in

package info (click to toggle)
plib-doc 1%3A1.8.5-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,748 kB
  • sloc: cpp: 23,304; sh: 3,449; makefile: 197
file content (313 lines) | stat: -rw-r--r-- 8,492 bytes parent folder | download | duplicates (6)
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
dnl Process this file with autoconf to produce a configure script.

AC_INIT(src/js/js_demo.cxx)
AM_INIT_AUTOMAKE(plib_examples, 1.8.5)


dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL

AC_LANG_CPLUSPLUS


dnl Command line arguments.

dnl Don't use AC_HELP_STRING here as old versions of autoconf do not
dnl understand it.
AC_ARG_WITH(GL,
[  --with-GL=DIR           set the prefix directory where GL resides],
GL_PREFIX=$withval, GL_PREFIX=auto)


AC_ARG_ENABLE(fnt,
[  --enable-fnt            build FNT examples                      default: yes],,
enable_fnt=yes)

AC_ARG_ENABLE(js,
[  --enable-js             build JS examples                       default: yes],,
enable_js=yes)

AC_ARG_ENABLE(pw,
[  --enable-pw             build PW examples                       default: yes],,
enable_pw=yes)

AC_ARG_ENABLE(net,
[  --enable-net            build NET examples                      default: yes],,
enable_net=yes)

AC_ARG_ENABLE(pui,
[  --enable-pui            build PUI examples                      default: yes],,
enable_pui=yes)

AC_ARG_ENABLE(sg,
[  --enable-sg             build SG examples                       default: yes],,
enable_sg=yes)

AC_ARG_ENABLE(psl,
[  --enable-psl            build PSL examples                       default: yes],,
enable_psl=yes)

AC_ARG_ENABLE(sl,
[  --enable-sl             build SL examples                       default: yes],,
enable_sl=yes)

AC_ARG_ENABLE(ssg,
[  --enable-ssg            build SSG/ssgAux examples               default: yes],,
enable_ssg=yes)

AC_ARG_ENABLE(ul,
[  --enable-ul             build UTIL examples                     default: yes],,
enable_ul=yes)


if test "x$enable_fnt" = "xyes"; then need_opengl=yes; fi
if test "x$enable_pui" = "xyes"; then need_opengl=yes; fi
if test "x$enable_sg" = "xyes"; then need_opengl=yes; fi
if test "x$enable_ssg" = "xyes"; then need_opengl=yes; fi
if test "x$enable_ssgaux" = "xyes"; then need_opengl=yes; fi

AM_CONDITIONAL(BUILD_FNT, test "x$enable_fnt" = "xyes")
AM_CONDITIONAL(BUILD_JS, test "x$enable_js" = "xyes")
AM_CONDITIONAL(BUILD_PW, test "x$enable_pw" = "xyes")
AM_CONDITIONAL(BUILD_NET, test "x$enable_net" = "xyes")
AM_CONDITIONAL(BUILD_PUI, test "x$enable_pui" = "xyes")
AM_CONDITIONAL(BUILD_SG, test "x$enable_sg" = "xyes")
AM_CONDITIONAL(BUILD_PSL, test "x$enable_psl" = "xyes")
AM_CONDITIONAL(BUILD_SL, test "x$enable_sl" = "xyes")
AM_CONDITIONAL(BUILD_SSG, test "x$enable_ssg" = "xyes")
AM_CONDITIONAL(BUILD_UL, test "x$enable_ul" = "xyes")

if test "x$need_opengl" = "xyes" && test "x$GL_PREFIX" != "xauto"; then
    LDFLAGS="$LDFLAGS -L$GL_PREFIX/lib"
    CPPFLAGS="$CPPFLAGS -I$GL_PREFIX/include"
fi


dnl Checks for library functions.
dnl check for OpenGL related libraries

AC_CANONICAL_HOST

case "${host}" in
*-*-cygwin*)

    dnl CygWin under Windoze.

    dnl Sound / joystick stuff, mmtimer (ulClock !)
    LIBS="$LIBS -lwinmm"

    dnl OpenGL libraries
    OGL_LIBS="-lglu32 -lopengl32 -lgdi32"
    GLUT_LIBS="-lglut32"
	;;
*-*-mingw32*)
    dnl Mingw under Windoze.

    dnl Sound / joystick stuff, mmtimer (ulClock !)
    LIBS="$LIBS -lwinmm -lwsock32"


    dnl OpenGL libraries
    OGL_LIBS="-lglu32 -lopengl32 -lgdi32"
    GLUT_LIBS="-lglut32"
	;;
*-apple-darwin*)
    dnl Mac OS X

    dnl OpenGL libraries
    OGL_LIBS="-framework OpenGL"
    GLUT_LIBS="-framework GLUT -lobjc"

    dnl Sound libraries
    SND_LIBS="-framework Carbon"
	;;
*)
    if test "x$need_opengl" = "xyes"; then
        dnl Check for X11

        AC_PATH_XTRA

        LDFLAGS="$LDFLAGS $X_LIBS"

        OGL_LIBS="$X_PRE_LIBS -lXi -lXmu -lXext -lX11 $X_EXTRA_LIBS -lm"

dnl =========================================================
dnl    if test "x$x_includes" != "x"; then
dnl       CPPFLAGS="$CPPFLAGS -I$x_includes"
dnl    fi
dnl =========================================================

        dnl Reasonable stuff non-windoze variants ... :-)

        AC_CHECK_LIB(pthread, pthread_create)

        AC_CHECK_LIB(GL, glNewList, OGL_LIBS="-lGL $OGL_LIBS",,$OGL_LIBS)
        if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
                dnl if no GL, check for MesaGL
                AC_CHECK_LIB(MesaGL, glNewList, OGL_LIBS="-lMesaGL $OGL_LIBS",
                AC_MSG_ERROR([could not find working GL library]),
                $OGL_LIBS)
        fi

        AC_CHECK_LIB(GLU, gluLookAt, OGL_LIBS="-lGLU $OGL_LIBS",,$OGL_LIBS)
        if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
                dnl if no GLU, check for MesaGLU
                AC_CHECK_LIB(MesaGLU, gluLookAt,
                OGL_LIBS="-lMesaGLU $OGL_LIBS",
                AC_MSG_ERROR([could not find working GLU library]),
                $OGL_LIBS)
	fi

        dnl check for glut...or freeglut

        AC_CHECK_LIB(freeglut, glutGetModifiers, GLUT_LIBS="-lfreeglut",,
        $OGL_LIBS)
        if test "x$ac_cv_lib_freeglut_glutGetModifiers" = "xno" ; then
                dnl if no freeglut, check for real GLUT
                AC_CHECK_LIB(glut, glutGetModifiers, GLUT_LIBS="-lglut",
                AC_MSG_ERROR([could not find working GLUT library]),
                $OGL_LIBS)
        fi
    fi

    AC_CHECK_LIB(dl, dlclose)

    dnl Check SGI audio library
    AC_CHECK_LIB(audio, ALopenport, SND_LIBS="-laudio")
	;;
esac

dnl Check PLIB library
AC_CHECK_LIB(plibul, ulInit, true,
AC_MSG_ERROR([there seems to be a problem with the PLIB libraries]))


AC_SUBST(OGL_LIBS)
AC_SUBST(GLUT_LIBS)
AC_SUBST(SND_LIBS)


dnl Checks for header files.

AC_HEADER_STDC

AC_CHECK_HEADER(windows.h, AC_DEFINE(WIN32))

if test "x$need_opengl" = "xyes"; then
    dnl Check for OpenGl header files

    case "${host}" in
    *-*-cygwin* | *-*-mingw32*)
        dnl CygWin under Windoze.

        AC_CHECK_HEADERS(GL/gl.h GL/glu.h,,
        AC_MSG_ERROR([OpenGL header files not found]))

        AC_CHECK_HEADER(GL/glut.h, AC_DEFINE(GLUT_IS_PRESENT),
        AC_MSG_ERROR([GLUT header file not found]))
		;;
    *-apple-darwin*)
        dnl Mac OS X

        AC_CHECK_HEADERS(OpenGL/gl.h OpenGL/glu.h,,
        AC_MSG_ERROR([OpenGL header files not found]))

        AC_CHECK_HEADER(GLUT/glut.h, AC_DEFINE(GLUT_IS_PRESENT),
        AC_MSG_ERROR([GLUT header file not found]))
		;;
    *)
        AC_CHECK_HEADERS(GL/gl.h GL/glu.h,,
        AC_MSG_ERROR([OpenGL header files not found]))

        if test "x$ac_cv_lib_freeglut_glutGetModifiers" = "xyes"; then
                AC_CHECK_HEADER(GL/freeglut.h, AC_DEFINE(FREEGLUT_IS_PRESENT),
                AC_MSG_ERROR([freeglut header file not found]))
        else
                AC_CHECK_HEADER(GL/glut.h, AC_DEFINE(GLUT_IS_PRESENT),
                AC_MSG_ERROR([GLUT header file not found]))
        fi
		;;
    esac
fi

AC_CHECK_HEADER(plib/ul.h,, AC_MSG_ERROR([PLIB header files not found]))


dnl Warning flags
WFLAG="-Wall"
case "$host" in
mips-sgi-irix*)
    if test "x$CXX" = "xCC"; then
        WFLAG="-fullwarn";
    fi
	;;
*)
    if test "x$CXX" = "xicpc" || test "x$CXX" = "xicc"; then
        WFLAG="-w1"
    fi
	;;
esac

CFLAGS="$CFLAGS $WFLAG"
CXXFLAGS="$CXXFLAGS $WFLAG"


AC_OUTPUT( \
	Makefile \
	src/Makefile \
	src/js/Makefile \
	src/pw/Makefile \
	src/pui/Makefile \
	src/sg/Makefile \
	src/sl/Makefile \
	src/ssg/Makefile \
	src/ssg/tux/Makefile \
	src/ssg/majik/Makefile \
	src/ssg/load_save/Makefile \
	src/ssg/state_test/Makefile \
	src/ssg/tween_test/Makefile \
	src/ssg/viewer/Makefile \
	src/ssg/water/Makefile \
	src/ssg/sky/Makefile \
	src/ssg/dynamics/Makefile \
	src/ssg/shrubs/Makefile \
	src/ssg/shapes/Makefile \
	src/fnt/Makefile \
	src/net/Makefile \
	src/net/client_server/Makefile \
	src/net/http_get/Makefile \
	src/net/net_echo/Makefile \
	src/psl/Makefile \
	src/util/Makefile )

if test "x$need_opengl" = "xyes"; then
    if test "x$ac_cv_lib_freeglut_glutGetModifiers" = "xyes"; then
        glut_msg="yes (found freeglut)"
    else
        glut_msg="yes (found GLUT)"
    fi
else
    glut_msg="no"
fi

AC_MSG_RESULT(
[PLIB configuration information:

  Building FNT examples:         $enable_fnt
  Building JS examples:          $enable_js
  Building PW examples:          $enable_pw
  Building NET examples:         $enable_net
  Building PUI examples:         $enable_pui
  Building SG examples:          $enable_sg
  Building PSL examples:         $enable_psl
  Building SL examples:          $enable_sl
  Building SSG/ssgAux examples:  $enable_ssg
  Building UTIL examples:        $enable_ul

  Need GLUT:                     $glut_msg
])