File: acinclude.m4

package info (click to toggle)
nurbs%2B%2B 3.0.10-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,332 kB
  • ctags: 2,934
  • sloc: cpp: 26,350; sh: 22,675; makefile: 277; ansic: 17
file content (383 lines) | stat: -rw-r--r-- 9,722 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
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

dnl CXX_HAVE_TEMPLATE_OF_TEMPLATE
dnl ---------------------------------------
dnl
dnl If the C++ compiler supports templates of templates,
dnl define `HAVE_TEMPLATE_OF_TEMPLATE'.
dnl
AC_DEFUN(CXX_HAVE_TEMPLATE_OF_TEMPLATE,
[
AC_REQUIRE([AC_PROG_CXX])
AC_MSG_CHECKING(whether ${CXX} supports template of templates)
AC_CACHE_VAL(cxx_have_template_of_template,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
template <class T, int N> struct Pointer { T data[N]; };
template <class T> void fcn(const Pointer<T,3>&a) ;
], [/* empty */],
cxx_have_template_of_template=yes,
cxx_have_template_of_template=no)
AC_LANG_RESTORE
])
AC_MSG_RESULT($cxx_have_template_of_template)
if test "$cxx_have_template_of_template" = yes; then
AC_DEFINE(HAVE_TEMPLATE_OF_TEMPLATE)
fi
])dnl

dnl CXX_HAVE_NAMESPACE
dnl ---------------------------------------
dnl
dnl If the C++ compiler supports templates of templates,
dnl define `HAVE_NAMESPACE'.
dnl
AC_DEFUN(CXX_HAVE_NAMESPACE,
[
AC_REQUIRE([AC_PROG_CXX])
AC_MSG_CHECKING(whether ${CXX} supports namespaces)
AC_CACHE_VAL(cxx_have_namespace,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
namespace TestNamespace {
  int f() ; 
}
typedef TestNamespace::f g ; 
], [/* empty */],
cxx_have_namespace=yes,
cxx_have_namespace=no)
AC_LANG_RESTORE
])
AC_MSG_RESULT($cxx_have_namespace)
if test "$cxx_have_namespace" = yes; then
AC_DEFINE(HAVE_NAMESPACE)
fi
])dnl


dnl CXX_MUST_HAVE_NAMESPACE
dnl ---------------------------------------
dnl
dnl If the C++ compiler supports templates of templates,
dnl define `HAVE_NAMESPACE' and allow the program to continue
dnl
AC_DEFUN(CXX_MUST_HAVE_NAMESPACE,
[
AC_REQUIRE([AC_PROG_CXX])
AC_MSG_CHECKING(whether ${CXX} supports namespaces)
AC_CACHE_VAL(cxx_have_namespace,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
namespace TestNamespace {
  int f() ; 
  class A ; 
}
typedef TestNamespace::A B ; 
], [/* empty */],
cxx_have_namespace=yes,
cxx_have_namespace=no)
AC_LANG_RESTORE
])
AC_MSG_RESULT($cxx_have_namespace)
if test "$cxx_have_namespace" = yes; then
AC_DEFINE(HAVE_NAMESPACE)
else
echo "\nThis program requires a C++ compiler that can handle namespaces."
echo "please upgrade your current compiler or talk to your vendor."
echo "The problem might also be caused because configure is using "
echo "the wrong C++ compiler, make sure the CXX variable is properl set.\n"
exit 1
fi
])dnl


dnl CXX_HAVE_ISO_FRIEND_DECL
dnl ---------------------------------------
dnl
dnl If the C++ compiler supports templates of templates,
dnl define `HAVE_ISO_FRIEND_DECL'.
dnl
AC_DEFUN(CXX_HAVE_ISO_FRIEND_DECL,
[
AC_REQUIRE([AC_PROG_CXX])
AC_MSG_CHECKING(whether ${CXX} uses ISO friend declarations)
AC_CACHE_VAL(cxx_have_iso_friend_decl,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
template <class T> void f();
template <class T>
class A {
  friend void f<>() ;
};
], [/* empty */],
cxx_have_iso_friend_decl=yes,
cxx_have_iso_friend_decl=no)
AC_LANG_RESTORE
])
AC_MSG_RESULT($cxx_have_iso_friend_decl)
if test "$cxx_have_iso_friend_decl" = yes; then
AC_DEFINE(HAVE_ISO_FRIEND_DECL)
fi
])dnl

dnl
dnl PL_PROG_PERL
dnl
AC_DEFUN(PL_PROG_PERL,[
perl=`which perl`
AC_MSG_CHECKING(Which perl are you using ?)
AC_MSG_RESULT($perl)
AC_SUBST(perl)
]
)dnl

dnl
dnl PL_PROG_PERL
dnl
AC_DEFUN(PL_PROG_SHELL,[
AC_MSG_CHECKING(Which sh are you using ?)
shell=`which sh`
AC_MSG_RESULT('$shell')
SHELL=$shell
dnl AC_SUBST(shell)
dnl AC_SUBST(SHELL)
]
)dnl

dnl 
dnl PLIB_INSIDE_MINDSEYE
dnl --------------------
AC_DEFUN(PLIB_INSIDE_MINDSEYE,
[
AC_MSG_CHECKING(if the nurbs++ package is used inside MindsEye)
nurbs_tmp=`pwd | sed -e 's%.*MindsEye.*%yes%'`
if test "$nurbs_tmp" = yes ; then
  prefix=`cd ..; pwd`
  prefix=$prefix'/src'
  includedir=$prefix'/include'
  AC_SUBST(prefix)
  AC_SUBST(includedir)
  AC_DEFINE(COLUMN_ORDER)
  inside_mindseye=yes
  AC_SUBST(inside_mindseye)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi
])dnl

dnl #########################################################################
dnl Synopsis:
dnl        AC_PATH_GL
dnl    Purpose:
dnl        To seek and find your Qt installation
dnl Access:
dnl
dnl    --with-gl-dir           where the root of gl is installed (/usr/local/gl)    
dnl --with-gl-include       where the gl includes are. (/usr/local/gl/include)
dnl --with-gl-lib           where the gl library is installed. (/usr/local/gl/lib)
dnl --enable-mesagl         If you always want MesaGL instead of just GL
dnl Defines: (to DEFS or config.h)
dnl        None
dnl    Substitutions: (to Makefile from Makefile.in)
dnl        GL_CFLAGS - Path to GL includes (-Iwhateverincdir)
dnl        GL_LIBS   - Linkpath and libraryname (-Lwhateverlibdir -lgl)
dnl Requirements:
dnl        AC_PATH_XTRA must be called first, for now
dnl    Returns:
dnl        values in GL_CFLAGS and GL_LIBS, or configure will stop on error
dnl #########################################################################

AC_DEFUN(AC_PATH_GL,
[
AC_PROVIDE([$0])
AC_REQUIRE([AC_PATH_XTRA])

ac_cv_with_gl_dir=
ac_cv_with_gl_lib=
ac_cv_with_gl_inc=
ac_cv_enable_mesagl=

GL_CFLAGS=
GL_LIBS=
GL_LFLAGS=

AC_MSG_CHECKING("if you want to use the OpenGL extensions")

use_opengl=no

AC_ARG_WITH(gl-dir,
    [  --with-gl-dir           where the root of gl is installed (/usr/local/gl) ],
    [  ac_cv_with_gl_dir="$withval" ; use_opengl=yes ])

AC_ARG_WITH(opengl,
    [  --with-opengl           where the root of gl is installed (/usr/local/gl) ],
    [  ac_cv_with_gl_dir="$withval" ; use_opengl=yes ])

AC_ARG_WITH(gl-include,
    [  --with-gl-include       where the gl includes are. (/usr/local/gl/include) ],
    [  ac_cv_with_gl_inc="$withval" ; use_opengl=yes ])
    
AC_ARG_WITH(gl-lib,
    [  --with-gl-lib           where the gl library is installed. (/usr/local/gl/lib)],
    [  ac_cv_with_gl_lib="$withval" ; use_opengl=yes ])

AC_ARG_ENABLE(mesagl,
    [  --enable-mesagl         If you always want MesaGL instead of just GL ],
    [  ac_cv_enable_mesagl="$enableval" ; use_opengl=yes ],
    [  ac_cv_enable_mesagl="no"  ])
    

if test "$use_opengl" = yes; then

AC_MSG_RESULT(yes)


AC_MSG_CHECKING("we like Mesa GL instead of just OpenGL")
AC_MSG_RESULT("$ac_cv_enable_mesagl")

dnl try to set some paths

AC_MSG_CHECKING("for Gl location")

for ac_dir in                           \
        ${GLDIR}                                \
        ${ac_cv_with_gl_dir}    \
        /usr/gl                         \
        /usr/local/gl                   \
        /usr/share/gl                   \
        /usr/GL                         \
        /usr/local/GL                   \
        /usr/share/GL                   \
        /usr/MesaGL                         \
        /usr/local/MesaGL               \
        /usr/share/MesaGL               \
        ; \
do
        if test -n "$ac_dir" && test -d "$ac_dir"; then
        ac_cv_with_gl_dir="$ac_dir" 
                break;
        fi
done

if test ! -n "$ac_cv_with_gl_dir"; then
        AC_MSG_RESULT("don\'t know...")
else
        AC_MSG_RESULT("$ac_cv_with_gl_dir")
fi
dnl check for libraries and includes
dnl TODO: use the value of $ac_cv_with_gl_inc first if it existed!
 

AC_MSG_CHECKING("for Gl include paths")

AC_TRY_CPP([#include <GL/gl.h>],
[
        AC_MSG_RESULT(["Good, includes in your path"])
],
[
AC_MSG_RESULT(["Not in your path, searching..."])
for ac_dir in                   \
        $ac_cv_with_gl_dir/include      \
        $ac_cv_with_gl_inc              \
    /usr/local/MesaGL/include   \
    /usr/local/include          \
    /usr/share/MesaGL/include   \
    /usr/share/include          \
    /usr/MesaGL/include         \
    /usr/include                \
    /usr/include/GL             \
    /usr/X11R6/include          \
    /usr/include/X11            \
    /usr/local/X11R6/include    \
    /usr/local/X11/include      \
    ; \
do
   AC_MSG_CHECKING(["in $ac_dir"])
   if test -r "$ac_dir/GL/gl.h"; then
      ac_cv_with_gl_inc=$ac_dir
      break
   fi
   AC_MSG_RESULT(["no"])
done

if test -n "$ac_cv_with_gl_inc" ; then
   AC_MSG_RESULT(["yes"])
   GL_CFLAGS="-I${ac_cv_with_gl_inc}"
else
   AC_MSG_ERROR(["Can\'t find the Gl includes"])
fi
])



AC_MSG_RESULT(["+ Gl libraries ${ac_cv_with_gl_lib}, Gl includes ${ac_cv_with_gl_inc}"])

SAVE_LIBS="${LIBS}"



if test ! -n "${ac_cv_with_gl_lib}" && test -n "${ac_cv_with_gl_dir}"; then
    ac_cv_with_gl_lib="${ac_cv_with_gl_dir}/lib"
elif test ! -n "${ac_cv_with_gl_lib}"; then 
    ac_cv_with_gl_lib="."
fi

if test "$ac_cv_enable_mesagl" = no; then
    AC_CHECK_LIB(GL, main,
    [
        if test "${ac_cv_with_gl_lib}" = "."; then
            GL_LFLAGS=
        else
            GL_LFLAGS="-L${ac_cv_with_gl_lib}"
        fi
	GL_LIBS="-lGLU -lGL -lXext -lm"
        AC_SUBST(GL_LIBS)
	AC_SUBST(GL_LFLAGS)
    ],
    [
        GL_LIBS=no
    ],
    [-L$ac_cv_with_gl_lib $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXext -lm])
fi
if test "$ac_cv_enable_mesagl" = yes || test "${GL_LIBS}" = no; then
    if test "$ac_cv_enable_mesagl" = yes; then
        AC_MSG_WARN(["Will not link with standard Gl, trying to force the Mesa library..."])
    else
        AC_MSG_WARN(["Can\'t not link with Gl, trying the Mesa library..."])
    fi
    AC_CHECK_LIB(MesaGL, main,
    [
        if test "${ac_cv_with_gl_lib}" = "."; then
            GL_LFLAGS=
        else
            GL_LFLAGS="-L${ac_cv_with_gl_lib}"
        fi
	GL_LIBS="-lMesaGLU -lMesaGL -lXext -lm"
	AC_SUBST(GL_LFLAGS)
        AC_SUBST(GL_LIBS)
    ],
    [
        AC_MSG_ERROR(["You need to install \(Mesa\) OpenGL first: can\'t find either the GL or MesaGL library"])
    ], [-L$ac_cv_with_gl_lib $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXext -lm])
fi

LIBS="${SAVE_LIBS}"

AC_SUBST(GL_CFLAGS)

else
AC_MSG_RESULT('no')
fi



])