# # Unix Installation: # Makefile.PL should find the necessary path information from # allegro-config. # # Win32 Installation: # It is assumed Allegro is installed in the standard directories and # will not need any -I or -L options to compile. Change $libs and # $inc below if this is not the case. # # Setting STATICLINK=1 in the environment will build without a # dependency on alleg4x.dll. # use ExtUtils::MakeMaker; if($^O =~ /win32/i || $^O =~ /cygwin/i) { $inc = ""; if($ENV{STATICLINK}) { $libs = "-lalleg_s -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lole32 "; $libs .= "-ldinput -lddraw -ldxguid -lwinmm -ldsound"; $def = "-DALLEGRO_STATICLINK "; } else { $libs = "-lalleg"; } } else { # Make sure allegro-config is installed my $version = `allegro-config --version` or die "Can't find allegro-config. Is Allegro installed?\n"; # Get -l and -L options from allegro-config for $opt (split(/ /, `allegro-config --libs`)) { $libs = "$libs$opt " if($opt =~ /^-[Ll]/); $ld = "$ld$opt " if($opt =~ /^-W/); } # Get -I and -D options from allegro-config for $opt (split(/ /, `allegro-config --cflags`)) { if($opt =~ /^-I(.*)$/) { $inc .= "$opt "; $headers .= "$1/allegro/*.h $1/allegro/inline/*.inl "; $pheaders .= "$1/allegro/platform/*.h "; } $def = "$def$opt " if($opt =~ /^-D/); } } WriteMakefile( NAME => 'Allegro', VERSION_FROM => 'lib/Allegro.pm', ABSTRACT_FROM => 'lib/Allegro.pod', AUTHOR => 'Colin O\'Leary (colin@mx3.org)', OBJECT => '$(BASEEXT)$(OBJ_EXT) gd$(OBJ_EXT)', LIBS => $libs, DEFINE => $def, INC => $inc, dynamic_lib => { OTHERLDFLAGS => $ld } ); # # This creates rules to generate auto.xsh from the Allegro headers, and # to update Allegro.pm and Allegro.pod automatically with the list of # imported functions from auto.xsh and Allegro.xs. # # Running "make auto.xsh" will probably only work under Unix. # sub MY::postamble { return << "--"; auto.xsh: functions defines misc/gen-auto-xsh $headers > auto.xsh misc/gen-auto-xsh-id $pheaders >> auto.xsh touch Allegro.xs lib/Allegro.pod: Allegro.xs auto.xsh misc/gen-allegro-pod > Allegro.pod.temp && mv Allegro.pod.temp lib/Allegro.pod lib/Allegro.pm: Allegro.xs auto.xsh misc/gen-allegro-pm > Allegro.pm.temp && mv Allegro.pm.temp lib/Allegro.pm -- }