1# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*-
2
3# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
4# Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14dnl ----------------------------------
15dnl OpenEXR
16dnl ----------------------------------
17
18AC_DEFUN([AM_PATH_OPENEXR],
19[dnl
20dnl Get the cflags and libraries
21dnl
22AC_ARG_WITH(openexr-prefix,[  --with-openexr-prefix=PFX   Prefix where libopenexr is installed (optional)], openexr_prefix="$withval", openexr_prefix="/usr")
23AC_ARG_ENABLE(openexrtest, [  --disable-openexrtest       Do not try to compile and run a test Openexr program],, enable_openexrtest=yes)
24AC_ARG_ENABLE(static-openexr, [  --enable-static-openexr  Statically link against OpenEXR libs],enable_static_openexr=yes, enable_static_openexr=no)
25AC_ARG_ENABLE(openexr-threads,[  --enable-openexr-threads Include OpenEXR threading],enable_openexr_threads=yes, enable_openexr_threads=no)
26
27  if test "x$openexr_prefix" != "xNONE" ; then
28    openexr_args="$openexr_args --prefix=$openexr_prefix"
29    OPENEXR_INCLUDES="-I$openexr_prefix/include/OpenEXR"
30    OPENEXR_LDLFLAGS="-L$openexr_prefix/lib"
31    openexr_static_libs="$openexr_prefix/lib/libIlmImf.a $openexr_prefix/lib/libImath.a $openexr_prefix/lib/libIex.a $openexr_prefix/lib/libHalf.a -lz"
32    if test "x$enable_openexr_threads" == "xyes" ; then
33    	openexr_static_libs="$openexr_static_libs $openexr_prefix/lib/libIlmThread.a"
34    fi
35  elif test "$prefix" != ""; then
36    openexr_args="$openexr_args --prefix=$prefix"
37    OPENEXR_INCLUDES="-I$prefix/include/OpenEXR"
38    OPENEXR_LDFLAGS="-L$prefix/lib"
39    openexr_static_libs="$prefix/lib/libIlmImf.a $prefix/lib/libImath.a $prefix/lib/libIex.a $prefix/lib/libHalf.a -lz"
40    if test "x$enable_openexr_threads" == "xyes" ; then
41    	openexr_static_libs="$openexr_static_libs $prefix/lib/libIlmThread.a"
42    fi
43  fi
44
45  if test "x$enable_static_openexr" == "xyes"; then
46    OPENEXR_LIBS="$X_LIBS $openexr_static_libs"
47  else
48    OPENEXR_LIBS="$X_LIBS -lOpenEXR -lIex -lImath -lz"
49  fi
50
51  AC_MSG_CHECKING(for OpenEXR)
52  no_openexr=""
53
54
55  if test "x$enable_openexrtest" = "xyes" ; then
56    ac_save_CXXFLAGS="$CXXFLAGS"
57    ac_save_LIBS="$LIBS"
58    ac_save_LDFLAGS="$LDFLAGS"
59    CXXFLAGS="$CXXFLAGS $OPENEXR_CXXFLAGS $OPENEXR_INCLUDES"
60    LIBS="$LIBS $OPENEXR_LIBS"
61    LDFLAGS="$LDFLAGS $OPENEXR_LDFLAGS"
62      rm -f conf.openexrtest
63      AC_LANG_SAVE
64      AC_LANG_CPLUSPLUS
65      AC_TRY_RUN([
66#include <stdlib.h>
67#include <ImfRgbaFile.h>
68
69int main ()
70{
71  try
72  {
73    Imf::RgbaInputFile exr ("");
74  }
75  catch (...)
76  {
77  }
78  system("touch conf.openexrtest");
79  return 0;
80}
81
82],, no_openexr=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
83       AC_LANG_RESTORE
84       CXXFLAGS="$ac_save_CXXFLAGS"
85       LIBS="$ac_save_LIBS"
86       LDFLAGS="$ac_save_LDFLAGS"
87  fi
88
89  if test "x$no_openexr" = "x" ; then
90     AC_MSG_RESULT(yes)
91     ifelse([$1], , :, [$1])
92  else
93     AC_MSG_RESULT(no)
94     if test -f conf.openexrtest ; then
95       :
96     else
97       echo "*** Could not run OpenEXR test program, checking why..."
98       CXXFLAGS="$CXXFLAGS $OPENEXR_CXXFLAGS $OPENEXR_INCLUDES"
99       LIBS="$LIBS $OPENEXR_LIBS"
100       LDFLAGS="$LDFLAGS $OPENEXR_LDFLAGS"
101       AC_LANG_SAVE
102       AC_LANG_CPLUSPLUS
103       AC_TRY_LINK([
104#include <stdio.h>
105#include <ImfRgbaFile.h>
106],     [ Imf::RgbaInputFile exr ("");return 0; ],
107       [ echo "*** The test program compiled, but did not run. This usually means"
108       echo "*** that the run-time linker is not finding OpenEXR or finding the wrong"
109       echo "*** version of OpenEXR. If it is not finding OpenEXR, you'll need to set your"
110       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
111       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
112       echo "*** is required on your system"
113       echo "***"])
114       AC_LANG_RESTORE
115       CXXFLAGS="$ac_save_CXXFLAGS"
116       LIBS="$ac_save_LIBS"
117       LDFLAGS="$ac_save_LDFLAGS"
118     fi
119     OPENEXR_INCLUDES=""
120     OPENEXR_LIBS=""
121     ifelse([$2], , :, [$2])
122  fi
123  AC_SUBST(OPENEXR_INCLUDES)
124  AC_SUBST(OPENEXR_LIBS)
125  AC_SUBST(OPENEXR_LDFLAGS)
126  rm -f conf.openexrtest
127])
128
129dnl ----------------------------------
130dnl FLTK with GL support
131dnl ----------------------------------
132
133AC_DEFUN([AM_PATH_FLTK],
134[dnl
135dnl Get the cflags and libraries
136dnl
137AC_ARG_VAR(FLTK_CONFIG, Path to fltk-config command)
138AC_PATH_PROG(FLTK_CONFIG, fltk-config, no)
139AC_ARG_WITH(fltk-config,[  --with-fltk-config=PATH Specify which fltk-config to use (optional)], FLTK_CONFIG="$withval",)
140AC_ARG_ENABLE(static-fltk,[  --enable-static-fltk Specify whether to link fltk statically (optional)], STATIC_FLTK=true,STATIC_FLTK=false)
141
142  if test x$FLTK_CONFIG != xno ; then
143  	if test x$STATIC_FLTK != xtrue ; then
144  	    FLTK_CXXFLAGS="`$FLTK_CONFIG --use-gl --cxxflags`"
145    	FLTK_LDFLAGS="`$FLTK_CONFIG --use-gl --ldstaticflags | sed 's/ -R.* / /g'`"
146  	else
147	    FLTK_CXXFLAGS="`$FLTK_CONFIG --use-gl --cxxflags`"
148    	FLTK_LDFLAGS="`$FLTK_CONFIG --use-gl --ldflags | sed 's/ -R.* / /g'`"
149    fi
150  else
151    FLTK_CXXFLAGS=""
152    FLTK_LDFLAGS=""
153  fi
154
155  AC_MSG_CHECKING(for FLTK with GL support)
156  no_fltk=""
157
158  ac_save_CXXFLAGS="$CXXFLAGS"
159  ac_save_LDFLAGS="$LDFLAGS"
160  CXXFLAGS="$CXXFLAGS $FLTK_CXXFLAGS"
161  LDFLAGS="$LDFLAGS $FLTK_LDFLAGS"
162
163dnl
164dnl Now check if the installed FLTK has GL support
165dnl
166  AC_LANG_SAVE
167  AC_LANG_CPLUSPLUS
168  AC_TRY_LINK([
169#include <stdlib.h>
170#include <FL/Fl.H>
171#include <FL/Fl_Gl_Window.H>],
172[
173    Fl_Gl_Window foo ();
174],, no_fltk=yes)
175  AC_LANG_RESTORE
176  CXXFLAGS="$ac_save_CXXFLAGS"
177  LDFLAGS="$ac_save_LDFLAGS"
178
179  if test "x$no_fltk" = "x" ; then
180    AC_MSG_RESULT(yes)
181     ifelse([$1], , :, [$1])
182  else
183    AC_MSG_RESULT(no)
184    FLTK_CXXFLAGS=""
185    FLTK_LDFLAGS=""
186    ifelse([$2], , :, [$2])
187  fi
188])
189
190dnl ----------------------------------
191dnl QT with GL support
192dnl ----------------------------------
193
194AC_DEFUN([AM_PATH_QT],
195[dnl
196dnl Get the cflags and libraries
197dnl
198AC_ARG_WITH(qt-prefix,[  --with-qt-prefix=PFX   Prefix where qt is installed (optional)], qt_prefix="$withval", qt_prefix="/usr/lib/qt/")
199AC_ARG_WITH(qt-includes,[  --with-qt-includes=PFX   Prefix where qt includes live (optional)], qt_includes="$withval", qt_includes="")
200AC_ARG_WITH(qt-libs,[  --with-qt-libs=PFX   Prefix where qt libs live (optional)], qt_libs="$withval", qt_libs="")
201AC_ARG_ENABLE(qttest, [  --disable-qttest       Do not try to compile and run a test Qt program],, enable_qttest=yes)
202
203  case $host in
204  *-apple-*)
205  	qt_ld_extra="-framework OpenGL"
206  	QT_POSTPROCESS="/Developer/Tools/Rez Carbon.r -o" ;;
207  *)
208  	qt_lib_extra="$X_LIBS -lGL"
209  	qt_ld_extra="$X_LDFLAGS"
210  	QT_POSTPROCESS="echo" ;;
211  esac
212
213  if test "x$qt_includes" == "x" -a "x$qt_lib" == "x" ; then
214  	# all-in-one installation specified by qt_prefix
215
216    QT_INCLUDES="-I$qt_prefix/include/ -I$qt_prefix/include/QtCore -I$qt_prefix/include/QtGui -I$qt_prefix/include/QtOpenGL"
217    QT_LDFLAGS="-L$qt_prefix/lib/ $qt_ld_extra"
218    QT_LIBS="-lQtCore -lQtGui -lQtOpenGL $qt_lib_extra"
219  else
220  	# default, look in standard places
221
222  	if test "x$qt_includes" != "x"; then
223  		# but allow override of include dir
224	    QT_INCLUDES="-I$qt_includes  -I$qt_includes/QtCore -I$qt_includes/QtGui -I$qt_includes/QtOpenGL"
225	else
226	    QT_INCLUDES="-I$prefix/include/  -I$prefix/include/QtCore -I$prefix/include/QtGui -I$prefix/include/QtOpenGL"
227	fi
228
229	if test "x$qt_libs" != "x"; then
230		# but allow override of lib dir
231		QT_LDFLAGS="-L$qt_libs $qt_ld_extra"
232		QT_LIBS="-lQtCore -lQtGui -lQtOpenGL $qt_lib_extra"
233	else
234		QT_LDFLAGS="-L$prefix/lib $qt_ld_extra"
235		QT_LIBS="-lQtCore -lQtGui -lQtOpenGL $qt_lib_extra"
236	fi
237  fi
238  QT_CXXFLAGS="-DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED"
239
240  AC_MSG_CHECKING(for Qt with OpenGL)
241  no_qt=""
242
243
244  if test "x$enable_qttest" = "xyes" ; then
245    ac_save_CXXFLAGS="$CXXFLAGS"
246    ac_save_LDFLAGS="$LDFLAGS"
247    ac_save_LIBS="$LIBS"
248    CXXFLAGS="$CXXFLAGS $QT_CXXFLAGS $QT_INCLUDES"
249    LIBS="$LIBS $QT_LIBS"
250    LDFLAGS="$LDFLAGS $QT_LDFLAGS"
251      rm -f conf.qttest
252      AC_LANG_SAVE
253      AC_LANG_CPLUSPLUS
254      AC_TRY_RUN([
255#include <stdlib.h>
256#include <QApplication>
257#include <QGLWidget>
258
259int main (int argc, char*argv[])
260{
261  QApplication	app(argc,argv);
262  QGLWidget *foo = new QGLWidget;
263  delete foo;
264  system("touch conf.qttest");
265  return 0;
266}
267
268],, no_qt=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
269       AC_LANG_RESTORE
270       CXXFLAGS="$ac_save_CXXFLAGS"
271       LIBS="$ac_save_LIBS"
272       LDFLAGS="$ac_save_LDFLAGS"
273  fi
274
275  if test "x$no_qt" = "x" ; then
276     AC_MSG_RESULT(yes)
277     ifelse([$1], , :, [$1])
278  else
279     AC_MSG_RESULT(no)
280     if test -f conf.qttest ; then
281       :
282     else
283       echo "*** Could not run Qt test program, checking why..."
284       CXXFLAGS="$CXXFLAGS $QT_CXXFLAGS $QT_INCLUDES"
285       LIBS="$LIBS $QT_LIBS"
286       LDFLAGS="$LDFLAGS $QT_LDFLAGS"
287       AC_LANG_SAVE
288       AC_LANG_CPLUSPLUS
289       AC_TRY_LINK([
290#include <stdio.h>
291#include <QGLWidget.h>
292],     [ QGLWidget qtgl;return 0; ],
293       [ echo "*** The test program compiled, but did not run. This usually means"
294       echo "*** that the run-time linker is not finding Qt or finding the wrong"
295       echo "*** version of Qt. If it is not finding Qt, you'll need to set your"
296       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
297       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
298       echo "*** is required on your system"
299       echo "***"])
300       AC_LANG_RESTORE
301       CXXFLAGS="$ac_save_CXXFLAGS"
302       LDFLAGS="$ac_save_LDFLAGS"
303       LIBS="$ac_save_LIBS"
304     fi
305     QT_INCLUDES=""
306     QT_LIBS=""
307     ifelse([$2], , :, [$2])
308  fi
309  AC_SUBST(QT_INCLUDES)
310  AC_SUBST(QT_CXXFLAGS)
311  AC_SUBST(QT_LIBS)
312  AC_SUBST(QT_LDFLAGS)
313  AC_SUBST(QT_POSTPROCESS)
314  rm -f conf.qttest
315])
316
317