Correct X header path usage in configure
authorBrad Smith <brad@comstyle.com>
Sun, 8 Aug 2010 22:13:32 +0000 (18:13 -0400)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Mon, 16 Aug 2010 09:53:53 +0000 (02:53 -0700)
Don't unconditionally set the header path for OpenBSD but do so if the
--enable-visualize flag is specified.

configure

index e0b92f9..9740522 100755 (executable)
--- a/configure
+++ b/configure
@@ -293,7 +293,6 @@ case $host_os in
     ;;
   openbsd*)
     SYS="OPENBSD"
-    CFLAGS="$CFLAGS -I/usr/X11R6/include"
     LDFLAGS="$LDFLAGS -lm"
     ;;
   *linux*)
@@ -531,11 +530,16 @@ if cc_check "math.h" "-Werror" "return log2f(2);" ; then
     define HAVE_LOG2F
 fi
 
-if [ "$vis" = "yes" ] && cc_check "X11/Xlib.h" "-L/usr/X11R6/lib -lX11" "XOpenDisplay( 0 );" ; then
-    LDFLAGS="-L/usr/X11R6/lib -lX11 $LDFLAGS"
-    define HAVE_VISUALIZE
-else
-    vis="no"
+if [ "$vis" = "yes" ] ; then
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -I/usr/X11R6/include"
+    if cc_check "X11/Xlib.h" "-L/usr/X11R6/lib -lX11" "XOpenDisplay(0);" ; then
+        LDFLAGS="-L/usr/X11R6/lib -lX11 $LDFLAGS"
+        define HAVE_VISUALIZE
+    else
+        vis="no"
+        CFLAGS="$save_CFLAGS"
+   fi
 fi
 
 if [ "$swscale" = "auto" ] ; then