AC_SUBST(OPT_FLAGS)
AC_SUBST(ARCH_FLAGS)
+dnl
+dnl shared/static libraries, mimic libtool options
+dnl
+AC_ARG_ENABLE(static,
+ [AS_HELP_STRING([--enable-static],
+ [build static libraries @<:@default=no@:>@])],
+ enable_static="$enableval",
+ enable_static=no
+)
+case "x$enable_static" in
+xyes|xno ) ;;
+x ) enable_static=no ;;
+* )
+ AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
+ ;;
+esac
+AC_ARG_ENABLE(shared,
+ [AS_HELP_STRING([--disable-shared],
+ [build shared libraries @<:@default=yes@:>@])],
+ enable_shared="$enableval",
+ enable_shared=yes
+)
+case "x$enable_shared" in
+xyes|xno ) ;;
+x ) enable_shared=yes ;;
+* )
+ AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
+ ;;
+esac
+
+dnl Can't have static and shared libraries, default to static if user
+dnl explicitly requested. If both disabled, set to static since shared
+dnl was explicitly requirested.
+case "x$enable_static$enable_shared" in
+xyesyes )
+ AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
+ enable_shared=no
+ ;;
+xnono )
+ AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
+ enable_static=yes
+ ;;
+esac
+
+dnl
+dnl mklib options
+dnl
+AC_ARG_VAR(MKLIB_OPTIONS,[Options for the Mesa library script, mklib])
+if test "$enable_static" = yes; then
+ MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
+fi
+AC_SUBST(MKLIB_OPTIONS)
+
+
dnl
dnl library names
dnl
-GL_LIB_NAME='lib$(GL_LIB).so'
-GLU_LIB_NAME='lib$(GLU_LIB).so'
-GLUT_LIB_NAME='lib$(GLUT_LIB).so'
-GLW_LIB_NAME='lib$(GLW_LIB).so'
-OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
+if test "$enable_static" = yes; then
+ GL_LIB_NAME='lib$(GL_LIB).a'
+ GLU_LIB_NAME='lib$(GLU_LIB).a'
+ GLUT_LIB_NAME='lib$(GLUT_LIB).a'
+ GLW_LIB_NAME='lib$(GLW_LIB).a'
+ OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
+else
+ GL_LIB_NAME='lib$(GL_LIB).so'
+ GLU_LIB_NAME='lib$(GLU_LIB).so'
+ GLUT_LIB_NAME='lib$(GLUT_LIB).so'
+ GLW_LIB_NAME='lib$(GLW_LIB).so'
+ OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
+fi
AC_SUBST(GL_LIB_NAME)
AC_SUBST(GLU_LIB_NAME)
AC_SUBST(GLUT_LIB_NAME)
dnl
SRC_DIRS="mesa"
GLU_DIRS="sgi"
-DRI_DIRS=""
WINDOW_SYSTEM=""
case "$mesa_driver" in
x11)
GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
fi
GL_LIB_DEPS="$GL_LIB_DEPS -lm -lpthread"
+
+ # if static, move the external libraries to the programs
+ # and empty the libraries for libGL
+ if test "$enable_static" = yes; then
+ APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
+ GL_LIB_DEPS=""
+ fi
;;
dri)
+ # DRI must be shared, I think
+ if test "$enable_static" = yes; then
+ AC_MSG_ERROR([Can't use static libraries for DRI drivers])
+ fi
+
# Check for libdrm
PKG_CHECK_MODULES(LIBDRM, libdrm)
GLX_USE_TLS="$enableval",
GLX_USE_TLS=no)
dnl Directory for DRI drivers
-AC_ARG_WITH(dridriverdir,
- [AS_HELP_STRING([--with-dridriverdir=DIR],
+AC_ARG_WITH(dri-driverdir,
+ [AS_HELP_STRING([--with-dri-driverdir=DIR],
[directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
DRI_DRIVER_INSTALL_DIR="$withval",
DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
driglx_direct="$enableval",
driglx_direct="yes")
+dnl Which drivers to build - default is chosen by platform
+AC_ARG_WITH(dri-drivers,
+ [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
+ [comma delimited DRI drivers to build @<:@default=auto by platform@:>@])],
+ with_dri_drivers="$withval",
+ with_dri_drivers=yes)
+if test "x$with_dri_drivers" = x; then
+ with_dri_drivers=no
+fi
+
+dnl If $with_dri_drivers is yes, directories will be added through
+dnl platform checks
+DRI_DIRS=""
+case "$with_dri_drivers" in
+no|yes) ;;
+*)
+ # verify the requested driver directories exist
+ dri_drivers=`IFS=,; echo $with_dri_drivers`
+ for driver in $dri_drivers; do
+ test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
+ AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
+ done
+ DRI_DIRS="$dri_drivers"
+ ;;
+esac
+
dnl Just default to no EGL for now
USING_EGL=0
AC_SUBST(USING_EGL)
PROGRAM_DIRS="egl"
fi
+ # default drivers
+ if test "x$DRI_DIRS" = x; then
+ DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
+ savage sis tdfx trident unichrome ffb"
+ fi
+
# Platform specific settings and drivers to build
case "$host_os" in
linux*)
fi
case "$host_cpu" in
- i*86)
- DRI_DIRS="i810 i915tex i915 i965 mach64 mga r128 r200 r300 \
- radeon s3v savage sis tdfx trident unichrome ffb"
- ;;
x86_64)
- DRI_DIRS="i915tex i915 i965 mach64 mga r128 r200 radeon tdfx \
- unichrome savage r300"
+ # ffb, gamma, and sis are missing because they have not be
+ # converted to use the new interface. i810 are missing
+ # because there is no x86-64 system where they could *ever*
+ # be used.
+ if test "x$DRI_DIRS" = x; then
+ DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
+ savage tdfx unichrome"
+ fi
;;
powerpc*)
- DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
+ # Build only the drivers for cards that exist on PowerPC.
+ # At some point MGA will be added, but not yet.
+ if test "x$DRI_DIRS" = x; then
+ DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
+ fi
;;
esac
;;
CXXFLAGS="$CXXFLAGS -ansi -pedantic"
fi
- DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
- unichrome savage sis"
+ # ffb and gamma are missing because they have not been converted
+ # to use the new interface.
+ if test "x$DRI_DIRS" = x; then
+ DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
+ unichrome savage sis"
+ fi
;;
esac
DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
case "$mesa_driver" in
osmesa)
- OSMESA_LIB_DEPS="-lm -lpthread"
+ # only link librararies with osmesa if shared
+ if test "$enable_static" = no; then
+ OSMESA_LIB_DEPS="-lm -lpthread"
+ else
+ OSMESA_LIB_DEPS=""
+ fi
OSMESA_MESA_DEPS=""
;;
*)
# Link OSMesa to libGL otherwise
OSMESA_LIB_DEPS=""
- OSMESA_MESA_DEPS='-l$(GL_LIB)'
+ # only link librararies with osmesa if shared
+ if test "$enable_static" = no; then
+ OSMESA_MESA_DEPS='-l$(GL_LIB)'
+ else
+ OSMESA_MESA_DEPS=""
+ fi
;;
esac
AC_SUBST(OSMESA_LIB_DEPS)
# Link libGLU to libOSMesa instead of libGL
GLU_LIB_DEPS=""
- GLU_MESA_DEPS='-l$(OSMESA_LIB)'
+ if test "$enable_static" = no; then
+ GLU_MESA_DEPS='-l$(OSMESA_LIB)'
+ else
+ GLU_MESA_DEPS=""
+ fi
;;
*)
# If GLU is available, we can build the xdemos
PROGRAM_DIRS="$PROGRAM_DIRS xdemos"
fi
- GLU_LIB_DEPS="-lm"
- GLU_MESA_DEPS='-l$(GL_LIB)'
+ # If static, empty GLU_LIB_DEPS and add libs for programs to link
+ if test "$enable_static" = no; then
+ GLU_LIB_DEPS="-lm"
+ GLU_MESA_DEPS='-l$(GL_LIB)'
+ else
+ GLU_LIB_DEPS=""
+ GLU_MESA_DEPS=""
+ APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
+ fi
;;
esac
fi
GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
fi
- GLW_MESA_DEPS='-l$(GL_LIB)'
+ # If static, empty GLW_LIB_DEPS and add libs for programs to link
+ if test "$enable_static" = no; then
+ GLW_MESA_DEPS='-l$(GL_LIB)'
+ else
+ APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
+ GLW_LIB_DEPS=""
+ GLW_MESA_DEPS=""
+ fi
fi
AC_SUBST(GLW_LIB_DEPS)
AC_SUBST(GLW_MESA_DEPS)
GLUT_CFLAGS="-fexceptions"
fi
if test "$x11_pkgconfig" = yes; then
- PKG_CHECK_MODULES(GLUT, x11 xmu xt xi)
+ PKG_CHECK_MODULES(GLUT, x11 xmu xi)
GLUT_LIB_DEPS="$GLUT_LIBS"
else
# should check these...
- GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXt -lXi"
+ GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
fi
GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
fi
- GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
+ # If static, empty GLUT_LIB_DEPS and add libs for programs to link
+ if test "$enable_static" = no; then
+ GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
+ else
+ APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
+ GLUT_LIB_DEPS=""
+ GLUT_MESA_DEPS=""
+ fi
fi
AC_SUBST(GLUT_LIB_DEPS)
AC_SUBST(GLUT_MESA_DEPS)
dnl Substitute the config
AC_OUTPUT([configs/autoconf])
+dnl
+dnl Output some configuration info for the user
+dnl
+echo ""
+echo " prefix: $prefix"
+echo " exec_prefix: $exec_prefix"
+echo " libdir: $libdir"
+
+dnl Driver info
+echo ""
+echo " Driver: $mesa_driver"
+case "$mesa_driver" in
+x11|osmesa)
+ if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
+ echo " OSMesa: lib$OSMESA_LIB"
+ else
+ echo " OSMesa: no"
+ fi
+ ;;
+dri)
+ # cleanup the drivers var
+ dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
+ echo " DRI drivers: $dri_dirs"
+ echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
+ ;;
+esac
+
+dnl Libraries
+echo ""
+echo " Shared libs: $enable_shared"
+echo " Static libs: $enable_static"
+echo " GLU: $enable_glu"
+echo " GLw: $enable_glw"
+echo " glut: $enable_glut"
+
+dnl Programs
+# cleanup the programs var for display
+program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
+if test "x$program_dirs" = x; then
+ echo " Demos: no"
+else
+ echo " Demos: $program_dirs"
+fi
+
echo ""
echo " Run 'make autoconf' to build Mesa"
echo ""