]>
Commit | Line | Data |
---|---|---|
e1cc8bba AF |
1 | diff -ruN 3ddesktop-0.2.0.orig/acinclude.m4 3ddesktop-0.2.0/acinclude.m4 |
2 | --- 3ddesktop-0.2.0.orig/acinclude.m4 Thu Jan 1 01:00:00 1970 | |
3 | +++ 3ddesktop-0.2.0/acinclude.m4 Fri Aug 9 17:19:09 2002 | |
4 | @@ -0,0 +1,172 @@ | |
5 | + | |
6 | +dnl ########################### -*- Mode: M4 -*- ####################### | |
7 | +dnl Copyright (C) 98, 1999 Matthew D. Langston <langston@SLAC.Stanford.EDU> | |
8 | +dnl | |
9 | +dnl This file is free software; you can redistribute it and/or modify it | |
10 | +dnl under the terms of the GNU General Public License as published by | |
11 | +dnl the Free Software Foundation; either version 2 of the License, or | |
12 | +dnl (at your option) any later version. | |
13 | +dnl | |
14 | +dnl This file is distributed in the hope that it will be useful, but | |
15 | +dnl WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | +dnl General Public License for more details. | |
18 | +dnl | |
19 | +dnl You should have received a copy of the GNU General Public License | |
20 | +dnl along with this file; if not, write to: | |
21 | +dnl | |
22 | +dnl Free Software Foundation, Inc. | |
23 | +dnl Suite 330 | |
24 | +dnl 59 Temple Place | |
25 | +dnl Boston, MA 02111-1307, USA. | |
26 | +dnl #################################################################### | |
27 | + | |
28 | + | |
29 | +dnl @synopsis MDL_HAVE_OPENGL | |
9ddb814d | 30 | +dnl |
e1cc8bba AF |
31 | +dnl Search for OpenGL. We search first for Mesa (a GPL'ed version of |
32 | +dnl OpenGL) before a vendor's version of OpenGL, unless we were | |
33 | +dnl specifically asked not to with `--with-Mesa=no' or `--without-Mesa'. | |
34 | +dnl | |
35 | +dnl The four "standard" OpenGL libraries are searched for: "-lGL", | |
36 | +dnl "-lGLU", "-lGLX" (or "-lMesaGL", "-lMesaGLU" as the case may be) and | |
37 | +dnl "-lglut". | |
38 | +dnl | |
39 | +dnl All of the libraries that are found (since "-lglut" or "-lGLX" might | |
40 | +dnl be missing) are added to the shell output variable "GL_LIBS", along | |
41 | +dnl with any other libraries that are necessary to successfully link an | |
42 | +dnl OpenGL application (e.g. the X11 libraries). Care has been taken to | |
43 | +dnl make sure that all of the libraries in "GL_LIBS" are listed in the | |
44 | +dnl proper order. | |
45 | +dnl | |
46 | +dnl Additionally, the shell output variable "GL_CFLAGS" is set to any | |
47 | +dnl flags (e.g. "-I" flags) that are necessary to successfully compile | |
48 | +dnl an OpenGL application. | |
49 | +dnl | |
50 | +dnl The following shell variable (which are not output variables) are | |
51 | +dnl also set to either "yes" or "no" (depending on which libraries were | |
52 | +dnl found) to help you determine exactly what was found. | |
53 | +dnl | |
54 | +dnl have_GL | |
55 | +dnl have_GLU | |
56 | +dnl have_GLX | |
57 | +dnl have_glut | |
58 | +dnl | |
59 | +dnl A complete little toy "Automake `make distcheck'" package of how to | |
60 | +dnl use this macro is available at: | |
61 | +dnl | |
62 | +dnl ftp://ftp.slac.stanford.edu/users/langston/autoconf/ac_opengl-0.01.tar.gz | |
63 | +dnl | |
64 | +dnl Please note that as the ac_opengl macro and the toy example evolves, | |
65 | +dnl the version number increases, so you may have to adjust the above | |
66 | +dnl URL accordingly. | |
67 | +dnl | |
68 | +dnl @version 0.01 $Id$ | |
69 | +dnl @author Matthew D. Langston <langston@SLAC.Stanford.EDU> | |
70 | + | |
71 | +AC_DEFUN([MDL_HAVE_OPENGL], | |
72 | +[ | |
73 | + AC_REQUIRE([AC_PROG_CC]) | |
74 | + AC_REQUIRE([AC_PATH_X]) | |
75 | + AC_REQUIRE([AC_PATH_XTRA]) | |
76 | + AC_REQUIRE([MDL_CHECK_LIBM]) | |
77 | + | |
78 | + AC_CACHE_CHECK([for OpenGL], mdl_cv_have_OpenGL, | |
79 | + [ | |
80 | +dnl Check for Mesa first, unless we were asked not to. | |
81 | + AC_ARG_ENABLE(Mesa,[ | |
82 | + AC_HELP_STRING([--with-Mesa], | |
83 | + [Prefer the Mesa library over a vendors native OpenGL library (default is yes)]) | |
84 | + ], use_Mesa=$enableval, use_Mesa=yes) | |
85 | + | |
86 | + if test x"$use_Mesa" = xyes; then | |
87 | + GL_search_list="MesaGL GL" | |
88 | + GLU_search_list="MesaGLU GLU" | |
89 | + GLX_search_list="MesaGLX GLX" | |
90 | + else | |
91 | + GL_search_list="GL MesaGL" | |
92 | + GLU_search_list="GLU MesaGLU" | |
93 | + GLX_search_list="GLX MesaGLX" | |
94 | + fi | |
95 | + | |
96 | + AC_LANG_SAVE | |
97 | + AC_LANG_C | |
98 | + | |
99 | +dnl If we are running under X11 then add in the appropriate libraries. | |
100 | + if ! test x"$no_x" = xyes; then | |
101 | +dnl Add everything we need to compile and link X programs to GL_CFLAGS | |
102 | +dnl and GL_X_LIBS. | |
103 | + GL_CFLAGS="$X_CFLAGS" | |
104 | + GL_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS $LIBM" | |
105 | + fi | |
106 | + GL_save_CPPFLAGS="$CPPFLAGS" | |
107 | + CPPFLAGS="$GL_CFLAGS" | |
108 | + | |
109 | + GL_save_LIBS="$LIBS" | |
110 | + LIBS="$GL_X_LIBS" | |
111 | + | |
112 | + # Save the "AC_MSG_RESULT file descriptor" to FD 8. | |
113 | + exec 8>&AC_FD_MSG | |
114 | + | |
115 | + # Temporarily turn off AC_MSG_RESULT so that the user gets pretty | |
116 | + # messages. | |
117 | + exec AC_FD_MSG>/dev/null | |
118 | + | |
119 | + AC_SEARCH_LIBS(glAccum, $GL_search_list, have_GL=yes, have_GL=no) | |
120 | + AC_SEARCH_LIBS(gluBeginCurve, $GLU_search_list, have_GLU=yes, have_GLU=no) | |
121 | + AC_SEARCH_LIBS(glXChooseVisual, $GLX_search_list, have_GLX=yes, have_GLX=no) | |
122 | + AC_SEARCH_LIBS(glutInit, glut, have_glut=yes, have_glut=no) | |
123 | + | |
124 | + # Restore pretty messages. | |
125 | + exec AC_FD_MSG>&8 | |
126 | + | |
127 | + if test -n "$LIBS"; then | |
128 | + mdl_cv_have_OpenGL=yes | |
129 | + GL_LIBS="$LIBS" | |
130 | + AC_SUBST(GL_CFLAGS) | |
131 | + AC_SUBST(GL_LIBS) | |
132 | + else | |
133 | + mdl_cv_have_OpenGL=no | |
134 | + GL_CFLAGS= | |
135 | + fi | |
136 | + | |
137 | +dnl Reset GL_X_LIBS regardless, since it was just a temporary variable | |
138 | +dnl and we don't want to be global namespace polluters. | |
139 | + GL_X_LIBS= | |
140 | + | |
141 | + LIBS="$GL_save_LIBS" | |
142 | + CPPFLAGS="$GL_save_CPPFLAGS" | |
143 | + | |
144 | + AC_LANG_RESTORE | |
145 | + ]) | |
146 | +]) | |
147 | + | |
148 | + | |
149 | +dnl @synopsis MDL_CHECK_LIBM | |
150 | +dnl | |
151 | +dnl Search for math library (typically -lm). | |
152 | +dnl | |
153 | +dnl The variable LIBM (which is not an output variable by default) is | |
154 | +dnl set to a value which is suitable for use in a Makefile (for example, | |
155 | +dnl in make's LOADLIBES macro) provided you AC_SUBST it first. | |
156 | +dnl | |
157 | +dnl @version 0.01 $Id$ | |
158 | +dnl @author Matthew D. Langston <langston@SLAC.Stanford.EDU> | |
159 | + | |
160 | +# AC_CHECK_LIBM - check for math library | |
161 | +AC_DEFUN([MDL_CHECK_LIBM], | |
162 | +[AC_REQUIRE([AC_CANONICAL_HOST])dnl | |
163 | +LIBM= | |
164 | +case "$host" in | |
165 | +*-*-beos* | *-*-cygwin*) | |
166 | + # These system don't have libm | |
167 | + ;; | |
168 | +*-ncr-sysv4.3*) | |
169 | + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") | |
170 | + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") | |
171 | + ;; | |
172 | +*) | |
173 | + AC_CHECK_LIB(m, main, LIBM="-lm") | |
174 | + ;; | |
175 | +esac | |
176 | +]) |