| 1 |
# osx_pkg.m4 - Macros to add OSX brew locations to pkg-config. -*- Autoconf -*- |
| 2 |
# serial 2 (pkg-config-0.24) |
| 3 |
# |
| 4 |
# Copyright © 2024 Ko van der Sloot <[email protected]> |
| 5 |
# |
| 6 |
# This program is free software; you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation; either version 2 of the License, or |
| 9 |
# (at your option) any later version. |
| 10 |
# |
| 11 |
# This program is distributed in the hope that it will be useful, but |
| 12 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
# General Public License for more details. |
| 15 |
# |
| 16 |
# You should have received a copy of the GNU General Public License |
| 17 |
# along with this program; if not, write to the Free Software |
| 18 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 |
# |
| 20 |
# As a special exception to the GNU General Public License, if you |
| 21 |
# distribute this file as part of a program that contains a |
| 22 |
# configuration script generated by Autoconf, you may include it under |
| 23 |
# the same distribution terms that you use for the rest of that program. |
| 24 |
|
| 25 |
# AC_OSX_PKG_ALL() |
| 26 |
# add all /opt/{package} directories to the PKG_CONFIG search path |
| 27 |
# ---------------------------------- |
| 28 |
AC_DEFUN([AC_OSX_PKG_ALL], |
| 29 |
[ |
| 30 |
case ${host_os} in |
| 31 |
linux*) |
| 32 |
# linux is wellbehaved |
| 33 |
;; |
| 34 |
darwin*) |
| 35 |
# darwin isn't |
| 36 |
for i in `ls /usr/local/opt/` |
| 37 |
do |
| 38 |
if test -d "/usr/local/opt/$i/lib/pkgconfig" |
| 39 |
then |
| 40 |
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/$i/lib/pkgconfig" |
| 41 |
fi |
| 42 |
done |
| 43 |
for i in `ls /opt/homewbrew/opt` |
| 44 |
do |
| 45 |
if test -d "/opt/homebrew/opt/$i/lib/pkgconfig" |
| 46 |
then |
| 47 |
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/homebrew/opt/$i/lib/pkgconfig" |
| 48 |
fi |
| 49 |
done |
| 50 |
;; |
| 51 |
esac |
| 52 |
]) |
| 53 |
|
| 54 |
# AC_OSX_PKG([LIST_OF_PACKAGES]) |
| 55 |
# fore every packake in LIST_OF_PACKAGES, add the /opt/{package} directory |
| 56 |
# to the PKG_CONFIG search path |
| 57 |
# ---------------------------------- |
| 58 |
AC_DEFUN([AC_OSX_PKG], |
| 59 |
[ |
| 60 |
case ${host_os} in |
| 61 |
linux*) |
| 62 |
# linux is wellbehaved |
| 63 |
;; |
| 64 |
darwin*) |
| 65 |
# darwin/macos isn't |
| 66 |
for i in $* |
| 67 |
do |
| 68 |
if test -d "/usr/local/opt/$i/lib/pkgconfig" |
| 69 |
then |
| 70 |
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/$i/lib/pkgconfig" |
| 71 |
else |
| 72 |
if test -d "/opt/homebrew/opt//$i/lib/pkgconfig" |
| 73 |
then |
| 74 |
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/homebrew/opt/$i/lib/pkgconfig" |
| 75 |
fi |
| 76 |
fi |
| 77 |
done |
| 78 |
;; |
| 79 |
esac |
| 80 |
]) |