2 # This module finds if PERL is installed and determines where the include files
3 # and libraries are. It also determines what the name of the library is. This
4 # code sets the following variables:
6 # PERL_INCLUDE_PATH = path to where object.h can be found
7 # PERL_EXECUTABLE = full path to the perl binary
10 SET(PERL_POSSIBLE_INCLUDE_PATHS
11 /usr/lib/perl/5.8.3/CORE
12 /usr/lib/perl/5.8.2/CORE
13 /usr/lib/perl/5.8.1/CORE
14 /usr/lib/perl/5.8.0/CORE
15 /usr/lib/perl/5.8/CORE
18 SET(PERL_POSSIBLE_LIB_PATHS
22 FIND_PATH(PERL_INCLUDE_PATH perl.h
23 ${PERL_POSSIBLE_INCLUDE_PATHS})
26 FIND_PROGRAM(PERL_EXECUTABLE
34 EXEC_PROGRAM(${PERL_EXECUTABLE}
35 ARGS -e "'use Config; print $Config{libperl}, \"\\n\"'"
36 OUTPUT_VARIABLE PERL_LIBRARY_OUTPUT_VARIABLE
37 RETURN_VALUE PERL_LIBRARY_RETURN_VALUE
39 IF(NOT PERL_LIBRARY_RETURN_VALUE)
40 FOREACH(path ${PERL_POSSIBLE_LIB_PATHS})
41 SET(PERL_POSSIBLE_LIBRARY_NAME ${PERL_POSSIBLE_LIBRARY_NAME} "${path}/${PERL_LIBRARY_OUTPUT_VARIABLE}")
42 ENDFOREACH(path ${PERL_POSSIBLE_LIB_PATHS})
43 ENDIF(NOT PERL_LIBRARY_RETURN_VALUE)
44 EXEC_PROGRAM(${PERL_EXECUTABLE}
45 ARGS -e "'use Config; print $Config{cppflags}, \"\\n\"'"
46 OUTPUT_VARIABLE PERL_CPPFLAGS_OUTPUT_VARIABLE
47 RETURN_VALUE PERL_CPPFLAGS_RETURN_VALUE
49 IF(NOT PERL_CPPFLAGS_RETURN_VALUE)
50 SET(PERL_EXTRA_C_FLAGS ${PERL_CPPFLAGS_OUTPUT_VARIABLE})
51 SEPARATE_ARGUMENTS(PERL_EXTRA_C_FLAGS)
52 ENDIF(NOT PERL_CPPFLAGS_RETURN_VALUE)
53 ENDIF(PERL_EXECUTABLE)
55 FIND_LIBRARY(PERL_LIBRARY
56 NAMES ${PERL_POSSIBLE_LIBRARY_NAME} perl5.8.0
57 PATHS ${PERL_POSSIBLE_LIB_PATHS}