-# probes for freetype1 by scanning @incs for the includes and
-# @libs for the libs. This is done separately because freetype's headers
-# are stored in a freetype or freetype1 directory under PREFIX/include.
-#
-# we could find the files with the existing mechanism, but it won't set
-# -I flags correctly.
-#
-# This could be extended to freetype2 too, but freetype-config catches
-# that
-sub freetype1_probe {
- my ($frm, $frmkey) = @_;
-
- my $found_inc;
- INCS:
- for my $inc (@incs) {
- for my $subdir (qw/freetype freetype1/) {
- my $path = File::Spec->catfile($inc, $subdir, 'freetype.h');
- -e $path or next;
- $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
- -e $path and next;
-
- $found_inc = File::Spec->catdir($inc, $subdir);
- last INCS;
- }
- }
-
- my $found_lib;
- LIBS:
- for my $lib (@libs) {
- my $a_path = File::Spec->catfile($lib, "libttf$aext");
- my $l_path = File::Spec->catfile($lib, "libttf.$lext");
- if (-e $a_path || -e $l_path) {
- $found_lib = $lib;
- last LIBS;
- }
- }
-
- return unless $found_inc && $found_lib;
- printf("%10s: includes %s - libraries %s\n", $frmkey,
- ($found_inc ? 'found' : 'not found'),
- ($found_lib ? 'found' : 'not found'));
-
- $frm->{cflags} = "-I$found_inc";
- $frm->{libfiles} = "-lttf";
-
- return 1;
-}
-
-sub catfile {
- return File::Spec->catfile(@_);
-}
-