added libjpeg detection code, so postscript image embedding will be disabled if libjpeg not present
This commit is contained in:
parent
e06bfe5191
commit
69aef1ffce
|
|
@ -1,5 +1,6 @@
|
|||
put /local/xschem/cflags [@
|
||||
@cc/cflags@
|
||||
@?libs/sul/libjpeg/cflags@
|
||||
@?libs/gui/cairo/cflags@
|
||||
@?libs/gui/xrender/cflags@
|
||||
@?libs/gui/xcb/cflags@
|
||||
|
|
@ -13,6 +14,7 @@ put /local/xschem/cflags [@
|
|||
put /local/xschem/ldflags [@
|
||||
@cc/ldflags@
|
||||
-lm
|
||||
@?libs/sul/libjpeg/ldflags@
|
||||
@?libs/gui/cairo/ldflags@
|
||||
@?libs/gui/xrender/ldflags@
|
||||
@?libs/gui/xcb/ldflags@
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ print [@/*************************************************************/
|
|||
/* Source: config.h.in; to regenerate run ./configure */
|
||||
/*************************************************************/@]
|
||||
|
||||
print {\n\n/* Define this var if libjpeg is available and is to be used */\n}
|
||||
print_ternary ?libs/sul/libjpeg/presents {#define HAS_LIBJPEG 1} {/*#undef HAS_LIBJPEG */}
|
||||
|
||||
print {\n\n/* Define this var if cairo is available and is to be used */\n}
|
||||
print_ternary ?libs/gui/cairo/presents {#define HAS_CAIRO 1} {/*#undef HAS_CAIRO */}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,38 +9,38 @@
|
|||
|
||||
#define version "2.0.1"
|
||||
|
||||
int find_sul_pcre(const char *name, int logdepth, int fatal)
|
||||
int find_sul_libjpeg(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *test_c =
|
||||
NL "#include <stdio.h>"
|
||||
NL "#include <stdlib.h>"
|
||||
NL "#include <pcre.h>"
|
||||
NL "#include <jpeglib.h>"
|
||||
NL ""
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " const char *err;"
|
||||
NL " int erro, ret;"
|
||||
NL " pcre *p = pcre_compile(\"fo+b\", 0, &err, &erro, NULL);"
|
||||
NL " ret = pcre_exec(p, NULL, \"hi foobar\", 9, 0, 0, &erro, 1);"
|
||||
NL " if (ret == 0)"
|
||||
NL " puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL " struct jpeg_compress_struct cinfo;"
|
||||
NL " struct jpeg_error_mgr jerr;"
|
||||
NL " jerr.error_exit = NULL;"
|
||||
NL " cinfo.err = jpeg_std_error(&jerr);"
|
||||
NL " jpeg_create_compress(&cinfo);"
|
||||
NL " jpeg_destroy_compress(&cinfo);"
|
||||
NL " if(jerr.error_exit)"
|
||||
NL " puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL;
|
||||
|
||||
const char *node = "libs/sul/pcre";
|
||||
const char *node = "libs/sul/libjpeg";
|
||||
|
||||
if (require("cc/cc", logdepth, fatal))
|
||||
return 1;
|
||||
|
||||
report("Checking for pcre... ");
|
||||
report("Checking for libjpeg... ");
|
||||
|
||||
if (try_icl_pkg_config(logdepth, "libs/sul/pcre", test_c, NULL, "libpcre", NULL))
|
||||
if (try_icl_pkg_config(logdepth, node, test_c, NULL, "libjpeg", NULL))
|
||||
return 0;
|
||||
|
||||
if (try_icl(logdepth, node, test_c, NULL, "-I/usr/include/pcre", "-lpcre"))
|
||||
return 0;
|
||||
|
||||
if (try_icl(logdepth, node, test_c, NULL, "-I/usr/include/pcre", "-lpcre3"))
|
||||
if (try_icl(logdepth, node, test_c, NULL, NULL, "-ljpeg"))
|
||||
return 0;
|
||||
|
||||
return try_fail(logdepth, node);
|
||||
|
|
@ -123,6 +123,9 @@ int hook_preinit()
|
|||
/* Runs after initialization */
|
||||
int hook_postinit()
|
||||
{
|
||||
/* libjpeg detection */
|
||||
dep_add("libs/sul/libjpeg/*", find_sul_libjpeg);
|
||||
|
||||
db_mkdir("/local");
|
||||
db_mkdir("/local/xschem");
|
||||
|
||||
|
|
@ -289,6 +292,7 @@ int hook_detect_target()
|
|||
require("fstools/awk", 0, 1);
|
||||
require("libs/gui/xpm/*", 0, 1);
|
||||
require("libs/gui/cairo/*", 0, 0);
|
||||
require("libs/sul/libjpeg/*", 0, 0);
|
||||
|
||||
if (require("libs/gui/cairo-xcb/*", 0, 0) != 0) {
|
||||
put("libs/gui/xcb/presents", sfalse);
|
||||
|
|
@ -357,6 +361,7 @@ int hook_generate()
|
|||
printf(" tcl: %s\n", get("/target/libs/script/tcl/ldflags"));
|
||||
printf(" tk: %s\n", get("/target/libs/script/tk/ldflags"));
|
||||
printf(" cairo: %s\n", istrue(get("/target/libs/gui/cairo/presents")) ? "yes" : "no");
|
||||
printf(" libjpeg: %s\n", istrue(get("/target/libs/sul/libjpeg/presents")) ? "yes" : "no");
|
||||
printf(" xcb: %s\n", istrue(get("/target/libs/gui/xcb/presents")) ? "yes" : "no");
|
||||
|
||||
printf("\nConfiguration complete, ready to compile.\n\n");
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ rawtovcd: rawtovcd.o
|
|||
$(CC) -o rawtovcd rawtovcd.o -lm
|
||||
|
||||
xschem: $(OBJ)
|
||||
$(CC) -o xschem $(OBJ) $(LDFLAGS) -ljpeg
|
||||
$(CC) -o xschem $(OBJ) $(LDFLAGS)
|
||||
|
||||
parselabel.c: parselabel.l expandlabel.h
|
||||
flex -l -oparselabel.c parselabel.l
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@
|
|||
* @license LGPL3.
|
||||
*/
|
||||
|
||||
#include "../config.h"
|
||||
#if defined(HAS_LIBJPEG) && defined(HAS_CAIRO)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
|
@ -625,4 +627,5 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* HAS_LIBJPEG && HAS_CAIRO */
|
||||
typedef int make_iso_compilers_happy; /* to avoid empty translation unit */
|
||||
|
|
|
|||
|
|
@ -122,9 +122,9 @@ unsigned char* bin2hex(const unsigned char* bin, size_t len)
|
|||
|
||||
return out;
|
||||
}
|
||||
|
||||
void ps_drawPNG(xRect* r, double x1, double y1, double x2, double y2, int rot, int flip)
|
||||
{
|
||||
#if defined(HAS_LIBJPEG) && defined(HAS_CAIRO)
|
||||
int i;
|
||||
size_t data_size = 0;
|
||||
png_to_byte_closure_t closure = {NULL, 0, 0};
|
||||
|
|
@ -246,12 +246,12 @@ void ps_drawPNG(xRect* r, double x1, double y1, double x2, double y2, int rot, i
|
|||
fprintf(fd, "grestore\n");
|
||||
cairo_surface_destroy(surface);
|
||||
my_free(1663, &hexEncodedJPG);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, double ry2)
|
||||
{
|
||||
#if defined(HAS_CAIRO)
|
||||
#if defined(HAS_LIBJPEG) && defined(HAS_CAIRO)
|
||||
double rw, rh, scale;
|
||||
cairo_surface_t* png_sfc;
|
||||
int save_draw_window, save_draw_grid, rwi, rhi;
|
||||
|
|
@ -356,7 +356,6 @@ void ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, double ry2)
|
|||
fprintf(fd, "grestore\n");
|
||||
my_free(1666, &hexEncodedJPG);
|
||||
#endif
|
||||
|
||||
}
|
||||
static void set_lw(void)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue