170
170
dnl http://www.gnu.org/software/ac-archive/ax_check_gl.html
171
171
dnl ---------------------------------------------------------------------------
173
dnl @synopsis AX_CHECK_GL
175
dnl Check for an OpenGL implementation. If GL is found, the required
176
dnl compiler and linker flags are included in the output variables
177
dnl "GL_CFLAGS" and "GL_LIBS", respectively. This macro adds the
178
dnl configure option "--with-apple-opengl-framework", which users can
179
dnl use to indicate that Apple's OpenGL framework should be used on Mac
180
dnl OS X. If Apple's OpenGL framework is used, the symbol
181
dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GL implementation
182
dnl is found, "no_gl" is set to "yes".
184
dnl @category InstalledPackages
185
dnl @author Braden McDaniel <braden@endoframe.com>
186
dnl @version 2004-11-15
187
dnl @license AllPermissive
179
dnl Check for an OpenGL implementation. If GL is found, the required
180
dnl compiler and linker flags are included in the output variables
181
dnl "GL_CFLAGS" and "GL_LIBS", respectively. If no usable GL implementation
182
dnl is found, "no_gl" is set to "yes".
184
dnl If the header "GL/gl.h" is found, "HAVE_GL_GL_H" is defined. If the
185
dnl header "OpenGL/gl.h" is found, HAVE_OPENGL_GL_H is defined. These
186
dnl preprocessor definitions may not be mutually exclusive.
190
dnl Copyright (c) 2009 Braden McDaniel <braden@endoframe.com>
192
dnl This program is free software; you can redistribute it and/or modify it
193
dnl under the terms of the GNU General Public License as published by the
194
dnl Free Software Foundation; either version 2 of the License, or (at your
195
dnl option) any later version.
197
dnl This program is distributed in the hope that it will be useful, but
198
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
199
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
200
dnl Public License for more details.
202
dnl You should have received a copy of the GNU General Public License along
203
dnl with this program. If not, see <http://www.gnu.org/licenses/>.
205
dnl As a special exception, the respective Autoconf Macro's copyright owner
206
dnl gives unlimited permission to copy, distribute and modify the configure
207
dnl scripts that are the output of Autoconf when processing the Macro. You
208
dnl need not follow the terms of the GNU General Public License when using
209
dnl or distributing such scripts, even though portions of the text of the
210
dnl Macro appear in them. The GNU General Public License (GPL) does govern
211
dnl all other use of the material that constitutes the Autoconf Macro.
213
dnl This special exception to the GPL applies to versions of the Autoconf
214
dnl Macro released by the Autoconf Archive. When you make and distribute a
215
dnl modified version of the Autoconf Macro, you may extend this special
216
dnl exception to the GPL to apply to your modified version as well.
189
218
AC_DEFUN([AX_CHECK_GL],
190
[AC_REQUIRE([AC_PATH_X])dnl
191
AC_REQUIRE([ACX_PTHREAD])dnl
194
# There isn't a reliable way to know we should use the Apple OpenGL framework
195
# without a configure option. A Mac OS X user may have installed an
196
# alternative GL implementation (e.g., Mesa), which may or may not depend on X.
198
AC_ARG_WITH([apple-opengl-framework],
199
[AC_HELP_STRING([--with-apple-opengl-framework],
200
[use Apple OpenGL framework (Mac OS X only)])])
201
if test "X$with_apple_opengl_framework" = "Xyes"; then
202
AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
203
[Use the Apple OpenGL framework.])
204
GL_LIBS="-framework OpenGL"
209
if test X$ax_compiler_ms = Xno; then
210
GL_CFLAGS="${PTHREAD_CFLAGS}"
211
GL_LIBS="${PTHREAD_LIBS} -lm"
215
# Use x_includes and x_libraries if they have been set (presumably by
218
if test "X$no_x" != "Xyes"; then
219
if test -n "$x_includes"; then
220
GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}"
222
if test -n "$x_libraries"; then
223
GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}"
227
AC_CHECK_HEADERS([windows.h])
229
AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],
230
[ax_cv_check_gl_libgl="no"
231
ax_save_CPPFLAGS="${CPPFLAGS}"
232
CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
233
ax_save_LIBS="${LIBS}"
235
ax_check_libs="-lopengl32 -lGL"
236
for ax_lib in ${ax_check_libs}; do
237
if test X$ax_compiler_ms = Xyes; then
238
ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
240
ax_try_lib="${ax_lib}"
242
LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
245
# if HAVE_WINDOWS_H && defined(_WIN32)
219
[AC_REQUIRE([AC_CANONICAL_HOST])
220
AC_REQUIRE([AC_PATH_X])dnl
221
AC_REQUIRE([AX_PTHREAD])dnl
225
AS_IF([test X$ax_compiler_ms = Xno],
226
[GL_CFLAGS="${PTHREAD_CFLAGS}"; GL_LIBS="${PTHREAD_LIBS} -lm"])
229
dnl Use x_includes and x_libraries if they have been set (presumably by
232
AS_IF([test "X$no_x" != "Xyes"],
233
[AS_IF([test -n "$x_includes"],
234
[GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}"])]
235
AS_IF([test -n "$x_libraries"],
236
[GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}"]))
238
ax_save_CPPFLAGS="${CPPFLAGS}"
239
CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
240
AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h])
241
CPPFLAGS="${ax_save_CPPFLAGS}"
243
AC_CHECK_HEADERS([windows.h])
245
m4_define([AX_CHECK_GL_PROGRAM],
247
# if defined(HAVE_WINDOWS_H) && defined(_WIN32)
246
248
# include <windows.h>
248
# include <GL/gl.h>]],
250
[ax_cv_check_gl_libgl="${ax_try_lib}"; break])
253
CPPFLAGS=${ax_save_CPPFLAGS}])
255
if test "X${ax_cv_check_gl_libgl}" = "Xno"; then
260
GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}"
252
# elif defined(HAVE_OPENGL_GL_H)
253
# include <OpenGL/gl.h>
259
AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],
260
[ax_cv_check_gl_libgl="no"
262
x86_64) ax_check_gl_libdir=lib64 ;;
263
*) ax_check_gl_libdir=lib ;;
265
ax_save_CPPFLAGS="${CPPFLAGS}"
266
CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
267
ax_save_LIBS="${LIBS}"
269
ax_check_libs="-lopengl32 -lGL"
270
for ax_lib in ${ax_check_libs}; do
271
AS_IF([test X$ax_compiler_ms = Xyes],
272
[ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`],
273
[ax_try_lib="${ax_lib}"])
274
LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
275
AC_LINK_IFELSE([AX_CHECK_GL_PROGRAM],
276
[ax_cv_check_gl_libgl="${ax_try_lib}"; break],
277
[ax_check_gl_nvidia_flags="-L/usr/${ax_check_gl_libdir}/nvidia" LIBS="${ax_try_lib} ${ax_check_gl_nvidia_flags} ${GL_LIBS} ${ax_save_LIBS}"
278
AC_LINK_IFELSE([AX_CHECK_GL_PROGRAM],
279
[ax_cv_check_gl_libgl="${ax_try_lib} ${ax_check_gl_nvidia_flags}"; break],
280
[ax_check_gl_dylib_flag='-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib' LIBS="${ax_try_lib} ${ax_check_gl_dylib_flag} ${GL_LIBS} ${ax_save_LIBS}"
281
AC_LINK_IFELSE([AX_CHECK_GL_PROGRAM],
282
[ax_cv_check_gl_libgl="${ax_try_lib} ${ax_check_gl_dylib_flag}"; break])])])
285
AS_IF([test "X$ax_cv_check_gl_libgl" = Xno -a "X$no_x" = Xyes],
286
[LIBS='-framework OpenGL'
287
AC_LINK_IFELSE([AX_CHECK_GL_PROGRAM],
288
[ax_cv_check_gl_libgl="$LIBS"])])
291
CPPFLAGS=${ax_save_CPPFLAGS}])
293
AS_IF([test "X$ax_cv_check_gl_libgl" = Xno],
294
[no_gl=yes; GL_CFLAGS=""; GL_LIBS=""],
295
[GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}"])
265
298
AC_SUBST([GL_CFLAGS])
266
299
AC_SUBST([GL_LIBS])
271
304
dnl http://www.gnu.org/software/ac-archive/ax_check_glu.html
272
305
dnl ---------------------------------------------------------------------------
274
dnl @synopsis AX_CHECK_GLU
276
dnl Check for GLU. If GLU is found, the required preprocessor and
277
dnl linker flags are included in the output variables "GLU_CFLAGS" and
278
dnl "GLU_LIBS", respectively. This macro adds the configure option
279
dnl "--with-apple-opengl-framework", which users can use to indicate
280
dnl that Apple's OpenGL framework should be used on Mac OS X. If
281
dnl Apple's OpenGL framework is used, the symbol
282
dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GLU implementation
283
dnl is found, "no_glu" is set to "yes".
285
dnl @category InstalledPackages
286
dnl @author Braden McDaniel <braden@endoframe.com>
287
dnl @version 2004-11-15
288
dnl @license AllPermissive
313
dnl Check for GLU. If GLU is found, the required preprocessor and linker
314
dnl flags are included in the output variables "GLU_CFLAGS" and "GLU_LIBS",
315
dnl respectively. If no GLU implementation is found, "no_glu" is set to
318
dnl If the header "GL/glu.h" is found, "HAVE_GL_GLU_H" is defined. If the
319
dnl header "OpenGL/glu.h" is found, HAVE_OPENGL_GLU_H is defined. These
320
dnl preprocessor definitions may not be mutually exclusive.
322
dnl Some implementations (in particular, some versions of Mac OS X) are
323
dnl known to treat the GLU tesselator callback function type as "GLvoid
324
dnl (*)(...)" rather than the standard "GLvoid (*)()". If the former
325
dnl condition is detected, this macro defines "HAVE_VARARGS_GLU_TESSCB".
329
dnl Copyright (c) 2009 Braden McDaniel <braden@endoframe.com>
331
dnl This program is free software; you can redistribute it and/or modify it
332
dnl under the terms of the GNU General Public License as published by the
333
dnl Free Software Foundation; either version 2 of the License, or (at your
334
dnl option) any later version.
336
dnl This program is distributed in the hope that it will be useful, but
337
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
338
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
339
dnl Public License for more details.
341
dnl You should have received a copy of the GNU General Public License along
342
dnl with this program. If not, see <http://www.gnu.org/licenses/>.
344
dnl As a special exception, the respective Autoconf Macro's copyright owner
345
dnl gives unlimited permission to copy, distribute and modify the configure
346
dnl scripts that are the output of Autoconf when processing the Macro. You
347
dnl need not follow the terms of the GNU General Public License when using
348
dnl or distributing such scripts, even though portions of the text of the
349
dnl Macro appear in them. The GNU General Public License (GPL) does govern
350
dnl all other use of the material that constitutes the Autoconf Macro.
352
dnl This special exception to the GPL applies to versions of the Autoconf
353
dnl Macro released by the Autoconf Archive. When you make and distribute a
354
dnl modified version of the Autoconf Macro, you may extend this special
355
dnl exception to the GPL to apply to your modified version as well.
290
357
AC_DEFUN([AX_CHECK_GLU],
291
358
[AC_REQUIRE([AX_CHECK_GL])dnl
292
359
AC_REQUIRE([AC_PROG_CXX])dnl
293
360
GLU_CFLAGS="${GL_CFLAGS}"
294
if test "X${with_apple_opengl_framework}" != "Xyes"; then
295
AC_CACHE_CHECK([for OpenGL Utility library], [ax_cv_check_glu_libglu],
296
[ax_cv_check_glu_libglu="no"
297
ax_save_CPPFLAGS="${CPPFLAGS}"
298
CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
299
ax_save_LIBS="${LIBS}"
301
ax_check_libs="-lglu32 -lGLU"
302
for ax_lib in ${ax_check_libs}; do
303
if test X$ax_compiler_ms = Xyes; then
304
ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
306
ax_try_lib="${ax_lib}"
308
LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
310
# libGLU typically links with libstdc++ on POSIX platforms. However,
311
# setting the language to C++ means that test program source is named
312
# "conftest.cc"; and Microsoft cl doesn't know what to do with such a
316
if test X$ax_compiler_ms = Xyes; then
321
# if HAVE_WINDOWS_H && defined(_WIN32)
362
ax_save_CPPFLAGS="${CPPFLAGS}"
363
CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
364
AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h])
365
CPPFLAGS="${ax_save_CPPFLAGS}"
367
m4_define([AX_CHECK_GLU_PROGRAM],
369
# if defined(HAVE_WINDOWS_H) && defined(_WIN32)
322
370
# include <windows.h>
324
# include <GL/glu.h>]],
325
[[gluBeginCurve(0)]])],
326
[ax_cv_check_glu_libglu="${ax_try_lib}"; break])
327
if test X$ax_compiler_ms = Xyes; then
333
CPPFLAGS=${ax_save_CPPFLAGS}])
334
if test "X${ax_cv_check_glu_libglu}" = "Xno"; then
339
GLU_LIBS="${ax_cv_check_glu_libglu} ${GL_LIBS}"
372
# ifdef HAVE_GL_GLU_H
374
# elif defined(HAVE_OPENGL_GLU_H)
375
# include <OpenGL/glu.h>
379
[[gluBeginCurve(0)]])])
381
AC_CACHE_CHECK([for OpenGL Utility library], [ax_cv_check_glu_libglu],
382
[ax_cv_check_glu_libglu="no"
383
ax_save_CPPFLAGS="${CPPFLAGS}"
384
CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
385
ax_save_LIBS="${LIBS}"
388
dnl First, check for the possibility that everything we need is already in
391
LIBS="${GL_LIBS} ${ax_save_LIBS}"
393
dnl libGLU typically links with libstdc++ on POSIX platforms.
394
dnl However, setting the language to C++ means that test program
395
dnl source is named "conftest.cc"; and Microsoft cl doesn't know what
396
dnl to do with such a file.
399
AS_IF([test X$ax_compiler_ms = Xyes],
402
[AX_CHECK_GLU_PROGRAM],
403
[ax_cv_check_glu_libglu=yes],
405
ax_check_libs="-lglu32 -lGLU"
406
for ax_lib in ${ax_check_libs}; do
407
AS_IF([test X$ax_compiler_ms = Xyes],
408
[ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`],
409
[ax_try_lib="${ax_lib}"])
410
LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
411
AC_LINK_IFELSE([AX_CHECK_GLU_PROGRAM],
412
[ax_cv_check_glu_libglu="${ax_try_lib}"; break])
415
AS_IF([test X$ax_compiler_ms = Xyes],
420
CPPFLAGS=${ax_save_CPPFLAGS}])
421
AS_IF([test "X$ax_cv_check_glu_libglu" = Xno],
422
[no_glu=yes; GLU_CFLAGS=""; GLU_LIBS=""],
423
[AS_IF([test "X$ax_cv_check_glu_libglu" = Xyes],
424
[GLU_LIBS="$GL_LIBS"],
425
[GLU_LIBS="${ax_cv_check_glu_libglu} ${GL_LIBS}"])])
342
426
AC_SUBST([GLU_CFLAGS])
343
427
AC_SUBST([GLU_LIBS])
430
dnl Some versions of Mac OS X include a broken interpretation of the GLU
431
dnl tesselation callback function signature.
433
AS_IF([test "X$ax_cv_check_glu_libglu" != Xno],
434
[AC_CACHE_CHECK([for varargs GLU tesselator callback function type],
435
[ax_cv_varargs_glu_tesscb],
436
[ax_cv_varargs_glu_tesscb=no
437
ax_save_CFLAGS="$CFLAGS"
438
CFLAGS="$GL_CFLAGS $CFLAGS"
441
# ifdef HAVE_GL_GLU_H
444
# include <OpenGL/glu.h>
446
[[GLvoid (*func)(...); gluTessCallback(0, 0, func)]])],
447
[ax_cv_varargs_glu_tesscb=yes])
448
CFLAGS="$ax_save_CFLAGS"])
449
AS_IF([test X$ax_cv_varargs_glu_tesscb = Xyes],
450
[AC_DEFINE([HAVE_VARARGS_GLU_TESSCB], [1],
451
[Use nonstandard varargs form for the GLU tesselator callback])])])
346
454
dnl ---------------------------------------------------------------------------
348
456
dnl http://www.gnu.org/software/ac-archive/ax_check_glut.html
349
457
dnl ---------------------------------------------------------------------------
351
dnl @synopsis AX_CHECK_GLUT
353
dnl Check for GLUT. If GLUT is found, the required compiler and linker
354
dnl flags are included in the output variables "GLUT_CFLAGS" and
355
dnl "GLUT_LIBS", respectively. This macro adds the configure option
356
dnl "--with-apple-opengl-framework", which users can use to indicate
357
dnl that Apple's OpenGL framework should be used on Mac OS X. If
358
dnl Apple's OpenGL framework is used, the symbol
359
dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If GLUT is not found,
360
dnl "no_glut" is set to "yes".
362
dnl @category InstalledPackages
363
dnl @author Braden McDaniel <braden@endoframe.com>
364
dnl @version 2004-11-15
365
dnl @license AllPermissive
466
dnl Check for GLUT. If GLUT is found, the required compiler and linker flags
467
dnl are included in the output variables "GLUT_CFLAGS" and "GLUT_LIBS",
468
dnl respectively. If GLUT is not found, "no_glut" is set to "yes".
470
dnl If the header "GL/glut.h" is found, "HAVE_GL_GLUT_H" is defined. If the
471
dnl header "GLUT/glut.h" is found, HAVE_GLUT_GLUT_H is defined. These
472
dnl preprocessor definitions may not be mutually exclusive.
476
dnl Copyright (c) 2009 Braden McDaniel <braden@endoframe.com>
478
dnl This program is free software; you can redistribute it and/or modify it
479
dnl under the terms of the GNU General Public License as published by the
480
dnl Free Software Foundation; either version 2 of the License, or (at your
481
dnl option) any later version.
483
dnl This program is distributed in the hope that it will be useful, but
484
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
485
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
486
dnl Public License for more details.
488
dnl You should have received a copy of the GNU General Public License along
489
dnl with this program. If not, see <http://www.gnu.org/licenses/>.
491
dnl As a special exception, the respective Autoconf Macro's copyright owner
492
dnl gives unlimited permission to copy, distribute and modify the configure
493
dnl scripts that are the output of Autoconf when processing the Macro. You
494
dnl need not follow the terms of the GNU General Public License when using
495
dnl or distributing such scripts, even though portions of the text of the
496
dnl Macro appear in them. The GNU General Public License (GPL) does govern
497
dnl all other use of the material that constitutes the Autoconf Macro.
499
dnl This special exception to the GPL applies to versions of the Autoconf
500
dnl Macro released by the Autoconf Archive. When you make and distribute a
501
dnl modified version of the Autoconf Macro, you may extend this special
502
dnl exception to the GPL to apply to your modified version as well.
367
504
AC_DEFUN([AX_CHECK_GLUT],
368
505
[AC_REQUIRE([AX_CHECK_GLU])dnl
369
506
AC_REQUIRE([AC_PATH_XTRA])dnl
371
if test "X$with_apple_opengl_framework" = "Xyes"; then
372
GLUT_CFLAGS="${GLU_CFLAGS}"
373
GLUT_LIBS="-framework GLUT -lobjc ${GL_LIBS}"
375
GLUT_CFLAGS=${GLU_CFLAGS}
376
GLUT_LIBS=${GLU_LIBS}
379
# If X is present, assume GLUT depends on it.
381
if test "X${no_x}" != "Xyes"; then
382
GLUT_LIBS="${X_PRE_LIBS} -lXmu -lXi ${X_EXTRA_LIBS} ${GLUT_LIBS}"
387
ax_save_CPPFLAGS="${CPPFLAGS}"
388
CPPFLAGS="${GLUT_CFLAGS} ${CPPFLAGS}"
390
AC_CACHE_CHECK([for GLUT library], [ax_cv_check_glut_libglut],
391
[ax_cv_check_glut_libglut="no"
392
ax_save_LIBS="${LIBS}"
394
ax_check_libs="-lglut32 -lglut"
395
for ax_lib in ${ax_check_libs}; do
396
if test X$ax_compiler_ms = Xyes; then
397
ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
399
ax_try_lib="${ax_lib}"
401
LIBS="${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}"
508
ax_save_CPPFLAGS="${CPPFLAGS}"
509
CPPFLAGS="${GLU_CFLAGS} ${CPPFLAGS}"
510
AC_CHECK_HEADERS([GL/glut.h GLUT/glut.h])
511
CPPFLAGS="${ax_save_CPPFLAGS}"
513
GLUT_CFLAGS=${GLU_CFLAGS}
514
GLUT_LIBS=${GLU_LIBS}
516
m4_define([AX_CHECK_GLUT_PROGRAM],
404
518
# if HAVE_WINDOWS_H && defined(_WIN32)
405
519
# include <windows.h>
407
# include <GL/glut.h>]],
408
[[glutMainLoop()]])],
409
[ax_cv_check_glut_libglut="${ax_try_lib}"; break])
414
CPPFLAGS="${ax_save_CPPFLAGS}"
417
if test "X${ax_cv_check_glut_libglut}" = "Xno"; then
422
GLUT_LIBS="${ax_cv_check_glut_libglut} ${GLUT_LIBS}"
521
# ifdef HAVE_GL_GLUT_H
522
# include <GL/glut.h>
523
# elif defined(HAVE_GLUT_GLUT_H)
524
# include <GLUT/glut.h>
528
[[glutMainLoop()]])])
531
dnl If X is present, assume GLUT depends on it.
533
AS_IF([test X$no_x != Xyes],
534
[GLUT_LIBS="${X_PRE_LIBS} -lXi ${X_EXTRA_LIBS} ${GLUT_LIBS}"])
536
AC_CACHE_CHECK([for GLUT library], [ax_cv_check_glut_libglut],
537
[ax_cv_check_glut_libglut="no"
539
ax_save_CPPFLAGS="${CPPFLAGS}"
540
CPPFLAGS="${GLUT_CFLAGS} ${CPPFLAGS}"
541
ax_save_LIBS="${LIBS}"
543
ax_check_libs="-lglut32 -lglut"
544
for ax_lib in ${ax_check_libs}; do
545
AS_IF([test X$ax_compiler_ms = Xyes],
546
[ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`],
547
[ax_try_lib="${ax_lib}"])
548
LIBS="${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}"
549
AC_LINK_IFELSE([AX_CHECK_GLUT_PROGRAM],
550
[ax_cv_check_glut_libglut="${ax_try_lib}"; break])
553
AS_IF([test "X$ax_cv_check_glut_libglut" = Xno -a "X$no_x" = Xyes],
554
[LIBS='-framework GLUT'
555
AC_LINK_IFELSE([AX_CHECK_GLUT_PROGRAM],
556
[ax_cv_check_glut_libglut="$LIBS"])])
558
CPPFLAGS="${ax_save_CPPFLAGS}"
559
LIBS="${ax_save_LIBS}"
562
AS_IF([test "X$ax_cv_check_glut_libglut" = Xno],
563
[no_glut="yes"; GLUT_CFLAGS=""; GLUT_LIBS=""],
564
[GLUT_LIBS="${ax_cv_check_glut_libglut} ${GLUT_LIBS}"])
426
566
AC_SUBST([GLUT_CFLAGS])
427
567
AC_SUBST([GLUT_LIBS])
430
570
dnl ---------------------------------------------------------------------------
431
571
dnl Available from the GNU Autoconf Macro Archive at:
432
dnl http://www.gnu.org/software/ac-archive/acx_pthread.html
572
dnl http://www.gnu.org/software/autoconf-archive/ax_pthread.html
433
573
dnl ---------------------------------------------------------------------------
435
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
437
dnl This macro figures out how to build C programs using POSIX threads.
438
dnl It sets the PTHREAD_LIBS output variable to the threads library and
439
dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
440
dnl C compiler flags that are needed. (The user can also force certain
441
dnl compiler flags/libs to be tested by setting these environment
444
dnl Also sets PTHREAD_CC to any special C compiler that is needed for
445
dnl multi-threaded programs (defaults to the value of CC otherwise).
446
dnl (This is necessary on AIX to use the special cc_r compiler alias.)
448
dnl NOTE: You are assumed to not only compile your program with these
449
dnl flags, but also link it with them as well. e.g. you should link
450
dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
453
dnl If you are only building threads programs, you may wish to use
454
dnl these variables in your default LIBS, CFLAGS, and CC:
456
dnl LIBS="$PTHREAD_LIBS $LIBS"
457
dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
460
dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
461
dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
462
dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
464
dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
465
dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
466
dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
467
dnl default action will define HAVE_PTHREAD.
469
dnl Please let the authors know if this macro fails on any platform, or
470
dnl if you have any other suggestions or comments. This macro was based
471
dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
472
dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
473
dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
474
dnl We are also grateful for the helpful feedback of numerous users.
476
dnl @category InstalledPackages
477
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
478
dnl @version 2005-01-14
479
dnl @license GPLWithACException
577
dnl AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
581
dnl This macro figures out how to build C programs using POSIX threads. It
582
dnl sets the PTHREAD_LIBS output variable to the threads library and linker
583
dnl flags, and the PTHREAD_CFLAGS output variable to any special C compiler
584
dnl flags that are needed. (The user can also force certain compiler
585
dnl flags/libs to be tested by setting these environment variables.)
587
dnl Also sets PTHREAD_CC to any special C compiler that is needed for
588
dnl multi-threaded programs (defaults to the value of CC otherwise). (This
589
dnl is necessary on AIX to use the special cc_r compiler alias.)
591
dnl NOTE: You are assumed to not only compile your program with these flags,
592
dnl but also link it with them as well. e.g. you should link with
593
dnl $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
595
dnl If you are only building threads programs, you may wish to use these
596
dnl variables in your default LIBS, CFLAGS, and CC:
598
dnl LIBS="$PTHREAD_LIBS $LIBS"
599
dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
602
dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
603
dnl has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
604
dnl (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
606
dnl ACTION-IF-FOUND is a list of shell commands to run if a threads library
607
dnl is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
608
dnl is not found. If ACTION-IF-FOUND is not specified, the default action
609
dnl will define HAVE_PTHREAD.
611
dnl Please let the authors know if this macro fails on any platform, or if
612
dnl you have any other suggestions or comments. This macro was based on work
613
dnl by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
614
dnl from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
615
dnl Alejandro Forero Cuervo to the autoconf macro repository. We are also
616
dnl grateful for the helpful feedback of numerous users.
620
dnl Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
622
dnl This program is free software: you can redistribute it and/or modify it
623
dnl under the terms of the GNU General Public License as published by the
624
dnl Free Software Foundation, either version 3 of the License, or (at your
625
dnl option) any later version.
627
dnl This program is distributed in the hope that it will be useful, but
628
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
629
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
630
dnl Public License for more details.
632
dnl You should have received a copy of the GNU General Public License along
633
dnl with this program. If not, see <http://www.gnu.org/licenses/>.
635
dnl As a special exception, the respective Autoconf Macro's copyright owner
636
dnl gives unlimited permission to copy, distribute and modify the configure
637
dnl scripts that are the output of Autoconf when processing the Macro. You
638
dnl need not follow the terms of the GNU General Public License when using
639
dnl or distributing such scripts, even though portions of the text of the
640
dnl Macro appear in them. The GNU General Public License (GPL) does govern
641
dnl all other use of the material that constitutes the Autoconf Macro.
643
dnl This special exception to the GPL applies to versions of the Autoconf
644
dnl Macro released by the Autoconf Archive. When you make and distribute a
645
dnl modified version of the Autoconf Macro, you may extend this special
646
dnl exception to the GPL to apply to your modified version as well.
481
AC_DEFUN([ACX_PTHREAD], [
648
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
649
AC_DEFUN([AX_PTHREAD], [
482
650
AC_REQUIRE([AC_CANONICAL_HOST])
487
# We used to check for pthread.h first, but this fails if pthread.h
488
# requires special compiler flags (e.g. on True64 or Sequent).
489
# It gets checked for in the link test anyway.
491
# First of all, check if the user has set any of the PTHREAD_LIBS,
492
# etcetera environment variables, and if threads linking works using
655
dnl We used to check for pthread.h first, but this fails if pthread.h
656
dnl requires special compiler flags (e.g. on True64 or Sequent).
657
dnl It gets checked for in the link test anyway.
659
dnl First of all, check if the user has set any of the PTHREAD_LIBS,
660
dnl etcetera environment variables, and if threads linking works using
494
662
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
495
663
save_CFLAGS="$CFLAGS"
496
664
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
497
665
save_LIBS="$LIBS"
498
666
LIBS="$PTHREAD_LIBS $LIBS"
499
667
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
500
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
501
AC_MSG_RESULT($acx_pthread_ok)
502
if test x"$acx_pthread_ok" = xno; then
668
AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
669
AC_MSG_RESULT($ax_pthread_ok)
670
if test x"$ax_pthread_ok" = xno; then
504
672
PTHREAD_CFLAGS=""
507
675
CFLAGS="$save_CFLAGS"
510
# We must check for the threads library under a number of different
511
# names; the ordering is very important because some systems
512
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
513
# libraries is broken (non-POSIX).
515
# Create a list of thread flags to try. Items starting with a "-" are
516
# C compiler flags, and other items are library names, except for "none"
517
# which indicates that we try without any flags at all, and "pthread-config"
518
# which is a program returning the flags for the Pth emulation library.
520
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
522
# The ordering *is* (sometimes) important. Some notes on the
523
# individual items follow:
525
# pthreads: AIX (must check this before -lpthread)
526
# none: in case threads are in libc; should be tried before -Kthread and
527
# other compiler flags to prevent continual compiler warnings
528
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
529
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
530
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
531
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
532
# -pthreads: Solaris/gcc
533
# -mthreads: Mingw32/gcc, Lynx/gcc
534
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
535
# doesn't hurt to check since this sometimes defines pthreads too;
536
# also defines -D_REENTRANT)
537
# pthread: Linux, etcetera
538
# --thread-safe: KAI C++
539
# pthread-config: use pthread-config program (for GNU Pth library)
678
dnl We must check for the threads library under a number of different
679
dnl names; the ordering is very important because some systems
680
dnl (e.g. DEC) have both -lpthread and -lpthreads, where one of the
681
dnl libraries is broken (non-POSIX).
683
dnl Create a list of thread flags to try. Items starting with a "-" are
684
dnl C compiler flags, and other items are library names, except for "none"
685
dnl which indicates that we try without any flags at all, and "pthread-config"
686
dnl which is a program returning the flags for the Pth emulation library.
688
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
690
dnl The ordering *is* (sometimes) important. Some notes on the
691
dnl individual items follow:
693
dnl pthreads: AIX (must check this before -lpthread)
694
dnl none: in case threads are in libc; should be tried before -Kthread and
695
dnl other compiler flags to prevent continual compiler warnings
696
dnl -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
697
dnl -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
698
dnl lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
699
dnl -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
700
dnl -pthreads: Solaris/gcc
701
dnl -mthreads: Mingw32/gcc, Lynx/gcc
702
dnl -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
703
dnl doesn't hurt to check since this sometimes defines pthreads too;
704
dnl also defines -D_REENTRANT)
705
dnl ... -mt is also the pthreads flag for HP/aCC
706
dnl pthread: Linux, etcetera
707
dnl --thread-safe: KAI C++
708
dnl pthread-config: use pthread-config program (for GNU Pth library)
541
710
case "${host_cpu}-${host_os}" in
544
# On Solaris (at least, for some versions), libc contains stubbed
545
# (non-functional) versions of the pthreads routines, so link-based
546
# tests will erroneously succeed. (We need to link with -pthread or
547
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
548
# a function called by this macro, so we could check for that, but
549
# who knows whether they'll stub that too in a future libc.) So,
550
# we'll just look for -pthreads and -lpthread first:
713
dnl On Solaris (at least, for some versions), libc contains stubbed
714
dnl (non-functional) versions of the pthreads routines, so link-based
715
dnl tests will erroneously succeed. (We need to link with -pthreads/-mt/
716
dnl -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
717
dnl a function called by this macro, so we could check for that, but
718
dnl who knows whether they'll stub that too in a future libc.) So,
719
dnl we'll just look for -pthreads and -lpthread first:
552
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
721
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
725
ax_pthread_flags="-pthread $ax_pthread_flags"
556
if test x"$acx_pthread_ok" = xno; then
557
for flag in $acx_pthread_flags; do
729
if test x"$ax_pthread_ok" = xno; then
730
for flag in $ax_pthread_flags; do
584
757
LIBS="$PTHREAD_LIBS $LIBS"
585
758
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
587
# Check for various functions. We must include pthread.h,
588
# since some functions may be macros. (On the Sequent, we
589
# need a special flag -Kthread to make this header compile.)
590
# We check for pthread_join because it is in -lpthread on IRIX
591
# while pthread_create is in libc. We check for pthread_attr_init
592
# due to DEC craziness with -lpthreads. We check for
593
# pthread_cleanup_push because it is one of the few pthread
594
# functions on Solaris that doesn't have a non-functional libc stub.
595
# We try pthread_create on general principles.
596
AC_TRY_LINK([#include <pthread.h>],
597
[pthread_t th; pthread_join(th, 0);
598
pthread_attr_init(0); pthread_cleanup_push(0, 0);
599
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
600
[acx_pthread_ok=yes])
760
dnl Check for various functions. We must include pthread.h,
761
dnl since some functions may be macros. (On the Sequent, we
762
dnl need a special flag -Kthread to make this header compile.)
763
dnl We check for pthread_join because it is in -lpthread on IRIX
764
dnl while pthread_create is in libc. We check for pthread_attr_init
765
dnl due to DEC craziness with -lpthreads. We check for
766
dnl pthread_cleanup_push because it is one of the few pthread
767
dnl functions on Solaris that doesn't have a non-functional libc stub.
768
dnl We try pthread_create on general principles.
769
AC_TRY_LINK([#include <pthread.h>
770
static void routine(void* a) {a=0;}
771
static void* start_routine(void* a) {return a;}],
772
[pthread_t th; pthread_attr_t attr;
773
pthread_create(&th,0,start_routine,0);
775
pthread_attr_init(&attr);
776
pthread_cleanup_push(routine, 0);
777
pthread_cleanup_pop(0); ],
602
780
LIBS="$save_LIBS"
603
781
CFLAGS="$save_CFLAGS"
605
AC_MSG_RESULT($acx_pthread_ok)
606
if test "x$acx_pthread_ok" = xyes; then
783
AC_MSG_RESULT($ax_pthread_ok)
784
if test "x$ax_pthread_ok" = xyes; then