File: configure.in

package info (click to toggle)
plib 1.8.5-14
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,588 kB
  • sloc: cpp: 63,284; sh: 3,457; makefile: 211
file content (426 lines) | stat: -rw-r--r-- 11,291 bytes parent folder | download | duplicates (7)
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
dnl Process this file with autoconf to produce a configure script.

AC_INIT(src/js/js.h)

# **WARNING**WARNING**WARNING**WARNING**WARNING**WARNING**
#
# When you make a new release, there are TWO places where you
# have to change the version number:
#  1)  Right below this comment.
#  2)  In 'ul.h' where PLIB_VERSION is created.
#
# **WARNING**WARNING**WARNING**WARNING**WARNING**WARNING**

AM_INIT_AUTOMAKE(plib, 1.8.5)

# This AC_PREFIX_DEFAULT will place the library files
# into /usr/lib - but will put the include files into
# /usr/include - when /usr/include/plib would be less
# polluting to the filename space.
#
# There is probably a better way to do this.

AC_PREFIX_DEFAULT(/usr)

if echo $includedir | egrep "plib$" > /dev/null; then
    echo "includedir is" $includedir "libdir is" $libdir
else
    includedir="${includedir}/plib"
    echo "includedir changed to" $includedir "libdir is" $libdir
fi


dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL
AC_PROG_RANLIB

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 library (OpenGL needed)       default: yes],,
enable_fnt=yes)

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

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

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

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

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

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

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

AC_ARG_ENABLE(ssg,
[  --enable-ssg            build SSG library (OpenGL needed)       default: yes],,
enable_ssg=yes)

AC_ARG_ENABLE(puaux,
[  --enable-puaux         build puAux library (OpenGL needed)    default: yes],,
enable_puaux=yes)

AC_ARG_ENABLE(ssgaux,
[  --enable-ssgaux         build ssgAux library (OpenGL needed)    default: yes],,
enable_ssgaux=yes)

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


dnl Dependancy checking

if test "x$enable_fnt" = "xyes"; then
    need_opengl=yes

    if test "x$enable_sg" = "xno"; then
        AC_MSG_WARN([cannot build FNT library without SG library enabled])
        dependancy_problem=yes
    fi
    if test "x$enable_ul" = "xno"; then
        AC_MSG_WARN([cannot build FNT library without UL library enabled])
        dependancy_problem=yes
    fi
fi

if test "x$enable_pw" = "xyes"; then
    if test "x$enable_ul" = "xno"; then
        AC_MSG_WARN([cannot build PW library without UL library enabled])
        dependancy_problem=yes
    fi
fi

if test "x$enable_js" = "xyes"; then
    if test "x$enable_ul" = "xno"; then
        AC_MSG_WARN([cannot build JS library without UL library enabled])
        dependancy_problem=yes
    fi
fi

if test "x$enable_net" = "xyes"; then
    if test "x$enable_ul" = "xno"; then
        AC_MSG_WARN([cannot build NET library without UL library enabled])
        dependancy_problem=yes
    fi
fi

if test "x$enable_pui" = "xyes"; then
    need_opengl=yes

    if test "x$enable_fnt" = "xno"; then
        AC_MSG_WARN([cannot build PUI library without FNT library enabled])
        dependancy_problem=yes
    fi
    if test "x$enable_sg" = "xno"; then
        AC_MSG_WARN([cannot build PUI library without SG library enabled])
        dependancy_problem=yes
    fi
    if test "x$enable_ul" = "xno"; then
        AC_MSG_WARN([cannot build PUI library without UL library enabled])
        dependancy_problem=yes
    fi
fi

if test "x$enable_sg" = "xyes"; then
    if test "x$enable_ul" = "xno"; then
        AC_MSG_WARN([cannot build SG library without UL library enabled])
        dependancy_problem=yes
    fi
fi

if test "x$enable_psl" = "xyes"; then
    if test "x$enable_ul" = "xno"; then
        AC_MSG_WARN([cannot build PSL library without UL library enabled])
        dependancy_problem=yes
    fi
fi

if test "x$enable_sl" = "xyes"; then
    if test "x$enable_ul" = "xno"; then
        AC_MSG_WARN([cannot build SL library without UL library enabled])
        dependancy_problem=yes
    fi
fi

if test "x$enable_ssg" = "xyes"; then
    need_opengl=yes

    if test "x$enable_sg" = "xno"; then
        AC_MSG_WARN([cannot build SSG library without SG library enabled])
        dependancy_problem=yes
    fi
    if test "x$enable_ul" = "xno"; then
        AC_MSG_WARN([cannot build SSG library without UL library enabled])
        dependancy_problem=yes
    fi
fi

if test "x$enable_puaux" = "xyes"; then
    need_opengl=yes

    if test "x$enable_pui" = "xno"; then
        AC_MSG_WARN([cannot build puAux library without PUI library enabled])
        dependancy_problem=yes
    fi
    if test "x$enable_sg" = "xno"; then
        AC_MSG_WARN([cannot build puAux library without SG library enabled])
        dependancy_problem=yes
    fi
    if test "x$enable_ul" = "xno"; then
        AC_MSG_WARN([cannot build puAux library without UL library enabled])
        dependancy_problem=yes
    fi
fi

if test "x$enable_ssgaux" = "xyes"; then
    need_opengl=yes

    if test "x$enable_ssg" = "xno"; then
        AC_MSG_WARN([cannot build ssgAux library without SSG library enabled])
        dependancy_problem=yes
    fi
    if test "x$enable_sg" = "xno"; then
        AC_MSG_WARN([cannot build ssgAux library without SG library enabled])
        dependancy_problem=yes
    fi
    if test "x$enable_ul" = "xno"; then
        AC_MSG_WARN([cannot build ssgAux library without UL library enabled])
        dependancy_problem=yes
    fi
fi

if test "x$dependancy_problem" = "xyes"; then
    AC_MSG_ERROR([dependancy problems detected])
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_PUAUX, test "x$enable_puaux" = "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_SSGAUX, test "x$enable_ssgaux" = "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* | *-*-mingw32*)
    dnl CygWin under Windoze.

    dnl Multimedia library
    LIBS="$LIBS -lwinmm"

    if test "x$need_opengl" = "xyes"; then
        dnl OpenGL libraries
        LIBS="$LIBS -lopengl32"
    fi
	;;
*-apple-darwin*)
    dnl Mac OS X

    if test "x$need_opengl" = "xyes"; then
        dnl OpenGL libraries
        LIBS="$LIBS -framework OpenGL"
    fi

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

        AC_PATH_XTRA

        LDFLAGS="$LDFLAGS $X_LIBS"

        LIBS="$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)
        if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
                dnl if no GL, check for MesaGL
                AC_CHECK_LIB(MesaGL, glNewList,,
                AC_MSG_ERROR([could not find working GL library]))
        fi

    fi

    AC_CHECK_LIB(dl, dlclose)

    dnl Check SGI audio library
    AC_CHECK_LIB(audio, ALopenport)
	;;
esac


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_HEADER(GL/gl.h,,
        AC_MSG_ERROR([OpenGL header file not found]))
		;;
    *-apple-darwin*)
        dnl Mac OS X

        AC_CHECK_HEADER(OpenGL/gl.h,,
        AC_MSG_ERROR([OpenGL header file not found]))
		;;
    *)
        AC_CHECK_HEADER(GL/gl.h,,
        AC_MSG_ERROR([OpenGL header file not found]))
		;;
    esac
fi


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
   if test "x$GCC" != xyes; then
      # if the compiler is not GCC we reset WFLAG to null for safety
      WFLAG=""
   fi
	;;
esac

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

dnl FreeBSD requires the -pthread switch to enable pthreads. Look for this
dnl weirdness.
save_CXXFLAGS="$CXXFLAGS"
save_CFLAGS="$CFLAGS"
save_LIBS=$LIBS
CXXFLAGS="-pthread $CXXFLAGS"
CFLAGS="-pthread $CFLAGS"
AC_CHECK_LIB(c_r, pthread_exit)
if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
   CFLAGS=$save_CFLAGS
   CXXFLAGS=$save_CXXFLAGS
fi
LIBS=$save_LIBS

dnl Checks for typedefs, structures, and compiler characteristics.

dnl check for socklen_t (in Unix98)
AC_MSG_CHECKING(for socklen_t)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
socklen_t apa;
],[],[
AC_MSG_RESULT(yes)],[   
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
int accept (int, struct sockaddr *, size_t *);
],[],[
AC_MSG_RESULT(size_t)
AC_DEFINE(socklen_t,size_t)], [
AC_MSG_RESULT(int)
AC_DEFINE(socklen_t,int)])])


AC_OUTPUT( \
	Makefile \
	src/Makefile \
	src/js/Makefile \
	src/util/Makefile \
	src/sg/Makefile \
	src/sl/Makefile \
	src/psl/Makefile \
	src/ssg/Makefile \
	src/ssgAux/Makefile \
	src/fnt/Makefile \
	src/pui/Makefile \
	src/puAux/Makefile \
	src/pw/Makefile \
	src/net/Makefile )

AC_MSG_RESULT(
[PLIB configuration information:

  Building FNT library:     $enable_fnt
  Building JS library:      $enable_js
  Building NET library:     $enable_net
  Building PUI library:     $enable_pui
  Building puAux library:   $enable_puaux
  Building SG library:      $enable_sg
  Building PSL library:     $enable_psl
  Building SL library:      $enable_sl
  Building SSG library:     $enable_ssg
  Building ssgAux library:  $enable_ssgaux
  Building PW library:      $enable_pw
  Building UTIL library:    $enable_ul
])