commit f15036bada0916e14b483ae5380563ddd35e3599 Author: George Sapountzis Date: Sun Apr 15 03:57:25 2007 +0300 Build GLcore (partly) from Mesa. The xserver builds the xmesa backend and links with libmesa.a which is built by Mesa. diff --git a/GL/mesa/Makefile.am b/GL/mesa/Makefile.am index 99d3834..5cd9675 100644 --- a/GL/mesa/Makefile.am +++ b/GL/mesa/Makefile.am @@ -1,15 +1,8 @@ -SUBDIRS = main math swrast swrast_setup tnl shader X glapi vbo +SUBDIRS = X noinst_LTLIBRARIES = libGLcore.la libGLcore_la_SOURCES = dummy.c -libGLcore_la_LIBADD = main/libmain.la \ - math/libmath.la \ - swrast/libswrast.la \ - swrast_setup/libss.la \ - tnl/libtnl.la \ - shader/libshader.la \ - shader/grammar/libgrammar.la \ - shader/slang/libslang.la \ - vbo/libvbo.la \ +libGLcore_la_DEPENDENCIES = @MESA_SOURCE@/src/mesa/libmesa.a +libGLcore_la_LIBADD = -L@MESA_SOURCE@/src/mesa -lmesa \ X/libX.la diff --git a/GL/mesa/X/Makefile.am b/GL/mesa/X/Makefile.am index ace1181..a35b32f 100644 --- a/GL/mesa/X/Makefile.am +++ b/GL/mesa/X/Makefile.am @@ -1,19 +1,13 @@ noinst_LTLIBRARIES = libX.la INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ - -I../glapi \ - -I../main \ - -I../math \ - -I../shader \ - -I../swrast \ - -I../swrast_setup \ - -I../tnl \ - -I.. \ - -I../../glx \ - -I$(top_srcdir)/GL/glx \ - -I$(top_srcdir)/GL/include \ - -I$(top_srcdir)/hw/xfree86/os-support + -I. \ + -I@MESA_SOURCE@/src/mesa/glapi \ + -I@MESA_SOURCE@/src/mesa/main \ + -I@MESA_SOURCE@/src/mesa/shader \ + -I@MESA_SOURCE@/src/mesa \ + -I@MESA_SOURCE@/src/mesa/drivers/common \ + -I@MESA_SOURCE@/src/mesa/drivers/dri/common # -DXFree86Server is required because the X11 driver in Mesa thinks that # symbol means "being built in the server" @@ -22,12 +16,24 @@ AM_CFLAGS = \ -DXFree86Server \ @GLX_DEFINES@ -nodist_libX_la_SOURCES = \ - xm_api.c \ - xm_buffer.c \ - xm_dd.c \ - xm_image.c \ - xm_line.c \ - xm_span.c \ - xm_tri.c \ - drivers/common/driverfuncs.c +if MESA_IN_DRI +AM_CFLAGS += \ + @LIBDRM_CFLAGS@ \ + -DIN_DRI_DRIVER +endif + +XM_SOURCES = \ + xm_api.c \ + xm_buffer.c \ + xm_dd.c \ + xm_image.c \ + xm_line.c \ + xm_span.c \ + xm_tri.c + +XM_SOURCES += drivers/common/driverfuncs.c +if MESA_IN_DRI +XM_SOURCES += drivers/dri/common/utils.c +endif + +nodist_libX_la_SOURCES = $(XM_SOURCES) diff --git a/GL/symlink-mesa.sh b/GL/symlink-mesa.sh index 0cfe1c9..473b4ea 100755 --- a/GL/symlink-mesa.sh +++ b/GL/symlink-mesa.sh @@ -179,7 +179,11 @@ symlink_mesa_x() { src_dir src/mesa/drivers/common dst_dir mesa/X/drivers/common action driverfuncs.c - action driverfuncs.h + + # another hack + src_dir src/mesa/drivers/dri/common + dst_dir mesa/X/drivers/dri/common + action utils.c } symlink_mesa_ppc() { @@ -261,7 +265,7 @@ run() { # $1 what to do # $2 explanation - ACTION=$1 EXPLANATION=$2 run_module mesa + ACTION=$1 EXPLANATION=$2 run_module mesa_x ACTION=$1 EXPLANATION=$2 run_module glx } diff --git a/configure.ac b/configure.ac index a82485f..85fb6c8 100644 --- a/configure.ac +++ b/configure.ac @@ -495,6 +495,9 @@ AC_ARG_WITH(mesa-source, AS_HELP_STRING([--with-mesa-source=MESA_SOURCE], [P AC_ARG_WITH(dri-driver-path, AS_HELP_STRING([--with-dri-driver-path=PATH], [Path to DRI drivers (default: ${libdir}/dri)]), [ DRI_DRIVER_PATH="$withval" ], [ DRI_DRIVER_PATH="${libdir}/dri" ]) +AC_ARG_ENABLE(mesa-in-dri, AS_HELP_STRING([--enable-mesa-in-dri], [Mesa was compiled for DRI (default: auto)]), + [MESA_IN_DRI=$enableval], + [MESA_IN_DRI=auto]) AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]), [AIGLX=$enableval], [AIGLX=yes]) @@ -719,6 +722,35 @@ fi AM_CONDITIONAL(GLX, test "x$GLX" = xyes) AC_SUBST([MESA_SOURCE]) +if test "x$GLX" = xyes; then + AC_CHECK_FILE([$MESA_SOURCE/src/mesa/libmesa.a], [], + AC_MSG_ERROR([Failed to find libmesa.a in Mesa tree. Please compile Mesa either for stand-alone or DRI.])) + +dnl Check if libmesa.a has undefined references to driDispatchRemapTable + AC_MSG_CHECKING([whether Mesa was compiled for DRI]) + dri=`nm $MESA_SOURCE/src/mesa/libmesa.a | grep driDispatchRemapTable | wc -l` + if test $dri -ne 0; then + have_dri_dispatch=yes + else + have_dri_dispatch=no + fi + AC_MSG_RESULT([$have_dri_dispatch]) +fi + +if test "x$GLX" = xyes -a "x$MESA_IN_DRI" = xauto; then + MESA_IN_DRI=$have_dri_dispatch +else + MESA_IN_DRI=no +fi +AM_CONDITIONAL(MESA_IN_DRI, [test "x$MESA_IN_DRI" = xyes]) + +dnl IN_DRI needs -ldl for s3tc and -lpthread for glapi +if test "x$GLX" = xyes -a "x$MESA_IN_DRI" = xyes; then + AC_CHECK_FUNC([dlopen], [], + AC_CHECK_LIB([dl], [dlopen], GLX_LIBS="$GLX_LIBS -ldl")) + GLX_LIBS="$GLX_LIBS -lpthread" +fi + if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a "x$DRI" = xyes; then AC_DEFINE(AIGLX, 1, [Build AIGLX loader]) else @@ -1960,16 +1992,6 @@ GL/Makefile GL/apple/Makefile GL/glx/Makefile GL/mesa/Makefile -GL/mesa/glapi/Makefile -GL/mesa/main/Makefile -GL/mesa/math/Makefile -GL/mesa/shader/Makefile -GL/mesa/shader/grammar/Makefile -GL/mesa/shader/slang/Makefile -GL/mesa/swrast/Makefile -GL/mesa/swrast_setup/Makefile -GL/mesa/tnl/Makefile -GL/mesa/vbo/Makefile GL/mesa/X/Makefile include/Makefile composite/Makefile