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