bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gui/configure.ac


From: Kazunobu Kuriyama
Subject: Re: [PATCH] gui/configure.ac
Date: Fri, 06 Feb 2004 10:50:54 +0900
User-agent: Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.4) Gecko/20030624 Netscape/7.1

Alexander Malmberg wrote:

[snip]

Anyway, -gui should definitely not link with X unless it is actually
necessary.

Indeed.  That's why I suspected the "malfunction" is deliberate.
I didn't understand why config.log indicated the failure is due to
the missing symbols of X11, which is 'should definitely not'.

Can you modify the patch so that it runs the libungif test
without any special flags first, and only if the first test fails does
it try with the X flags?

Sure.  Here is the patch rewritten for fulfilling your requirement.

If --with-x=no, then it never tries to get X stuff included in the
flags even if --disable-ungif=no, or --enable-ungif.  The X stuff is
included only if they are actually needed to support ungif.

- Kazunobu Kuriyama
Index: configure.ac
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/configure.ac,v
retrieving revision 1.16
diff -u -r1.16 configure.ac
--- configure.ac        8 Jan 2004 18:43:49 -0000       1.16
+++ configure.ac        6 Feb 2004 01:25:59 -0000
@@ -54,6 +54,10 @@
              LDFLAGS="$LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib";;
 esac
 
+AC_PATH_X      # Added for checking the existence of ungif.  Note that
+                # -gui uses the API of the underlying window system ONLY IF
+               # it is definitely necessary.  
+
 #--------------------------------------------------------------------
 # The following is so that headers and custom libraries
 # in the GNUstep root are used before the standard ones
@@ -191,7 +195,60 @@
   fi
 fi
 
-AC_CHECK_LIB(ungif, DGifOpen)
+
+AC_ARG_ENABLE(ungif,
+  [  --disable-ungif         Disable UNGIF support],,
+  enable_ungif=yes)
+
+AC_ARG_WITH(ungif_library, 
+           [  --with-ungif-library=DIR UNGIF library file are in DIR], ,
+           with_ungif_library=)
+AC_ARG_WITH(ungif_include,  
+       [  --with-ungif-include=DIR UNGIF include files are in DIR], ,
+        with_ungif_include=)
+
+if test "${enable_ungif}" = yes; then
+  orig_CPPFLAGS="${CPPFLAGS}"
+  orig_LDFLAGS="${LDFLAGS}"
+  orig_LIBS="${LIBS}"
+
+  if test -n "${with_ungif_library}"; then
+    with_ungif_library="-L$with_ungif_library"
+  fi
+  if test -n "${with_ungif_include}"; then
+    with_ungif_include="-I$with_ungif_include"
+  fi
+  CPPFLAGS="${with_ungif_include} ${CPPFLAGS}"
+  LDFLAGS="${with_ungif_library} ${LDFLAGS}"
+
+  AC_CHECK_LIB(ungif, DGifOpen)
+
+  if test "${with_x}" != no && test "${ac_cv_lib_ungif_DGifOpen}" = no; then
+    AC_MSG_NOTICE([Checking if ungif is linked against -lX11])
+    # This implies either that ungif is not installed at all, or that it
+    # explicitly refers to the symbols defined in X11.  Now see if the latter
+    # is the case.
+    CPPFLAGS="${CPPFLAGS} -I${ac_x_includes}"
+    LDFLAGS="${LDFLAGS} -L${ac_x_libraries}"
+    LIBS="${LIBS} -lX11"
+
+    AC_CHECK_LIB(ungif, DGifCloseFile)
+    if test "${ac_cv_lib_ungif_DGifCloseFile}" = no; then
+      # This indicates ungif is not installed at all.  The flags reverts to
+      # the orignal value.
+      CPPFLAGS="${orig_CPPFLAGS}"
+      LDFLAGS="${orig_LDFLAGS}"
+      LIBS="${orig_LIBS}"
+    else
+      # This indicates ungif actually refers to the X11's symbols.  We modify
+      # the flags so that -gui gets linked against the X11 library to support
+      # ungif.
+      AC_MSG_NOTICE([-gui will be linked against -lX11 to support ungif 
images])
+      ADDITIONAL_INCLUDE_DIRS="$ADDITIONAL_INCLUDE_DIRS $CPPFLAGS"
+      ADDITIONAL_LIB_DIRS="$ADDITIONAL_LIB_DIRS $LDFLAGS -lX11"
+    fi
+  fi
+fi
 
 
 #--------------------------------------------------------------------

reply via email to

[Prev in Thread] Current Thread [Next in Thread]