Fixed bug 1973 - test/Makefile.in fails on Mac OS X with X11 enabled...
authorSam Lantinga <slouken@libsdl.org>
Sun, 21 Jul 2013 12:47:47 -0700
changeset 7495 c4ba5e5c2765
parent 7494 25575b2a188f
child 7496 13dfa871f0af
Fixed bug 1973 - test/Makefile.in fails on Mac OS X with X11 enabled... Ryan C. Gordon If you have the X11 SDK installed on Mac OS X, you'll build with X11 support, but the Makefile doesn't build anything but the Cocoa testnative code for Mac OS X, which is fine, but then testnative fails to link because testnative.h enables the X11 support based on the SDL config header. Building the testnativex11.c code on Mac OS X doesn't work because you need to explicitly link with "-L/usr/X11/lib -lX11" if this code is enabled, but you can't link with that by default because the X11 SDK might be missing. So this needs a little configure magic to do the right thing (or forcibly disabling X11 support on Mac OS X in testnative.h).
test/Makefile.in
test/configure
test/configure.in
--- a/test/Makefile.in	Sun Jul 21 12:37:43 2013 -0700
+++ b/test/Makefile.in	Sun Jul 21 12:47:47 2013 -0700
@@ -150,8 +150,9 @@
 
 ifeq (@ISMACOSX@,true)
 testnative$(EXE): $(srcdir)/testnative.c \
-			$(srcdir)/testnativecocoa.m
-	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) -framework Cocoa
+			$(srcdir)/testnativecocoa.m \
+			$(srcdir)/testnativex11.c
+	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) -framework Cocoa @XLIB@
 endif
 
 ifeq (@ISWINDOWS@,true)
@@ -163,7 +164,7 @@
 ifeq (@ISUNIX@,true)
 testnative$(EXE): $(srcdir)/testnative.c \
 			$(srcdir)/testnativex11.c
-	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) -L/usr/X11/lib -lX11
+	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @XLIB@
 endif
 
 testoverlay2$(EXE): $(srcdir)/testoverlay2.c
--- a/test/configure	Sun Jul 21 12:37:43 2013 -0700
+++ b/test/configure	Sun Jul 21 12:47:47 2013 -0700
@@ -585,6 +585,7 @@
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 SDL_TTF_LIB
+XLIB
 GLLIB
 CPP
 XMKMF
@@ -3793,6 +3794,7 @@
         :
     else
         XPATH="-L$ac_x_libraries"
+        XLIB="-L$ac_x_libraries -lX11"
     fi
 fi
 
@@ -3865,6 +3867,7 @@
 
 
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL2_ttf" >&5
 $as_echo_n "checking for TTF_Init in -lSDL2_ttf... " >&6; }
 if ${ac_cv_lib_SDL2_ttf_TTF_Init+:} false; then :
--- a/test/configure.in	Sun Jul 21 12:37:43 2013 -0700
+++ b/test/configure.in	Sun Jul 21 12:47:47 2013 -0700
@@ -100,6 +100,7 @@
         :
     else
         XPATH="-L$ac_x_libraries"
+        XLIB="-L$ac_x_libraries -lX11"
     fi
 fi
 
@@ -141,6 +142,7 @@
 fi
 
 AC_SUBST(GLLIB)
+AC_SUBST(XLIB)
 
 dnl Check for SDL_ttf
 AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)