3866 |
20 Feb 20 |
peter |
## $Id$ |
3866 |
20 Feb 20 |
peter |
2 |
# |
3867 |
20 Feb 20 |
peter |
# serial 2 |
3866 |
20 Feb 20 |
peter |
4 |
# |
3866 |
20 Feb 20 |
peter |
# see http://www.gnu.org/software/automake/manual/automake.html#Serials |
3866 |
20 Feb 20 |
peter |
6 |
# |
3866 |
20 Feb 20 |
peter |
# SYNOPSIS |
3866 |
20 Feb 20 |
peter |
8 |
# |
3866 |
20 Feb 20 |
peter |
# YAT_CHECK_PLPLOT([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) |
3866 |
20 Feb 20 |
peter |
10 |
# |
3866 |
20 Feb 20 |
peter |
# DESCRIPTION |
3866 |
20 Feb 20 |
peter |
12 |
# |
3866 |
20 Feb 20 |
peter |
# If pkg-config is available infer variables PLPLOT_CPPFLAGS, |
3866 |
20 Feb 20 |
peter |
# PLPLOT_CXXFLAGS_PLPLOT, PLPLOT_LDFLAGS and PLPLOT_LIBS from |
3866 |
20 Feb 20 |
peter |
# pkg-config. Otherwise try linking against plplot-c++ and |
3866 |
20 Feb 20 |
peter |
# plplotd-c++ to set PLPLOT_LIBS to what the library is called on |
3867 |
20 Feb 20 |
peter |
# this system. If PLPLOT_* variable above are already set, the |
3867 |
20 Feb 20 |
peter |
# values from pkg-config is ignored. |
3866 |
20 Feb 20 |
peter |
19 |
# |
3866 |
20 Feb 20 |
peter |
# COPYLEFT |
3866 |
20 Feb 20 |
peter |
21 |
# |
3866 |
20 Feb 20 |
peter |
# Copyright (C) 2020 Peter Johansson |
3866 |
20 Feb 20 |
peter |
23 |
# |
3866 |
20 Feb 20 |
peter |
# This file is part of the yat library, http://dev.thep.lu.se/yat |
3866 |
20 Feb 20 |
peter |
25 |
# |
3866 |
20 Feb 20 |
peter |
# The yat library is free software; you can redistribute it and/or |
3866 |
20 Feb 20 |
peter |
# modify it under the terms of the GNU General Public License as |
3866 |
20 Feb 20 |
peter |
# published by the Free Software Foundation; either version 3 of the |
3866 |
20 Feb 20 |
peter |
# License, or (at your option) any later version. |
3866 |
20 Feb 20 |
peter |
30 |
# |
3866 |
20 Feb 20 |
peter |
# The yat library is distributed in the hope that it will be useful, |
3866 |
20 Feb 20 |
peter |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3866 |
20 Feb 20 |
peter |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3866 |
20 Feb 20 |
peter |
# General Public License for more details. |
3866 |
20 Feb 20 |
peter |
35 |
# |
3866 |
20 Feb 20 |
peter |
# You should have received a copy of the GNU General Public License |
3866 |
20 Feb 20 |
peter |
# along with yat. If not, see <http://www.gnu.org/licenses/>. |
3866 |
20 Feb 20 |
peter |
38 |
# |
3866 |
20 Feb 20 |
peter |
39 |
|
3866 |
20 Feb 20 |
peter |
## This macro is a modified version of the the code found in the |
3866 |
20 Feb 20 |
peter |
## 'configure.ac' of svndigest, http://dev.thep.lu.se/svndigest, which |
3866 |
20 Feb 20 |
peter |
## was written by Jari Häkkinen and Peter Johansson |
3866 |
20 Feb 20 |
peter |
43 |
## |
3866 |
20 Feb 20 |
peter |
## Copyright (C) 2009, 2015 Jari Häkkinen |
3866 |
20 Feb 20 |
peter |
## Copyright (C) 2010, 2011, 2012 Peter Johansson |
3866 |
20 Feb 20 |
peter |
46 |
|
3866 |
20 Feb 20 |
peter |
47 |
AC_DEFUN([YAT_CHECK_PLPLOT], |
3866 |
20 Feb 20 |
peter |
48 |
[ |
3866 |
20 Feb 20 |
peter |
49 |
YAT_CHECK_PKG_CONFIG_PLPLOT |
3866 |
20 Feb 20 |
peter |
50 |
|
3866 |
20 Feb 20 |
peter |
51 |
YAT_CHECK_PLPLOT_HEADER( |
3866 |
20 Feb 20 |
peter |
52 |
[YAT_CHECK_PLPLOT_LIB([$1],[$2])], |
3866 |
20 Feb 20 |
peter |
53 |
[$2] |
3866 |
20 Feb 20 |
peter |
54 |
) |
3866 |
20 Feb 20 |
peter |
55 |
|
3866 |
20 Feb 20 |
peter |
56 |
AC_SUBST([PLPLOT_CPPFLAGS]) |
3866 |
20 Feb 20 |
peter |
57 |
AC_SUBST([PLPLOT_CXXFLAGS]) |
3866 |
20 Feb 20 |
peter |
58 |
AC_SUBST([PLPLOT_LDFLAGS]) |
3866 |
20 Feb 20 |
peter |
59 |
AC_SUBST([PLPLOT_LIBS]) |
3866 |
20 Feb 20 |
peter |
60 |
]) |
3866 |
20 Feb 20 |
peter |
61 |
|
3866 |
20 Feb 20 |
peter |
62 |
|
3866 |
20 Feb 20 |
peter |
# set variable yat_plplot_pkg to no, plplot-c++ or plplotd-c++ |
3866 |
20 Feb 20 |
peter |
64 |
AC_DEFUN([YAT_CHECK_PKG_CONFIG_PLPLOT], |
3866 |
20 Feb 20 |
peter |
65 |
[ |
3866 |
20 Feb 20 |
peter |
66 |
PKG_PROG_PKG_CONFIG([0.23]) |
3866 |
20 Feb 20 |
peter |
67 |
|
3866 |
20 Feb 20 |
peter |
68 |
yat_plplot_pkg=no |
3866 |
20 Feb 20 |
peter |
69 |
AS_VAR_SET_IF([PKG_CONFIG], [ |
3866 |
20 Feb 20 |
peter |
70 |
m4_foreach_w([yat_PKG], [plplot-c++ plplotd-c++], [ |
3866 |
20 Feb 20 |
peter |
71 |
AS_VAR_IF([yat_plplot_pkg], [no], [ |
3866 |
20 Feb 20 |
peter |
72 |
AC_MSG_CHECKING([for yat_PKG.pc]) |
3866 |
20 Feb 20 |
peter |
73 |
PKG_CHECK_EXISTS([yat_PKG], [ |
3866 |
20 Feb 20 |
peter |
74 |
AC_MSG_RESULT([yes]) |
3866 |
20 Feb 20 |
peter |
75 |
AS_VAR_SET([yat_plplot_pkg], [yat_PKG]) |
3866 |
20 Feb 20 |
peter |
76 |
],[ |
3866 |
20 Feb 20 |
peter |
77 |
AC_MSG_RESULT([no]) |
3866 |
20 Feb 20 |
peter |
78 |
]) |
3866 |
20 Feb 20 |
peter |
79 |
]) |
3866 |
20 Feb 20 |
peter |
80 |
]) |
3866 |
20 Feb 20 |
peter |
81 |
], [ |
3866 |
20 Feb 20 |
peter |
82 |
AC_MSG_WARN([ |
3866 |
20 Feb 20 |
peter |
83 |
pkg-config could not be found or is too old. You may want to |
3866 |
20 Feb 20 |
peter |
84 |
install it and make sure it is in your PATH or set the |
3866 |
20 Feb 20 |
peter |
85 |
PKG_CONFIG environment variable to the full path to pkg-config]) |
3866 |
20 Feb 20 |
peter |
86 |
]) |
3866 |
20 Feb 20 |
peter |
87 |
|
3866 |
20 Feb 20 |
peter |
88 |
|
3867 |
20 Feb 20 |
peter |
89 |
AC_ARG_VAR([PLPLOT_CPPFLAGS], |
3867 |
20 Feb 20 |
peter |
90 |
[preprocessor flags for plplot, overriding pkg-config]) |
3867 |
20 Feb 20 |
peter |
91 |
AC_ARG_VAR([PLPLOT_CXXFLAGS], |
3867 |
20 Feb 20 |
peter |
92 |
[compiler flags for plplot, overriding pkg-config]) |
3867 |
20 Feb 20 |
peter |
93 |
AC_ARG_VAR([PLPLOT_LDFLAGS], |
3867 |
20 Feb 20 |
peter |
94 |
[linker flags for plplot, overriding pkg-config]) |
3867 |
20 Feb 20 |
peter |
95 |
AC_ARG_VAR([PLPLOT_LIBS], [libraries for plplot, overriding pkg-config]) |
3867 |
20 Feb 20 |
peter |
96 |
|
3866 |
20 Feb 20 |
peter |
97 |
AS_VAR_IF([yat_plplot_pkg], [no], [], [ |
3866 |
20 Feb 20 |
peter |
# pkg-config typically returns <prefix>/include/plplot because plplot |
3866 |
20 Feb 20 |
peter |
# people assumes users include header files as <foo.h>. We prefer |
3866 |
20 Feb 20 |
peter |
# including files as <plplot/foo.h> and therefore need to trim off |
3866 |
20 Feb 20 |
peter |
# trailing '/plplot'. Space is included in sed expression to avoid |
3866 |
20 Feb 20 |
peter |
# substituting potential '/plplot' in PREFIX. |
3867 |
20 Feb 20 |
peter |
103 |
|
3867 |
20 Feb 20 |
peter |
# only set flags if not already set, to allow user to override |
3867 |
20 Feb 20 |
peter |
105 |
AS_VAR_SET_IF([PLPLOT_CPPFLAGS], [], [ |
3867 |
20 Feb 20 |
peter |
106 |
PLPLOT_CPPFLAGS=`$PKG_CONFIG --cflags-only-I $yat_plplot_pkg | sed 's|/plplot | |g'`]) |
3867 |
20 Feb 20 |
peter |
107 |
|
3867 |
20 Feb 20 |
peter |
108 |
AS_VAR_SET_IF([PLPLOT_CXXFLAGS], [], [ |
3867 |
20 Feb 20 |
peter |
109 |
PLPLOT_CXXFLAGS=`$PKG_CONFIG --cflags-only-other $yat_plplot_pkg`]) |
3867 |
20 Feb 20 |
peter |
110 |
|
3867 |
20 Feb 20 |
peter |
111 |
AS_VAR_SET_IF([PLPLOT_LDFLAGS], [], [ |
3867 |
20 Feb 20 |
peter |
112 |
PLPLOT_LDFLAGS=`$PKG_CONFIG --libs-only-other --libs-only-L $yat_plplot_pkg`]) |
3867 |
20 Feb 20 |
peter |
113 |
|
3867 |
20 Feb 20 |
peter |
114 |
AS_VAR_SET_IF([PLPLOT_LIBS], [], [ |
3867 |
20 Feb 20 |
peter |
115 |
PLPLOT_LIBS=`$PKG_CONFIG --libs-only-l $yat_plplot_pkg`]) |
3866 |
20 Feb 20 |
peter |
116 |
]) |
3866 |
20 Feb 20 |
peter |
117 |
]) |
3866 |
20 Feb 20 |
peter |
118 |
|
3866 |
20 Feb 20 |
peter |
119 |
|
3866 |
20 Feb 20 |
peter |
120 |
AC_DEFUN([YAT_CHECK_PLPLOT_HEADER], |
3866 |
20 Feb 20 |
peter |
121 |
[ |
3866 |
20 Feb 20 |
peter |
122 |
AC_REQUIRE([YAT_CHECK_PKG_CONFIG_PLPLOT]) |
3866 |
20 Feb 20 |
peter |
123 |
save_CPPFLAGS=$CPPFLAGS |
3866 |
20 Feb 20 |
peter |
124 |
save_CXXFLAGS=$CXXFLAGS |
3866 |
20 Feb 20 |
peter |
125 |
CPPFLAGS="$CPPFLAGS $PLPLOT_CPPFLAGS" |
3866 |
20 Feb 20 |
peter |
126 |
CXXFLAGS="$CXXFLAGS $PLPLOT_CXXFLAGS" |
3866 |
20 Feb 20 |
peter |
127 |
AC_CHECK_HEADERS([plplot/plstream.h], [ |
3866 |
20 Feb 20 |
peter |
128 |
CPPFLAGS=$save_CPPFLAGS |
3866 |
20 Feb 20 |
peter |
129 |
CXXFLAGS=$save_CXXFLAGS |
3866 |
20 Feb 20 |
peter |
130 |
$1 |
3866 |
20 Feb 20 |
peter |
131 |
], [ |
3866 |
20 Feb 20 |
peter |
132 |
CPPFLAGS=$save_CPPFLAGS |
3866 |
20 Feb 20 |
peter |
133 |
CXXFLAGS=$save_CXXFLAGS |
3866 |
20 Feb 20 |
peter |
134 |
$2 |
3866 |
20 Feb 20 |
peter |
135 |
]) |
3866 |
20 Feb 20 |
peter |
136 |
]) |
3866 |
20 Feb 20 |
peter |
137 |
|
3866 |
20 Feb 20 |
peter |
138 |
|
3866 |
20 Feb 20 |
peter |
139 |
AC_DEFUN([YAT_CHECK_PLPLOT_LIB], |
3866 |
20 Feb 20 |
peter |
140 |
[ |
3866 |
20 Feb 20 |
peter |
141 |
AC_REQUIRE([YAT_CHECK_PKG_CONFIG_PLPLOT]) |
3866 |
20 Feb 20 |
peter |
142 |
|
3867 |
20 Feb 20 |
peter |
143 |
save_CPPFLAGS=$CPPFLAGS |
3867 |
20 Feb 20 |
peter |
144 |
save_CXXFLAGS=$CXXFLAGS |
3867 |
20 Feb 20 |
peter |
145 |
save_LDFLAGS=$LDFLAGS |
3866 |
20 Feb 20 |
peter |
146 |
save_LIBS=$LIBS |
3867 |
20 Feb 20 |
peter |
147 |
AS_VAR_SET_IF([PLPLOT_LIBS], [ |
3866 |
20 Feb 20 |
peter |
148 |
LDFLAGS="$LDFLAGS $PLPLOT_LDFLAGS" |
3866 |
20 Feb 20 |
peter |
149 |
LIBS="$LIBS $PLPLOT_LIBS" |
3866 |
20 Feb 20 |
peter |
150 |
AC_MSG_CHECKING([linking against $PLPLOT_LIBS]) |
3866 |
20 Feb 20 |
peter |
151 |
AC_LINK_IFELSE([AC_LANG_PROGRAM()], [ |
3866 |
20 Feb 20 |
peter |
152 |
AC_MSG_RESULT([ok]) |
3867 |
20 Feb 20 |
peter |
dnl restore variables already here so user can set these variables (in $1) |
3866 |
20 Feb 20 |
peter |
154 |
LDFLAGS=$save_LDFLAGS |
3866 |
20 Feb 20 |
peter |
155 |
LIBS=$save_LIBS |
3866 |
20 Feb 20 |
peter |
156 |
$1 |
3866 |
20 Feb 20 |
peter |
157 |
], [ |
3866 |
20 Feb 20 |
peter |
158 |
AC_MSG_RESULT([failed]) |
3867 |
20 Feb 20 |
peter |
dnl restore variables already here so user can set these variables (in $2) |
3866 |
20 Feb 20 |
peter |
160 |
LDFLAGS=$save_LDFLAGS |
3866 |
20 Feb 20 |
peter |
161 |
LIBS=$save_LIBS |
3866 |
20 Feb 20 |
peter |
162 |
$2 |
3866 |
20 Feb 20 |
peter |
163 |
]) |
3867 |
20 Feb 20 |
peter |
164 |
], [ dnl else |
3867 |
20 Feb 20 |
peter |
165 |
CPPFLAGS="$CPPFLAGS $PLPLOT_CPPFLAGS" |
3867 |
20 Feb 20 |
peter |
166 |
CXXFLAGS="$CXXFLAGS $PLPLOT_CXXFLAGS" |
3867 |
20 Feb 20 |
peter |
167 |
LDFLAGS="$LDFLAGS $PLPLOT_LDFLAGS" |
3867 |
20 Feb 20 |
peter |
168 |
YAT_CHECK_LIBS([for library that contains plstream], [yat_cv_plplot_lib], |
3867 |
20 Feb 20 |
peter |
169 |
[plplotcxx plplotcxxd], |
3867 |
20 Feb 20 |
peter |
170 |
[AC_LANG_PROGRAM([@%:@ include <plplot/plstream.h>], |
3867 |
20 Feb 20 |
peter |
171 |
[plstream pls])], |
3867 |
20 Feb 20 |
peter |
172 |
[PLPLOT_LIBS="$yat_cv_plplot_lib" |
3867 |
20 Feb 20 |
peter |
dnl restore variables here so user can set it in $1 |
3867 |
20 Feb 20 |
peter |
174 |
CPPFLAGS=$save_CPPFLAGS |
3867 |
20 Feb 20 |
peter |
175 |
CXXFLAGS=$save_CXXFLAGS |
3867 |
20 Feb 20 |
peter |
176 |
LDFLAGS=$save_LDFLAGS |
3867 |
20 Feb 20 |
peter |
177 |
LIBS=$save_LIBS |
3867 |
20 Feb 20 |
peter |
178 |
$1], |
3867 |
20 Feb 20 |
peter |
179 |
[$2]) |
3867 |
20 Feb 20 |
peter |
180 |
]) # end VAR_SET_IF |
3867 |
20 Feb 20 |
peter |
181 |
]) # YAT_CHECK_PLPLOT_LIB |