qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs configure Makefile qe.c x11.c tqe.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs configure Makefile qe.c x11.c tqe.c
Date: Wed, 14 Oct 2015 09:31:22 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        15/10/14 09:31:21

Modified files:
        .              : configure Makefile qe.c x11.c 
Added files:
        .              : tqe.c 

Log message:
        build: improve portability
        - detect X11 configuration in configure script, no longer
          assume directories in Makefile
        - added CONFIG_XSHM and check for XShm availability
        - added TARGET_OS and TARGET_ARCH to make specific object dirs
        - no longer redefine qe_module_init in qe.c
        - added tqe.c: combined source version of tiny version
        - added target xqe to build it, but it currently generates an
          executable significantly larger than tqe.
          This oddity is under investigation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/configure?cvsroot=qemacs&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/qemacs/Makefile?cvsroot=qemacs&r1=1.82&r2=1.83
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.217&r2=1.218
http://cvs.savannah.gnu.org/viewcvs/qemacs/x11.c?cvsroot=qemacs&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/qemacs/tqe.c?cvsroot=qemacs&rev=1.1

Patches:
Index: configure
===================================================================
RCS file: /sources/qemacs/qemacs/configure,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- configure   6 Mar 2014 20:41:30 -0000       1.24
+++ configure   14 Oct 2015 09:31:20 -0000      1.25
@@ -67,6 +67,7 @@
 tiny="no"
 x11="no"
 xv="no"
+xshm="no"
 xrender="no"
 png="no"
 ffmpeg="no"
@@ -141,7 +142,6 @@
     html="yes"
     png="yes"
     x11="no"
-    xv="no"
     ;;
   *)
     extralibs="-lm"
@@ -175,15 +175,27 @@
     if test -f "/usr/include/X11/extensions/Xv.h" ; then
         xv="yes"
     fi
+    if test -f "/usr/include/X11/extensions/Xshm.h" ; then
+        xshm="yes"
+    fi
+fi
+
+if test -d "/opt/X11/lib" ; then
+    x11_libdir="/opt/X11/lib"
+elif test -d "/usr/X11R6/lib" ; then
+    x11_libdir="/usr/X11R6/lib"
 fi
 
 if test -f "/opt/X11/include/X11/Xlib.h" ; then
-    CFLAGS="$CFLAGS -I/opt/X11/include"
     x11="yes"
+    x11_includedir="/opt/X11/include"
     html="yes"
     if test -f "/opt/X11/include/X11/extensions/Xv.h" ; then
         xv="yes"
     fi
+    if test -f "/opt/X11/include/X11/extensions/Xshm.h" ; then
+        xshm="yes"
+    fi
 fi
 
 if test -z `which texi2html` ; then
@@ -205,6 +217,7 @@
 echo "  --enable-cygwin          compile for cygwin systems"
 echo "  --disable-x11            disable Xwindow support"
 echo "  --disable-xv             disable Xvideo extension support"
+echo "  --disable-xshm           disable XShm extension support"
 echo "  --disable-xrender        disable Xrender extension support"
 echo "  --enable-tiny            build a very small version"
 echo "  --disable-html           disable graphical html support"
@@ -309,6 +322,9 @@
       --enable-xv | --disable-xv)
         xv="$value"
         ;;
+      --enable-xshm | --disable-xshm)
+        xshm="$value"
+        ;;
       --enable-xrender | --disable-xrender)
         xrender="$value"
         ;;
@@ -377,6 +393,7 @@
 
 if test "$x11" = "no" ; then
     xv="no"
+    xshm="no"
     xrender="no"
 fi
 
@@ -430,6 +447,7 @@
     ffmpeg="no"
     x11="no"
     xv="no"
+    xshm="no"
     xrender="no"
     png="no"
     html="no"
@@ -473,6 +491,15 @@
     has_typeof="yes"
 fi
 
+if test "$x11" = "yes" ; then
+    if test ! -z "$x11_libdir" ; then
+        LIBS="$LIBS -L$x11_libdir"
+    fi
+    if test ! -z "$x11_includedir" ; then
+        CFLAGS="$CFLAGS -I$x11_includedir"
+    fi
+fi
+
 echo "Install prefix      $prefix"
 echo "Shared data dir     $datadir"
 echo "Manpages dir        $mandir"
@@ -481,6 +508,7 @@
 echo "Tiny build          $tiny"
 echo "X11 support         $x11"
 echo "Xvideo support      $xv"
+echo "XShm support        $xshm"
 #echo "Xrender support     $xrender"
 echo "libpng support      $png"
 echo "FFMPEG support      $ffmpeg"
@@ -512,8 +540,11 @@
 echo "STRIP=$strip $strip_args" >> $TMPMAK
 echo "INSTALL=install" >> $TMPMAK
 echo "CFLAGS=$CFLAGS" >> $TMPMAK
+echo "LIBS=$LIBS" >> $TMPMAK
 echo "LDFLAGS=$LDFLAGS" >> $TMPMAK
 echo "EXE=$exe" >> $TMPMAK
+echo "TARGET_OS=$targetos" >> $TMPMAK
+echo "TARGET_ARCH=$cpu" >> $TMPMAK
 
 if test "$cpu" = "x86" ; then
   echo "TARGET_ARCH_X86=yes" >> $TMPMAK
@@ -596,6 +627,11 @@
   echo "CONFIG_XV=yes" >> $TMPMAK
 fi
 
+if test "$xshm" = "yes" ; then
+  echo "#define CONFIG_XSHM 1" >> $TMPH
+  echo "CONFIG_XSHM=yes" >> $TMPMAK
+fi
+
 if test "$xrender" = "yes" ; then
   echo "#define CONFIG_XRENDER 1" >> $TMPH
   echo "CONFIG_XRENDER=yes" >> $TMPMAK

Index: Makefile
===================================================================
RCS file: /sources/qemacs/qemacs/Makefile,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -b -r1.82 -r1.83
--- Makefile    16 Sep 2015 12:31:19 -0000      1.82
+++ Makefile    14 Oct 2015 09:31:20 -0000      1.83
@@ -33,7 +33,7 @@
   CFLAGS   += -Wall -g -O2 -funsigned-char
   # do not warn about zero-length formats.
   CFLAGS   += -Wno-format-zero-length
-  LDFLAGS  := -g
+  LDFLAGS  += -g
 endif
 
 #include local compiler configuration file
@@ -49,9 +49,9 @@
 ifdef TARGET_ARCH_X86
   #CFLAGS+=-fomit-frame-pointer
   ifeq ($(GCC_MAJOR),2)
-    CFLAGS+=-m386 -malign-functions=0
+    CFLAGS += -m386 -malign-functions=0
   else
-    CFLAGS+=-march=i386 -falign-functions=0
+    CFLAGS += -march=i386 -falign-functions=0
   endif
 endif
 
@@ -70,22 +70,22 @@
 OBJS+= extras.o variables.o
 
 ifdef CONFIG_PNG_OUTPUT
-  HTMLTOPPM_LIBS+= -lpng
+  HTMLTOPPM_LIBS += -lpng
 endif
 
 ifdef CONFIG_DLL
-  LIBS+=$(DLLIBS)
+  LIBS += $(DLLIBS)
   # export some qemacs symbols
-  LDFLAGS+=-Wl,-E
+  LDFLAGS += -Wl,-E
 endif
 
 ifdef CONFIG_DOC
-  TARGETS+= qe-doc.html
+  TARGETS += qe-doc.html
 endif
 
 ifdef CONFIG_HAIKU
-  OBJS+= haiku.o
-  LIBS+= -lbe
+  OBJS += haiku.o
+  LIBS += -lbe
 endif
 
 ifdef CONFIG_WIN32
@@ -133,12 +133,15 @@
 ifdef CONFIG_X11
   OBJS+= x11.o
   ifdef CONFIG_XRENDER
-    LIBS+= -lXrender
+    LIBS += -lXrender
   endif
   ifdef CONFIG_XV
-    LIBS+= -lXv
+    LIBS += -lXv
   endif
-  LIBS+= -L/usr/X11R6/lib -lXext -lX11
+  ifdef CONFIG_XSHM
+    LIBS += -lXext
+  endif
+  LIBS += -lX11
 endif
 
 ifdef CONFIG_HTML
@@ -172,8 +175,8 @@
 DEPENDS:= qe.h config.h cutils.h display.h qestyles.h variables.h config.mak
 DEPENDS:= $(addprefix $(DEPTH)/, $(DEPENDS))
 
-OBJS_DIR:= $(DEPTH)/.objs
-TOBJS_DIR:= $(DEPTH)/.tobjs
+OBJS_DIR:= $(DEPTH)/.objs-$(TARGET_OS)-$(TARGET_ARCH)-$(CC)
+TOBJS_DIR:= $(DEPTH)/.tobjs-$(TARGET_OS)-$(TARGET_ARCH)-$(CC)
 OBJS:= $(addprefix $(OBJS_DIR)/, $(OBJS))
 TOBJS:= $(addprefix $(TOBJS_DIR)/, $(TOBJS))
 
@@ -214,6 +217,18 @@
        @echo `size address@hidden `wc -c address@hidden tqe $(OPTIONS) \
                | cut -d ' ' -f 7-10,13,15-40 >> STATS
 
+xqe_g$(EXE): tqe.c $(TSRCS) Makefile
+       $(echo) CC -o $@ $<
+       $(cmd)  $(CC) $(DEFINES) $(CFLAGS) $(TLDFLAGS) -o $@ $< $(TLIBS)
+
+xqe$(EXE): xqe_g$(EXE) Makefile
+       @rm -f $@
+       cp $< $@
+       -$(STRIP) $@
+       @ls -l $@
+       @echo `size address@hidden `wc -c address@hidden xqe $(OPTIONS) \
+               | cut -d ' ' -f 7-10,13,15-40 >> STATS
+
 ffplay$(EXE): qe$(EXE) Makefile
        ln -sf $< $@
 
@@ -225,12 +240,14 @@
 allmodules.txt: $(SRCS) Makefile
        @echo creating $@
        @echo '/* This file was generated automatically */' > $@
-       @grep -h ^qe_module_init $(SRCS)                    >> $@
+       @grep -h ^qe_module_init $(SRCS) | \
+            sed s/qe_module_init/qe_module_declare/ >> $@
 
 basemodules.txt: $(TSRCS) Makefile
        @echo creating $@
        @echo '/* This file was generated automatically */' > $@
-       @grep -h ^qe_module_init $(TSRCS)                   >> $@
+       @grep -h ^qe_module_init $(TSRCS) | \
+            sed s/qe_module_init/qe_module_declare/ >> $@
 
 $(OBJS_DIR)/cfb.o: cfb.c cfb.h fbfrender.h
 $(OBJS_DIR)/charsetjis.o: charsetjis.c charsetjis.def

Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -b -r1.217 -r1.218
--- qe.c        16 Sep 2015 22:18:24 -0000      1.217
+++ qe.c        14 Oct 2015 09:31:20 -0000      1.218
@@ -7916,16 +7916,15 @@
 #define MODULE_LIST  "allmodules.txt"
 #endif
 
-#undef qe_module_init
-#define qe_module_init(fn)  extern int module_ ## fn(void)
+#define qe_module_declare(fn)  extern int module_ ## fn(void)
 #include MODULE_LIST
-#undef qe_module_init
+#undef qe_module_declare
 
 static void init_all_modules(void)
 {
-#define qe_module_init(fn)  module_ ## fn()
+#define qe_module_declare(fn)  module_ ## fn()
 #include MODULE_LIST
-#undef qe_module_init
+#undef qe_module_declare
 }
 #endif
 

Index: x11.c
===================================================================
RCS file: /sources/qemacs/qemacs/x11.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- x11.c       16 Sep 2015 22:18:25 -0000      1.38
+++ x11.c       14 Oct 2015 09:31:21 -0000      1.39
@@ -30,7 +30,9 @@
 #include <X11/Xatom.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
+#ifdef CONFIG_XSHM
 #include <X11/extensions/XShm.h>
+#endif
 #ifdef CONFIG_XFT
 #include <X11/extensions/Xrender.h>
 #include <X11/Xft/Xft.h>
@@ -64,7 +66,9 @@
 static XIM xim; /* X11 input method */
 static XIC xic; /* X11 input context */
 static Pixmap dbuffer;
+#ifdef CONFIG_XSHM
 static int shm_use;
+#endif
 #ifdef CONFIG_XFT
 static XftDraw          *renderDraw;
 #endif
@@ -342,6 +346,7 @@
     dbuffer = window;
 #endif
 
+#ifdef CONFIG_XSHM
     /* shm extension usable ? */
     p = XDisplayName(display_str);
     strstart(p, "unix:", &p);
@@ -350,6 +355,7 @@
     /* Check if display is local and XShm available */
     if ((*p == ':') && XShmQueryExtension(display))
         shm_use = 1;
+#endif
 
     /* compute bitmap format */
     switch (visual_depth) {
@@ -1412,6 +1418,13 @@
                       meta ? "meta " : "",
                       len, buf[0]);
 #endif
+            if (shift) {
+                switch (keysym) {
+                case XK_ISO_Left_Tab: key = KEY_SHIFT_TAB; goto got_key;
+                default:
+                    break;
+                }
+            } else
             if (meta) {
                 switch (keysym) {
                 case XK_BackSpace:
@@ -1513,7 +1526,9 @@
 enum X11BitmapType {
     BMP_PIXMAP,
     BMP_XIMAGE,
+#ifdef CONFIG_XSHM
     BMP_XSHMIMAGE,
+#endif
 #ifdef CONFIG_XV
     BMP_XVIMAGE,
     BMP_XVSHMIMAGE,
@@ -1529,7 +1544,9 @@
         XvImage *xvimage;
 #endif
     } u;
+#ifdef CONFIG_XSHM
     XShmSegmentInfo *shm_info;
+#endif
     int x_lock, y_lock; /* destination for locking */
     XImage *ximage_lock;
 } X11Bitmap;
@@ -1556,9 +1573,11 @@
         } else
 #endif
         {
+#ifdef CONFIG_XSHM
             if (shm_use)
                 xb->type = BMP_XSHMIMAGE;
             else
+#endif
                 xb->type = BMP_XIMAGE;
             b->format = s->bitmap_format;
         }
@@ -1584,6 +1603,7 @@
             xb->u.ximage = ximage;
         }
         break;
+#ifdef CONFIG_XSHM
     case BMP_XSHMIMAGE:
         {
             XImage *ximage;
@@ -1609,6 +1629,7 @@
             xb->u.ximage = ximage;
         }
         break;
+#endif
 #ifdef CONFIG_XV
     case BMP_XVIMAGE:
         {
@@ -1663,12 +1684,14 @@
         /* NOTE: also frees the ximage data */
         XDestroyImage(xb->u.ximage);
         break;
+#ifdef CONFIG_XSHM
     case BMP_XSHMIMAGE:
         XShmDetach(display, xb->shm_info);
         XDestroyImage(xb->u.ximage);
         shmdt(xb->shm_info->shmaddr);
         qe_free(&xb->shm_info);
         break;
+#endif
 #ifdef CONFIG_XV
     case BMP_XVIMAGE:
         qe_free(&xb->u.xvimage->data);
@@ -1708,11 +1731,13 @@
                   b->width, b->height);
         break;
 
+#ifdef CONFIG_XSHM
     case BMP_XSHMIMAGE:
         XShmPutImage(display, dbuffer, gc,
                      xb->u.ximage, 0, 0, dst_x, dst_y,
                      b->width, b->height, False);
         break;
+#endif
 #ifdef CONFIG_XV
     case BMP_XVIMAGE:
         XvPutImage(display, xv_port, window, gc, xb->u.xvimage,
@@ -1752,7 +1777,9 @@
         }
         break;
     case BMP_XIMAGE:
+#ifdef CONFIG_XSHM
     case BMP_XSHMIMAGE:
+#endif
         bpp = (xb->u.ximage->bits_per_pixel + 7) >> 3;
         pict->data[0] = (unsigned char *)xb->u.ximage->data +
                         y1 * xb->u.ximage->bytes_per_line + x1 * bpp;
@@ -1788,10 +1815,10 @@
 static void x11_bmp_unlock(qe__unused__ QEditScreen *s, QEBitmap *b)
 {
     X11Bitmap *xb = b->priv_data;
-    int ret;
+
     switch (xb->type) {
     case BMP_PIXMAP:
-        ret = XPutImage(display, xb->u.pixmap, gc_pixmap, xb->ximage_lock,
+        XPutImage(display, xb->u.pixmap, gc_pixmap, xb->ximage_lock,
                   0, 0, xb->x_lock, xb->y_lock,
                   xb->ximage_lock->width, xb->ximage_lock->height);
         /* NOTE: also frees the ximage data */

Index: tqe.c
===================================================================
RCS file: tqe.c
diff -N tqe.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tqe.c       14 Oct 2015 09:31:21 -0000      1.1
@@ -0,0 +1,24 @@
+#define CONFIG_TINY 1
+#include "qe.c"
+#include "util.c"
+#include "cutils.c"
+#include "charset.c"
+#include "buffer.c"
+#include "search.c"
+#include "parser.c"
+#include "input.c"
+#include "display.c"
+#include "hex.c"
+#include "list.c"
+
+#ifdef CONFIG_WIN32
+#include "unix.c"
+#include "win32.c"
+#else
+#include "unix.c"
+#include "tty.c"
+#endif
+
+#ifdef CONFIG_INIT_CALLS
+#include "qeend.c"
+#endif



reply via email to

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