Made sure that Build knows if sdl-config exists
[sdlgit/SDL_perl.git] / inc / Utility.pm
1 package inc::Utility;
2 use strict;
3 use warnings;
4 use Carp;
5
6 BEGIN{
7         require Exporter;
8         our @ISA = qw(Exporter);
9         our @EXPORT_OK = qw(sdl_con_found sdl_libs sdl_c_flags); 
10 }
11
12 #checks to see if sdl-config is availabe
13 #
14 sub sdl_con_found
15 {
16         `sdl-config --libs`;
17         return 0 if ($? >> 8);
18         return 1;
19 }
20
21 sub sdl_libs
22 {
23         if(sdl_con_found)
24         {
25                 local $_ = `sdl-config --libs`;
26                 return chomp($_);
27         }
28         else
29         {
30                 return undef;
31         }
32 }
33
34 sub sdl_c_flags
35 {
36         if(sdl_con_found)
37         {
38                 local $_  = `sdl-config --cflags`;
39                 return chomp($_);
40         }
41         else
42         {
43                 return undef;
44         }
45 }
46
47 1;