Changeset 1208
- Timestamp:
- Oct 20, 2006, 12:43:17 AM (16 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/Makefile.am
r1013 r1208 3 3 EXTRA_DIST = caca.pc.in 4 4 DISTCLEANFILES = caca.pc 5 6 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -DPLUGINDIR=\"$(plugindir)\" 5 7 6 8 pkgconfig_DATA = caca.pc … … 21 23 time.c \ 22 24 driver_conio.c \ 23 driver_gl.c \24 25 driver_ncurses.c \ 25 26 driver_raw.c \ … … 27 28 driver_vga.c \ 28 29 driver_win32.c \ 29 driver_x11.c\30 $(extra_drivers) \ 30 31 $(NULL) 31 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul32 32 libcaca_la_LDFLAGS = -no-undefined -version-info @LT_VERSION@ 33 33 libcaca_la_LIBADD = ../cucul/libcucul.la @CACA_LIBS@ 34 34 35 if USE_PLUGINS 36 plugin_LTLIBRARIES = libx11_plugin.la libgl_plugin.la 37 plugindir = $(libdir)/caca 38 39 libx11_plugin_la_SOURCES = driver_x11.c 40 libx11_plugin_la_LDFLAGS = -no-undefined -module -no-version 41 libx11_plugin_la_LIBADD = libcaca.la ../cucul/libcucul.la @X11_LIBS@ 42 43 libgl_plugin_la_SOURCES = driver_gl.c 44 libgl_plugin_la_LDFLAGS = -no-undefined -module -no-version 45 libgl_plugin_la_LIBADD = libcaca.la ../cucul/libcucul.la @GL_LIBS@ 46 else 47 extra_drivers = driver_x11.c driver_gl.c 48 endif 49 -
libcaca/trunk/caca/caca.c
r1054 r1208 24 24 # include <stdlib.h> 25 25 # include <string.h> 26 # include <stdio.h> 26 27 # if defined(HAVE_ERRNO_H) 27 28 # include <errno.h> 29 # endif 30 # if defined(USE_PLUGINS) 31 # if defined(HAVE_DLFCN_H) 32 # include <dlfcn.h> 33 # endif 28 34 # endif 29 35 #endif … … 34 40 #include "caca_internals.h" 35 41 36 static int caca_select_driver(caca_display_t *dp); 42 #if defined(USE_PLUGINS) 43 # define gl_install(p) caca_plugin_install("gl", p) 44 # define x11_install(p) caca_plugin_install("x11", p) 45 #endif 46 47 static int caca_select_driver(caca_display_t *); 48 #if defined(USE_PLUGINS) 49 static int caca_plugin_install(char const *, caca_display_t *); 50 #endif 37 51 38 52 /** \brief Attach a caca graphical context to a cucul canvas. … … 63 77 64 78 dp->cv = cv; 79 #if defined(USE_PLUGINS) 80 dp->plugin = NULL; 81 #endif 65 82 66 83 if(caca_select_driver(dp)) 67 84 { 85 #if defined(USE_PLUGINS) 86 if(dp->plugin) 87 dlclose(dp->plugin); 88 #endif 68 89 free(dp); 69 90 #if defined(HAVE_ERRNO_H) … … 75 96 if(dp->drv.init_graphics(dp)) 76 97 { 98 #if defined(USE_PLUGINS) 99 if(dp->plugin) 100 dlclose(dp->plugin); 101 #endif 77 102 free(dp); 78 103 #if defined(HAVE_ERRNO_H) … … 129 154 { 130 155 dp->drv.end_graphics(dp); 156 #if defined(USE_PLUGINS) 157 if(dp->plugin) 158 dlclose(dp->plugin); 159 #endif 131 160 dp->cv->refcount--; 132 161 free(dp); … … 202 231 } 203 232 233 #if defined(USE_PLUGINS) 234 static int caca_plugin_install(char const *name, caca_display_t *dp) 235 { 236 char buf[512]; 237 int (*sym) (caca_display_t *); 238 239 sprintf(buf, "%s/lib%s_plugin.so", PLUGINDIR, name); 240 dp->plugin = dlopen(buf, RTLD_NOW); 241 if(!dp->plugin) 242 { 243 sprintf(buf, "lib%s_plugin.so", name); 244 dp->plugin = dlopen(buf, RTLD_NOW); 245 if(!dp->plugin) 246 return -1; 247 } 248 249 sprintf(buf, "%s_install", name); 250 sym = dlsym(dp->plugin, buf); 251 if(!sym) 252 { 253 dlclose(dp->plugin); 254 return -1; 255 } 256 257 return sym(dp); 258 } 259 #endif 260 -
libcaca/trunk/caca/caca_internals.h
r978 r1208 89 89 cucul_canvas_t *cv; 90 90 91 #if defined(USE_PLUGINS) 92 void *plugin; 93 #endif 94 91 95 /* Device-specific functions */ 92 96 struct drv -
libcaca/trunk/configure.ac
r1207 r1208 63 63 64 64 dnl conditional builds 65 AC_ARG_ENABLE(plugins, 66 [ --enable-plugins build X11 and GL drivers as plugins]) 65 67 AC_ARG_ENABLE(doc, 66 68 [ --enable-doc build documentation (needs doxygen and LaTeX)]) 67 69 68 AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h arpa/inet.h netinet/in.h winsock2.h errno.h locale.h getopt.h )70 AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h arpa/inet.h netinet/in.h winsock2.h errno.h locale.h getopt.h dlfcn.h) 69 71 AC_CHECK_FUNCS(signal ioctl vsnprintf getenv putenv strcasecmp htons) 70 72 AC_CHECK_FUNCS(usleep gettimeofday) … … 157 159 AC_DEFINE(USE_X11, 1, Define to 1 to activate the X11 backend driver) 158 160 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}" 159 CACA_LIBS="${CACA_LIBS} -lX11 ${X_LIBS}"161 X11_LIBS="${X11_LIBS} -lX11 ${X_LIBS}" 160 162 CACA_DRIVERS="${CACA_DRIVERS} x11"], 161 163 [ac_cv_my_have_x11="no"], … … 181 183 if test "${ac_cv_my_have_gl}" = "yes"; then 182 184 AC_DEFINE(USE_GL, 1, Define to 1 to activate the OpenGL backend driver) 183 CACA_LIBS="${CACA_LIBS} -lGL -lglut"185 GL_LIBS="${GL_LIBS} -lGL -lglut" 184 186 CACA_DRIVERS="${CACA_DRIVERS} gl" 185 187 elif test "${enable_gl}" = "yes"; then … … 225 227 AM_CONDITIONAL(USE_KERNEL, test "${ac_cv_my_have_vga}" = "yes") 226 228 229 if test "${enable_plugins}" = "yes"; then 230 ac_cv_my_have_plugins="yes" 231 AC_DEFINE(USE_PLUGINS, 1, Define to 1 to activate plugins) 232 CACA_LIBS="${CACA_LIBS} -ldl" 233 else 234 CACA_LIBS="${CACA_LIBS} ${X11_LIBS} ${GL_LIBS}" 235 fi 236 AM_CONDITIONAL(USE_PLUGINS, test "${ac_cv_my_have_plugins}" = "yes") 237 227 238 AC_MSG_CHECKING(valid output drivers) 228 239 if test -z "${CACA_DRIVERS}"; then … … 238 249 AC_SUBST(GETOPT_LIBS) 239 250 AC_SUBST(CACA_LIBS) 251 AC_SUBST(X11_LIBS) 252 AC_SUBST(GL_LIBS) 240 253 241 254 # Optimizations … … 262 275 if test "${enable_imlib2}" != "no"; then 263 276 IMLIB2="no" 264 PKG_CHECK_MODULES( imlib2, imlib2, [IMLIB2="yes"], [AC_MSG_RESULT(no)])277 PKG_CHECK_MODULES(IMLIB2, imlib2, [IMLIB2="yes"], [AC_MSG_RESULT(no)]) 265 278 if test "${IMLIB2}" = no; then 266 279 AC_MSG_ERROR([[cannot find Imlib2 development files. Without Imlib2, cacaview will only open BMP files; if this is really what you want, re-run configure with '--disable-imlib2'.]]) … … 270 283 # Build development tools? 271 284 PANGOFT2="no" 272 PKG_CHECK_MODULES( pangoft2, pangoft2, [PANGOFT2="yes"], [AC_MSG_RESULT(no)])285 PKG_CHECK_MODULES(PANGOFT2, pangoft2, [PANGOFT2="yes"], [AC_MSG_RESULT(no)]) 273 286 AM_CONDITIONAL(USE_PANGO, test "${PANGOFT2}" != "no") 274 287
Note: See TracChangeset
for help on using the changeset viewer.