static void _dolibrary(void) { int i; char buffer[300]; int fail, isfreetype, hasdebugger; DL_CONST void *lib_handle; fprintf( stderr, "\n" ); for ( i=0; libs[i].libname!=NULL; ++i ) { fail = false; if ( libs[i].depends_on!=NULL ) { sprintf( buffer, "%s%s", libs[i].depends_on->libname, SO_EXT ); lib_handle = dlopen(buffer,RTLD_LAZY); if ( lib_handle==NULL ) fail = 3; else { if ( dlsymbare(lib_handle,libs[i].depends_on->entry_point)==NULL ) fail = 4; } } if ( !fail ) { sprintf( buffer, "%s%s", libs[i].libname, SO_EXT ); lib_handle = dlopen(buffer,RTLD_LAZY); if ( lib_handle==NULL ) fail = true; else { if ( dlsymbare(lib_handle,libs[i].entry_point)==NULL ) fail = 2; } } isfreetype = strcmp(libs[i].libname,"libfreetype")==0; hasdebugger = false; if ( !fail && isfreetype && dlsym(lib_handle,"TT_RunIns")!=NULL ) hasdebugger = true; fprintf( stderr, "%-15s - %s\n", libs[i].libname, fail==0 ? "is present and appears functional on your system." : fail==1 ? "is not present on your system." : fail==2 ? "is present on your system but is not functional." : fail==3 ? "a prerequisite library is missing." : "a prerequisite library is not functional." ); fprintf( stderr, "\t%s\n", libs[i].description ); if ( isfreetype ) { if ( hasdebugger ) fprintf( stderr, "\tThis version of freetype includes the byte code interpreter\n\t which means you can use fontforge as a truetype debugger.\n" ); else fprintf( stderr, "\tThis version of freetype does notinclude the byte code interpreter\n\t which means you cannot use fontforge as a truetype debugger.\n\t If you want the debugger you must download freetype source,\n\t enable the bytecode interpreter, and then build it.\n" ); } if ( fail || (isfreetype && !hasdebugger)) fprintf( stderr, "\tYou may download %s from %s .\n", libs[i].libname, libs[i].url ); if ( !libs[i].usable ) fprintf( stderr, "\tUnfortunately this version of fontforge is not configured to use this\n\t library. You must rebuild from source.\n" ); } }
static void _dolibrary(void) { #if !defined(__MINGW32__) #ifndef __VMS int i, j; char buffer[3000]; int fail, isfreetype, hasdebugger; DL_CONST void *lib_handle; static char *sos[] = { SO_0_EXT, SO_1_EXT, SO_2_EXT, NULL, NULL, NULL, SO_6_EXT, NULL, NULL }; fprintf( stderr, "\n" ); for ( i=0; libs[i].libname!=NULL; ++i ) { fail = false; if ( libs[i].depends_on!=NULL ) { for ( j=0; libs[j].libname!=NULL; ++j ) if ( strcmp(libs[i].depends_on,libs[j].libname)==0 ) break; sprintf( buffer, "%s%s", libs[i].depends_on, SO_EXT ); lib_handle = dlopen(buffer,RTLD_LAZY); #ifdef LIBDIR if ( lib_handle==NULL ) { snprintf( buffer, sizeof(buffer), LIBDIR "/%s" SO_EXT, libs[i].depends_on ); lib_handle = dlopen(buffer,RTLD_LAZY); } #endif #ifdef __Mac if ( lib_handle==NULL ) { snprintf( buffer, sizeof(buffer), "/usr/X11R6/lib/%s" SO_EXT, libs[i].depends_on ); lib_handle = dlopen(buffer,RTLD_LAZY); } #endif if ( lib_handle==NULL && libs[j].so_version>=0 ) { char *so_ext; if ( libs[j].so_version >= sizeof(sos)/sizeof(sos[0]) || (so_ext = sos[ libs[j].so_version ])==NULL ) fprintf( stderr, "Internal mixup: so_version not supported %d\n", libs[i].so_version ); else { sprintf( buffer, "%s%s", libs[i].depends_on, so_ext ); lib_handle = dlopen(buffer,RTLD_LAZY); #ifdef LIBDIR if ( lib_handle==NULL ) { snprintf( buffer, sizeof(buffer), LIBDIR "/%s%s", libs[i].depends_on, so_ext ); lib_handle = dlopen(buffer,RTLD_LAZY); } #endif #ifdef __Mac if ( lib_handle==NULL ) { snprintf( buffer, sizeof(buffer), "/usr/X11R6/lib/%s%s", libs[i].depends_on, so_ext ); lib_handle = dlopen(buffer,RTLD_LAZY); } #endif } } if ( lib_handle==NULL ) fail = 3; else if ( libs[j].libname!=NULL ) { if ( dlsymbare(lib_handle,libs[j].entry_point)==NULL ) fail = 4; } } if ( !fail ) { sprintf( buffer, "%s%s", libs[i].libname, SO_EXT ); lib_handle = dlopen(buffer,RTLD_LAZY); #ifdef LIBDIR if ( lib_handle==NULL ) { snprintf( buffer, sizeof(buffer), LIBDIR "/%s" SO_EXT, libs[i].libname ); lib_handle = dlopen(buffer,RTLD_LAZY); } #endif #ifdef __Mac if ( lib_handle==NULL ) { snprintf( buffer, sizeof(buffer), "/usr/X11R6/lib/%s" SO_EXT, libs[i].libname ); lib_handle = dlopen(buffer,RTLD_LAZY); } #endif if ( lib_handle==NULL && libs[i].so_version>=0 ) { char *so_ext; if ( libs[i].so_version >= sizeof(sos)/sizeof(sos[0]) || (so_ext = sos[ libs[i].so_version ])==NULL ) fprintf( stderr, "Internal mixup: so_version not supported %d\n", libs[i].so_version ); else { sprintf( buffer, "%s%s", libs[i].libname, so_ext ); lib_handle = dlopen(buffer,RTLD_LAZY); #ifdef LIBDIR if ( lib_handle==NULL ) { snprintf( buffer, sizeof(buffer), LIBDIR "/%s%s", libs[i].libname, so_ext ); lib_handle = dlopen(buffer,RTLD_LAZY); } #endif #ifdef __Mac if ( lib_handle==NULL ) { snprintf( buffer, sizeof(buffer), "/usr/X11R6/lib/%s%s", libs[i].libname, so_ext ); lib_handle = dlopen(buffer,RTLD_LAZY); } #endif } } if ( lib_handle==NULL ) fail = true; else { if ( dlsymbare(lib_handle,libs[i].entry_point)==NULL ) fail = 2; } } isfreetype = strcmp(libs[i].libname,"libfreetype")==0; hasdebugger = false; if ( !fail && isfreetype && dlsym(lib_handle,"TT_RunIns")!=NULL ) hasdebugger = true; fprintf( stderr, "%-15s - %s\n", libs[i].libname, fail==0 ? "is present and appears functional on your system." : fail==1 ? "is not present on your system." : fail==2 ? "is present on your system but is not functional." : fail==3 ? "a prerequisite library is missing: " : "a prerequisite library is not functional: " ); if ( fail>=3 && libs[i].depends_on!=NULL ) fprintf( stderr, "\t\t%s.\n", libs[i].depends_on ); fprintf( stderr, "\t%s\n", libs[i].description ); if ( isfreetype ) { if ( hasdebugger ) fprintf( stderr, "\tThis version of freetype includes the byte code interpreter\n\t which means you can use fontforge as a truetype debugger.\n" ); else fprintf( stderr, "\tThis version of freetype does notinclude the byte code interpreter\n\t which means you cannot use fontforge as a truetype debugger.\n\t If you want the debugger you must download freetype source,\n\t enable the bytecode interpreter, and then build it.\n" ); } if ( fail || (isfreetype && !hasdebugger)) fprintf( stderr, "\tYou may download %s from %s .\n", libs[i].libname, libs[i].url ); if ( !libs[i].usable ) fprintf( stderr, "\tUnfortunately this version of fontforge is not configured to use this\n\t library. You must rebuild from source.\n" ); } #endif #endif }