1 ################################################################################
3 # utils.cygclass - assortment of miscellaneous functions
5 # Part of cygport - Cygwin packaging application
6 # Copyright (C) 2006-2020 Cygport authors
7 # Provided by the Cygwin project <https://cygwin.com/>
9 # cygport is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # cygport is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with cygport. If not, see <https://www.gnu.org/licenses/>.
22 ################################################################################
24 #****h* Cygclasses/utils.cygclass
26 # This cygclass contains miscellaneous functions. Currently defined herein are:
32 #****f* Checks/check_header
35 # check_header [-IDIRECTORY] [-IDIRECTORY2] ... HEADER [HEADER2] ...
37 # Checks for the presence of the given header(s). Directories can be added
38 # to the default include path by prefixing them with the -I flag. Returns
39 # TRUE if all libraries are found, else FALSE.
44 local gcc_inc=$(LC_ALL=C ${CC} -print-search-dirs | grep '^install:' | cut -d ' ' -f 2)/include
46 local inc_path="${gcc_inc} ${gcc_inc}/c++ /usr/${CHOST}/include $(__host_prefix)/include"
70 #****f* Checks/check_lib
73 # check_lib [-LDIRECTORY] [-LDIRECTORY2] ... LIBRARY [LIBRARY2] ...
75 # Checks for the presence of the given library(ies). Directories can be added
76 # to the default library path by prefixing them with the -L flag. Returns
77 # TRUE if all libraries are found, else FALSE.
83 local lib_path=$(LC_ALL=C ${CC} -print-search-dirs | grep '^libraries:' | sed -e 's|libraries: =||' -e 's|:| |g' | xargs -n1 readlink -e)
86 *-cygwin*|*-mingw*|*-msys*)
88 *-darwin*) shlibext=dylib ;;
89 *-hpux*) shlibext=sl ;;
103 if [ -e ${d}/lib${l}.a -o -e ${d}/lib${l}.${shlibext} ]
115 readonly -f check_header check_lib