(if (find-library "cd" "cdCreateCanvas")
	(begin
		(compile -s -O2 -d1 "canvas-draw-base.scm" -j canvas-draw-base "-lcd")
		(compile -c -O2 -d1 "canvas-draw-base.scm" -j canvas-draw-base -unit canvas-draw-base)
		(compile -s -O2 -d0 "canvas-draw-base.import.scm")
		
		(install-extension
		 'canvas-draw-base
		 '("canvas-draw-base.so" "canvas-draw-base.o" "canvas-draw-base.import.so" "canvas-draw-types.scm")
		 '((version 1.0.0)
			 (static "canvas-draw-base.o")
			 (static-options "-lcd")))
		
		(compile -s -O2 -d1 "canvas-draw-primitives.scm" -j canvas-draw-primitives "-lcd")
		(compile -c -O2 -d1 "canvas-draw-primitives.scm" -j canvas-draw-primitives -unit canvas-draw-primitives)
		(compile -s -O2 -d0 "canvas-draw-primitives.import.scm")
		
		(install-extension
		 'canvas-draw-primitives
		 '("canvas-draw-primitives.so" "canvas-draw-primitives.o" "canvas-draw-primitives.import.so" "canvas-draw-types.scm")
		 '((version 1.0.0)
			 (static "canvas-draw-primitives.o")
			 (static-options "-lcd")))
		
		(compile -s -O2 -d1 "canvas-draw-play.scm" -j canvas-draw-play "-lcd")
		(compile -c -O2 -d1 "canvas-draw-play.scm" -j canvas-draw-play -unit canvas-draw-play)
		(compile -s -O2 -d0 "canvas-draw-play.import.scm")
		
		(install-extension
		 'canvas-draw-play
		 '("canvas-draw-play.so" "canvas-draw-play.o" "canvas-draw-play.import.so" "canvas-draw-types.scm")
		 '((version 1.0.0)
			 (static "canvas-draw-play.o")
			 (static-options "-lcd")))
		
		(if (find-library "iupcd" "cdContextIup")
			(begin
				(compile -s -O2 -d1 "canvas-draw-iup.scm" -j canvas-draw-iup "-liupcd")
				(compile -c -O2 -d1 "canvas-draw-iup.scm" -j canvas-draw-iup -unit canvas-draw-iup)
				(compile -s -O2 -d0 "canvas-draw-iup.import.scm")
				
				(install-extension
				 'canvas-draw-iup
				 '("canvas-draw-iup.so" "canvas-draw-iup.o" "canvas-draw-iup.import.so")
				 '((version 1.0.0)
					 (static "canvas-draw-iup.o")
					 (static-options "-liupcd"))))
			(warning "CD IUP driver not found, some bindings cannot be compiled"))
		
		(cond
			[(find-library "cdx11" "cdContextNativeWindow")
			 (compile -s -O2 -d1 "canvas-draw-native.scm" -j canvas-draw-native "-lcdx11 -lcdcontextplus")
			 (compile -c -O2 -d1 "canvas-draw-native.scm" -j canvas-draw-native -unit canvas-draw-native)
			 (compile -s -O2 -d0 "canvas-draw-native.import.scm")
			 
			 (install-extension
				'canvas-draw-native
				'("canvas-draw-native.so" "canvas-draw-native.o" "canvas-draw-native.import.so")
				'((version 1.0.0)
					(static "canvas-draw-native.o")
					(static-options "-lcdx11 -lcdcontextplus")))]
			[(find-library "cd" "cdContextNativeWindow")
			 (compile -s -O2 -d1 "canvas-draw-native.scm" -j canvas-draw-native "-lcd -lcdcontextplus")
			 (compile -c -O2 -d1 "canvas-draw-native.scm" -j canvas-draw-native -unit canvas-draw-native)
			 (compile -s -O2 -d0 "canvas-draw-native.import.scm")
			 
			 (install-extension
				'canvas-draw-native
				'("canvas-draw-native.so" "canvas-draw-native.o" "canvas-draw-native.import.so")
				'((version 1.0.0)
					(static "canvas-draw-native.o")
					(static-options "-lcd -lcdcontextplus")))]
			[else
			 (warning "CD native window driver not found, some bindings cannot be compiled")])
		
		(if (find-library "cdgl" "cdContextGL")
			(begin
				(compile -s -O2 -d1 "canvas-draw-gl.scm" -j canvas-draw-gl "-lcdgl")
				(compile -c -O2 -d1 "canvas-draw-gl.scm" -j canvas-draw-gl -unit canvas-draw-gl)
				(compile -s -O2 -d0 "canvas-draw-gl.import.scm")
				
				(install-extension
				 'canvas-draw-gl
				 '("canvas-draw-gl.so" "canvas-draw-gl.o" "canvas-draw-gl.import.so")
				 '((version 1.0.0)
					 (static "canvas-draw-gl.o")
					 (static-options "-lcdgl"))))
			(warning "CD OpenGL driver not found, some bindings cannot be compiled"))
		
		(cond
			[(find-library "cdx11" "cdContextClipboard")
			 (compile -s -O2 -d1 "canvas-draw-clipboard.scm" -j canvas-draw-clipboard "-lcdx11")
			 (compile -c -O2 -d1 "canvas-draw-clipboard.scm" -j canvas-draw-clipboard -unit canvas-draw-clipboard)
			 (compile -s -O2 -d0 "canvas-draw-clipboard.import.scm")
			 
			 (install-extension
				'canvas-draw-clipboard
				'("canvas-draw-clipboard.so" "canvas-draw-clipboard.o" "canvas-draw-clipboard.import.so")
				'((version 1.0.0)
					(static "canvas-draw-clipboard.o")
					(static-options "-lcdx11")))]
			[(find-library "cd" "cdContextClipboard")
			 (compile -s -O2 -d1 "canvas-draw-clipboard.scm" -j canvas-draw-clipboard "-lcd")
			 (compile -c -O2 -d1 "canvas-draw-clipboard.scm" -j canvas-draw-clipboard -unit canvas-draw-clipboard)
			 (compile -s -O2 -d0 "canvas-draw-clipboard.import.scm")
			 
			 (install-extension
				'canvas-draw-clipboard
				'("canvas-draw-clipboard.so" "canvas-draw-clipboard.o" "canvas-draw-clipboard.import.so")
				'((version 1.0.0)
					(static "canvas-draw-clipboard.o")
					(static-options "-lcd")))]
			[else
			 (warning "CD clipboard driver not found, some bindings cannot be compiled")])
		
		(cond
			[(find-library "cdx11" "cdContextPrinter")
			 (compile -s -O2 -d1 "canvas-draw-printer.scm" -j canvas-draw-printer "-lcdx11")
			 (compile -c -O2 -d1 "canvas-draw-printer.scm" -j canvas-draw-printer -unit canvas-draw-printer)
			 (compile -s -O2 -d0 "canvas-draw-printer.import.scm")
			 
			 (install-extension
				'canvas-draw-printer
				'("canvas-draw-printer.so" "canvas-draw-printer.o" "canvas-draw-printer.import.so")
				'((version 1.0.0)
					(static "canvas-draw-printer.o")
					(static-options "-lcdx11")))]
			[(find-library "cd" "cdContextPrinter")
			 (compile -s -O2 -d1 "canvas-draw-printer.scm" -j canvas-draw-printer "-lcd")
			 (compile -c -O2 -d1 "canvas-draw-printer.scm" -j canvas-draw-printer -unit canvas-draw-printer)
			 (compile -s -O2 -d0 "canvas-draw-printer.import.scm")
			 
			 (install-extension
				'canvas-draw-printer
				'("canvas-draw-printer.so" "canvas-draw-printer.o" "canvas-draw-printer.import.so")
				'((version 1.0.0)
					(static "canvas-draw-printer.o")
					(static-options "-lcd")))]
			[else
			 (warning "CD printer driver not found, some bindings cannot be compiled")])
		
		(if (find-library "cd" "cdContextPicture")
			(begin
				(compile -s -O2 -d1 "canvas-draw-picture.scm" -j canvas-draw-picture "-lcd")
				(compile -c -O2 -d1 "canvas-draw-picture.scm" -j canvas-draw-picture -unit canvas-draw-picture)
				(compile -s -O2 -d0 "canvas-draw-picture.import.scm")
				
				(install-extension
				 'canvas-draw-picture
				 '("canvas-draw-picture.so" "canvas-draw-picture.o" "canvas-draw-picture.import.so")
				 '((version 1.0.0)
				   (static "canvas-draw-picture.o")
				   (static-options "-lcd"))))
			(warning "CD picture driver not found, some bindings cannot be compiled"))
		
		(cond
			[(find-library "cdx11" "cdContextImage")
			 (compile -s -O2 -d1 "canvas-draw-server.scm" -j canvas-draw-server "-lcdx11")
			 (compile -c -O2 -d1 "canvas-draw-server.scm" -j canvas-draw-server -unit canvas-draw-server)
			 (compile -s -O2 -d0 "canvas-draw-server.import.scm")
			 
			 (install-extension
				'canvas-draw-server
				'("canvas-draw-server.so" "canvas-draw-server.o" "canvas-draw-server.import.so")
				'((version 1.0.0)
					(static "canvas-draw-server.o")
					(static-options "-lcdx11")))]
			[(find-library "cd" "cdContextImage")
			 (compile -s -O2 -d1 "canvas-draw-server.scm" -j canvas-draw-server "-lcd")
			 (compile -c -O2 -d1 "canvas-draw-server.scm" -j canvas-draw-server -unit canvas-draw-server)
			 (compile -s -O2 -d0 "canvas-draw-server.import.scm")
			 
			 (install-extension
				'canvas-draw-server
				'("canvas-draw-server.so" "canvas-draw-server.o" "canvas-draw-server.import.so")
				'((version 1.0.0)
					(static "canvas-draw-server.o")
					(static-options "-lcd")))]
			[else
			 (warning "CD server image driver not found, some bindings cannot be compiled")])
		
		(if (find-library "cd" "cdContextImageRGB")
			(begin
				(compile -s -O2 -d1 "canvas-draw-client.scm" -j canvas-draw-client "-lcd")
				(compile -c -O2 -d1 "canvas-draw-client.scm" -j canvas-draw-client -unit canvas-draw-client)
				(compile -s -O2 -d0 "canvas-draw-client.import.scm")
				
				(install-extension
				 'canvas-draw-client
				 '("canvas-draw-client.so" "canvas-draw-client.o" "canvas-draw-client.import.so")
				 '((version 1.0.0)
				   (static "canvas-draw-client.o")
				   (static-options "-lcd"))))
			(warning "CD client image driver not found, some bindings cannot be compiled"))
		
		(if (find-library "cdpdf" "cdContextPDF")
			(begin
				(compile -s -O2 -d1 "canvas-draw-pdf.scm" -j canvas-draw-pdf "-lcdpdf")
				(compile -c -O2 -d1 "canvas-draw-pdf.scm" -j canvas-draw-pdf -unit canvas-draw-pdf)
				(compile -s -O2 -d0 "canvas-draw-pdf.import.scm")
				
				(install-extension
				 'canvas-draw-pdf
				 '("canvas-draw-pdf.so" "canvas-draw-pdf.o" "canvas-draw-pdf.import.so")
				 '((version 1.0.0)
				   (static "canvas-draw-pdf.o")
				   (static-options "-lcdpdf"))))
			(warning "CD PDF driver not found, some bindings cannot be compiled"))
		
		(if (find-library "cd" "cdContextPS")
			(begin
				(compile -s -O2 -d1 "canvas-draw-ps.scm" -j canvas-draw-ps "-lcd")
				(compile -c -O2 -d1 "canvas-draw-ps.scm" -j canvas-draw-ps -unit canvas-draw-ps)
				(compile -s -O2 -d0 "canvas-draw-ps.import.scm")
				
				(install-extension
				 'canvas-draw-ps
				 '("canvas-draw-ps.so" "canvas-draw-ps.o" "canvas-draw-ps.import.so")
				 '((version 1.0.0)
				   (static "canvas-draw-ps.o")
				   (static-options "-lcd"))))
			(warning "CD PostScript driver not found, some bindings cannot be compiled"))
		
		(if (find-library "cd" "cdContextSVG")
			(begin
				(compile -s -O2 -d1 "canvas-draw-svg.scm" -j canvas-draw-svg "-lcd")
				(compile -c -O2 -d1 "canvas-draw-svg.scm" -j canvas-draw-svg -unit canvas-draw-svg)
				(compile -s -O2 -d0 "canvas-draw-svg.import.scm")
				
				(install-extension
				 'canvas-draw-svg
				 '("canvas-draw-svg.so" "canvas-draw-svg.o" "canvas-draw-svg.import.so")
				 '((version 1.0.0)
				   (static "canvas-draw-svg.o")
				   (static-options "-lcd"))))
			(warning "CD SVG driver not found, some bindings cannot be compiled"))
		
		(if (find-library "cd" "cdContextMetafile")
			(begin
				(compile -s -O2 -d1 "canvas-draw-metafile.scm" -j canvas-draw-metafile "-lcd")
				(compile -c -O2 -d1 "canvas-draw-metafile.scm" -j canvas-draw-metafile -unit canvas-draw-metafile)
				(compile -s -O2 -d0 "canvas-draw-metafile.import.scm")
				
				(install-extension
				 'canvas-draw-metafile
				 '("canvas-draw-metafile.so" "canvas-draw-metafile.o" "canvas-draw-metafile.import.so")
				 '((version 1.0.0)
				   (static "canvas-draw-metafile.o")
				   (static-options "-lcd"))))
			(warning "CD metafile driver not found, some bindings cannot be compiled"))
		
		(if (find-library "cd" "cdContextDebug")
			(begin
				(compile -s -O2 -d1 "canvas-draw-debug.scm" -j canvas-draw-debug "-lcd")
				(compile -c -O2 -d1 "canvas-draw-debug.scm" -j canvas-draw-debug -unit canvas-draw-debug)
				(compile -s -O2 -d0 "canvas-draw-debug.import.scm")
				
				(install-extension
				 'canvas-draw-debug
				 '("canvas-draw-debug.so" "canvas-draw-debug.o" "canvas-draw-debug.import.so")
				 '((version 1.0.0)
				   (static "canvas-draw-debug.o")
				   (static-options "-lcd"))))
			(warning "CD debug driver not found, some bindings cannot be compiled"))
		
		(if (find-library "cd" "cdContextCGM")
			(begin
				(compile -s -O2 -d1 "canvas-draw-cgm.scm" -j canvas-draw-cgm "-lcd")
				(compile -c -O2 -d1 "canvas-draw-cgm.scm" -j canvas-draw-cgm -unit canvas-draw-cgm)
				(compile -s -O2 -d0 "canvas-draw-cgm.import.scm")
				
				(install-extension
				 'canvas-draw-cgm
				 '("canvas-draw-cgm.so" "canvas-draw-cgm.o" "canvas-draw-cgm.import.so")
				 '((version 1.0.0)
				   (static "canvas-draw-cgm.o")
				   (static-options "-lcd"))))
			(warning "CD CGM driver not found, some bindings cannot be compiled"))
		
		(if (find-library "cd" "cdContextDGN")
			(begin
				(compile -s -O2 -d1 "canvas-draw-dgn.scm" -j canvas-draw-dgn "-lcd")
				(compile -c -O2 -d1 "canvas-draw-dgn.scm" -j canvas-draw-dgn -unit canvas-draw-dgn)
				(compile -s -O2 -d0 "canvas-draw-dgn.import.scm")
				
				(install-extension
				 'canvas-draw-dgn
				 '("canvas-draw-dgn.so" "canvas-draw-dgn.o" "canvas-draw-dgn.import.so")
				 '((version 1.0.0)
				   (static "canvas-draw-dgn.o")
				   (static-options "-lcd"))))
			(warning "CD DGN driver not found, some bindings cannot be compiled"))
		
		(if (find-library "cd" "cdContextDXF")
			(begin
				(compile -s -O2 -d1 "canvas-draw-dxf.scm" -j canvas-draw-dxf "-lcd")
				(compile -c -O2 -d1 "canvas-draw-dxf.scm" -j canvas-draw-dxf -unit canvas-draw-dxf)
				(compile -s -O2 -d0 "canvas-draw-dxf.import.scm")
				
				(install-extension
				 'canvas-draw-dxf
				 '("canvas-draw-dxf.so" "canvas-draw-dxf.o" "canvas-draw-dxf.import.so")
				 '((version 1.0.0)
				   (static "canvas-draw-dxf.o")
				   (static-options "-lcd"))))
			(warning "CD DXF driver not found, some bindings cannot be compiled"))
		
		(if (find-library "cd" "cdContextEMF")
			(begin
				(compile -s -O2 -d1 "canvas-draw-emf.scm" -j canvas-draw-emf "-lcd")
				(compile -c -O2 -d1 "canvas-draw-emf.scm" -j canvas-draw-emf -unit canvas-draw-emf)
				(compile -s -O2 -d0 "canvas-draw-emf.import.scm")
				
				(install-extension
				 'canvas-draw-emf
				 '("canvas-draw-emf.so" "canvas-draw-emf.o" "canvas-draw-emf.import.so")
				 '((version 1.0.0)
				   (static "canvas-draw-emf.o")
				   (static-options "-lcd"))))
			(warning "CD EMF driver not found, some bindings cannot be compiled"))
		
		(if (find-library "cd" "cdContextWMF")
			(begin
				(compile -s -O2 -d1 "canvas-draw-wmf.scm" -j canvas-draw-wmf "-lcd")
				(compile -c -O2 -d1 "canvas-draw-wmf.scm" -j canvas-draw-wmf -unit canvas-draw-wmf)
				(compile -s -O2 -d0 "canvas-draw-wmf.import.scm")
				
				(install-extension
				 'canvas-draw-wmf
				 '("canvas-draw-wmf.so" "canvas-draw-wmf.o" "canvas-draw-wmf.import.so")
				 '((version 1.0.0)
				   (static "canvas-draw-wmf.o")
				   (static-options "-lcd"))))
			(warning "CD WMF driver not found, some bindings cannot be compiled"))
		
		(compile -s -O2 -d1 "canvas-draw.scm" -j canvas-draw)
		(compile -c -O2 -d1 "canvas-draw.scm" -j canvas-draw -unit canvas-draw)
		(compile -s -O2 -d0 "canvas-draw.import.scm")
		
		(install-extension
		 'canvas-draw
		 '("canvas-draw.so" "canvas-draw.o" "canvas-draw.import.so")
		 '((version 1.0.0)
			 (static "canvas-draw.o"))))
	(error "CD not found, none of the bindings can be compiled"))
