| 1 |
dnl |
| 2 |
dnl Configuring gauche-gl |
| 3 |
dnl process this file with "autoconf" to generate 'configure'. |
| 4 |
dnl |
| 5 |
|
| 6 |
AC_PREREQ(2.54) |
| 7 |
AC_INIT(Gauche-gl, 0.6, [email protected]) |
| 8 |
AC_CANONICAL_SYSTEM |
| 9 |
|
| 10 |
AC_PATH_XTRA |
| 11 |
|
| 12 |
case "$target" in |
| 13 |
*-*-cygwin*) |
| 14 |
if test "x-$have_x" = "x-disabled" -o "x-$have_x" = "x-no"; |
| 15 |
then |
| 16 |
LIBGLUT=glut32; |
| 17 |
else |
| 18 |
LIBGLUT=glut |
| 19 |
CPPFLAGS="$CPPFLAGS -I$x_includes"; |
| 20 |
fi;; |
| 21 |
*) |
| 22 |
LIBGLUT=glut;; |
| 23 |
esac |
| 24 |
|
| 25 |
# options for configure scripts |
| 26 |
GLUT_LIB="-l$LIBGLUT" |
| 27 |
AC_ARG_WITH(glut, [ --with-glut[=PATH]: Use GLUT library installed under PATH. |
| 28 |
By default, Gauche-gl assumes GLUT is installed in the system standard |
| 29 |
location. If you do not want to use GLUT support, specify --with-glut=no. |
| 30 |
On MinGW you can statically link freeglut included in the source. |
| 31 |
If you want to choose so, say --with-glut=mingw-static.], [ |
| 32 |
case $with_glut in |
| 33 |
no) GLUT_LIB= ;; |
| 34 |
yes) GLUT_LIB="-l$LIBGLUT";; |
| 35 |
mingw-static) |
| 36 |
GLUT_LIB="-lfreeglut_static -lgdi32 -lwinmm" |
| 37 |
GLUT_INCDIR="-I../win32/freeglut-2.6.0-3/include -DFREEGLUT_STATIC" |
| 38 |
GLUT_LIBDIR="-L../win32/freeglut-2.6.0-3/lib";; |
| 39 |
*) GLUT_LIB="-l$LIBGLUT" |
| 40 |
GLUT_INCDIR="-I$with_glut/include" |
| 41 |
GLUT_LIBDIR="-L$with_glut/lib";; |
| 42 |
esac |
| 43 |
]) |
| 44 |
|
| 45 |
AC_ARG_ENABLE(cg, |
| 46 |
AC_HELP_STRING([--enable-cg], [Enable NVidia's Cg binding.]), [ |
| 47 |
AC_DEFINE(HAVE_CG, 1) |
| 48 |
ENABLE_CG=1 |
| 49 |
CG_LIBS="-lCgGL -lCg" |
| 50 |
CG_SCM="cg/gl/cg.scm"; |
| 51 |
]) |
| 52 |
AC_SUBST(ENABLE_CG) |
| 53 |
AC_SUBST(CG_LIBS) |
| 54 |
AC_SUBST(CG_SCM) |
| 55 |
|
| 56 |
dnl Set up gauche related commands. The commands are set by scanning |
| 57 |
dnl PATH. You can override them by "GOSH=/my/gosh ./configure" etc. |
| 58 |
AC_PATH_PROG([GOSH], gosh) |
| 59 |
AC_PATH_PROG([GAUCHE_CONFIG], gauche-config) |
| 60 |
AC_PATH_PROG([GAUCHE_PACKAGE], gauche-package) |
| 61 |
AC_PATH_PROG([GAUCHE_INSTALL], gauche-install) |
| 62 |
AC_PATH_PROG([GAUCHE_CESCONV], gauche-cesconv) |
| 63 |
|
| 64 |
dnl Usually these parameters are set by AC_PROG_CC, but we'd rather use |
| 65 |
dnl the same one as Gauche has been compiled with. |
| 66 |
SOEXT=`"$GAUCHE_CONFIG" --so-suffix` |
| 67 |
OBJEXT=`"$GAUCHE_CONFIG" --object-suffix` |
| 68 |
EXEEXT=`"$GAUCHE_CONFIG" --executable-suffix` |
| 69 |
AC_SUBST(SOEXT) |
| 70 |
AC_SUBST(OBJEXT) |
| 71 |
AC_SUBST(EXEEXT) |
| 72 |
|
| 73 |
# Check for headers |
| 74 |
AC_CHECK_HEADERS(GL/glx.h, [ # OpenGL/X11 |
| 75 |
# NB: FreeBSD seems to need -lX11 -lXext. We are on X11 system anyway, |
| 76 |
# so I assume this won't do any harm. |
| 77 |
GL_LIBS='-lGLU -lGL -lX11 -lXext' |
| 78 |
GLUT_LIB="$GLUT_LIB -lXmu -lXi" |
| 79 |
], ,) |
| 80 |
AC_CHECK_HEADERS(GLUT/glut.h, [ |
| 81 |
case $target in |
| 82 |
*-apple-darwin*) |
| 83 |
AC_DEFINE(MacOSX, 1) # darwin which has GLUT/glut.h is MacOSX |
| 84 |
GL_LIBS='-framework OpenGL -framework GLUT' # GLUT for glutGetProcAddress |
| 85 |
GLUT_LIB='-framework GLUT' ;; |
| 86 |
*) # other OSes w/o X11 but have GLUT/glut.h. Possibly MacOS9?? |
| 87 |
;; |
| 88 |
esac |
| 89 |
], ,) |
| 90 |
|
| 91 |
if test "$GL_LIBS" = ""; then |
| 92 |
case $target in |
| 93 |
*-*-cygwin*|*-*-mingw*) |
| 94 |
GL_LIBS='-lglu32 -lopengl32' ;; |
| 95 |
*) |
| 96 |
GL_LIBS='-lGLU -lGL' ;; |
| 97 |
esac |
| 98 |
fi |
| 99 |
|
| 100 |
# On MinGW, we use GLEW so that we can get newer GL features; the GL header |
| 101 |
# comes with MinGW installation is very old. |
| 102 |
# TODO: We might add --with-glew configure option so that we can use glew |
| 103 |
# on other platforms. At this moment, though, Gauche-gl has its own |
| 104 |
# runtime name lookup system, so having glew isn't vital on other platforms. |
| 105 |
case $target in |
| 106 |
*-*-mingw*) |
| 107 |
AC_DEFINE(HAVE_GL_GLEW_H) |
| 108 |
GLEW_INCDIR="-I../win32/glew-1.10.0/include -DGLEW_STATIC" |
| 109 |
GLEW_SOURCE="../win32/glew-1.10.0/src/glew.c" |
| 110 |
esac |
| 111 |
|
| 112 |
AC_SUBST(GL_LIBS) |
| 113 |
AC_SUBST(GLUT_LIB) |
| 114 |
AC_SUBST(GLUT_INCDIR) |
| 115 |
AC_SUBST(GLUT_LIBDIR) |
| 116 |
AC_SUBST(GLEW_INCDIR) |
| 117 |
AC_SUBST(GLEW_SOURCE) |
| 118 |
|
| 119 |
# Check for other programs. |
| 120 |
AC_CHECK_PROGS(MAKEINFO, makeinfo) |
| 121 |
AC_CHECK_PROGS(GZIP_PROGRAM, gzip) |
| 122 |
|
| 123 |
# Check for libraries |
| 124 |
|
| 125 |
# on cygwin, we need several extra -l flags. |
| 126 |
case "$target" in |
| 127 |
*-*-cygwin*|*-*-mingw*) |
| 128 |
LIBS="-lgauche-uvector $LIBS" |
| 129 |
GL_EXTRALIBS="-L. -lgauche-math3d" |
| 130 |
GLUT_EXTRALIBS="-L. -lgauche-gl -lgauche-math3d" |
| 131 |
;; |
| 132 |
esac |
| 133 |
AC_SUBST(GL_EXTRALIBS) |
| 134 |
AC_SUBST(GLUT_EXTRALIBS) |
| 135 |
|
| 136 |
dnl Creating gpd (gauche package description) file |
| 137 |
GAUCHE_PACKAGE_CONFIGURE_ARGS="`echo ""$ac_configure_args"" | sed 's/[\\""\`\$]/\\\&/g'`" |
| 138 |
AC_MSG_NOTICE([creating ${PACKAGE_NAME}.gpd]) |
| 139 |
"$GAUCHE_PACKAGE" make-gpd "$PACKAGE_NAME" \ |
| 140 |
-version "$PACKAGE_VERSION" \ |
| 141 |
-configure "./configure $GAUCHE_PACKAGE_CONFIGURE_ARGS" |
| 142 |
|
| 143 |
dnl Output |
| 144 |
echo $PACKAGE_VERSION > VERSION |
| 145 |
AC_OUTPUT(Makefile src/Makefile lib/Makefile cg/Makefile doc/Makefile) |