1 # - Find Perl libraries
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 perl.h is 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})
25 # find the perl executable
30 EXEC_PROGRAM(${PERL_EXECUTABLE}
31 ARGS -e "'use Config; print \$Config{libperl}, \"\\n\"'"
32 OUTPUT_VARIABLE PERL_LIBRARY_OUTPUT_VARIABLE
33 RETURN_VALUE PERL_LIBRARY_RETURN_VALUE
35 IF(NOT PERL_LIBRARY_RETURN_VALUE)
36 FOREACH(path ${PERL_POSSIBLE_LIB_PATHS})
37 SET(PERL_POSSIBLE_LIBRARY_NAME ${PERL_POSSIBLE_LIBRARY_NAME} "${path}/${PERL_LIBRARY_OUTPUT_VARIABLE}")
38 ENDFOREACH(path ${PERL_POSSIBLE_LIB_PATHS})
39 ENDIF(NOT PERL_LIBRARY_RETURN_VALUE)
40 EXEC_PROGRAM(${PERL_EXECUTABLE}
41 ARGS -e "'use Config; print \$Config{cppflags}, \"\\n\"'"
42 OUTPUT_VARIABLE PERL_CPPFLAGS_OUTPUT_VARIABLE
43 RETURN_VALUE PERL_CPPFLAGS_RETURN_VALUE
45 IF(NOT PERL_CPPFLAGS_RETURN_VALUE)
46 SET(PERL_EXTRA_C_FLAGS ${PERL_CPPFLAGS_OUTPUT_VARIABLE})
47 ENDIF(NOT PERL_CPPFLAGS_RETURN_VALUE)
48 ENDIF(PERL_EXECUTABLE)
50 FIND_LIBRARY(PERL_LIBRARY
51 NAMES ${PERL_POSSIBLE_LIBRARY_NAME} perl5.8.0
52 PATHS ${PERL_POSSIBLE_LIB_PATHS}
55 # handle the QUIETLY and REQUIRED arguments and set PERLLIBS_FOUND to TRUE if
56 # all listed variables are TRUE
57 INCLUDE(FindPackageHandleStandardArgs)
58 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PerlLibs DEFAULT_MSG PERL_LIBRARY PERL_INCLUDE_PATH)