-
Notifications
You must be signed in to change notification settings - Fork 6
/
acinclude.m4
131 lines (98 loc) · 3.37 KB
/
acinclude.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
dnl AC_CHECK_VERSION(version_number_of_package,reference_minimum_version_number)
dnl sets ac_check_version_okay=yes if successful
dnl
AC_DEFUN([AC_CHECK_VERSION],[
current_version=$1
current_major_version=`echo $current_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
current_minor_version=`echo $current_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
current_micro_version=`echo $current_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
minimum_version=$2
minimum_major_version=`echo $minimum_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
minimum_minor_version=`echo $minimum_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
minimum_micro_version=`echo $minimum_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
ac_check_version_okay=no
if [ test $current_major_version -gt $minimum_major_version ]; then
ac_check_version_okay=yes
elif [ test $current_major_version -eq $minimum_major_version ]; then
if [ test $current_minor_version -gt $minimum_minor_version ]; then
ac_check_version_okay=yes
elif [ test $current_minor_version -eq $minimum_minor_version ]; then
if [ test $current_micro_version -ge $minimum_micro_version ]; then
ac_check_version_okay=yes
fi
fi
fi
])
AC_DEFUN([AC_LIBPLOT_LIBS],[
ac_can_link_libplot=no
LIBPLOT_LIBS="-lplot"
ac_libplot_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS $LIBPLOT_LIBS"
AC_MSG_CHECKING(whether libplot requires X)
AC_TRY_LINK([
#include <stdio.h>
#include <plot.h>
],[
plPlotter* plotter;
plPlotterParams* params;
params = pl_newplparams ();
plotter = pl_newpl_r ("X",stdin,stdout,stderr,params);
pl_deletepl_r (plotter);
pl_deleteplparams (params);
],[ ac_can_link_libplot=yes
AC_MSG_RESULT(no)
],[ AC_MSG_RESULT(yes)
])
LDFLAGS=$ac_libplot_ldflags
if [ test "x$no_x" != "xyes" ]; then
dnl Athena:
if [ test $ac_can_link_libplot != yes ]; then
LIBPLOT_LIBS="-lplot $X_LIBS -lXaw -lXmu -lXt $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS -lm"
ac_libplot_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS $LIBPLOT_LIBS"
AC_MSG_CHECKING(whether libplot links against Athena)
AC_TRY_LINK([
#include <stdio.h>
#include <plot.h>
],[
plPlotter* plotter;
plPlotterParams* params;
params = pl_newplparams ();
plotter = pl_newpl_r ("X",stdin,stdout,stderr,params);
pl_deletepl_r (plotter);
pl_deleteplparams (params);
],[ ac_can_link_libplot=yes
AC_MSG_RESULT(yes)
],[ AC_MSG_RESULT(no)
])
LDFLAGS=$ac_libplot_ldflags
fi
dnl Motif:
if [ test $ac_can_link_libplot != yes ]; then
ac_libplot_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS $X_LIBS"
AC_CHECK_LIB(Xp,main,[libXp="-lXp"],[libXp=""],-lXext -lX11)
LIBPLOT_LIBS="-lplot $X_LIBS -lXm $libXp -lXt $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS -lm"
AC_CHECK_LIB(gen,main,[LIBPLOT_LIBS="$LIBPLOT_LIBS -lgen"])
AC_CHECK_LIB(PW,main,[LIBPLOT_LIBS="$LIBPLOT_LIBS -lPW"])
LDFLAGS=$ac_libplot_ldflags
LDFLAGS="$LDFLAGS $LIBPLOT_LIBS"
AC_MSG_CHECKING(whether libplot links against Motif)
AC_TRY_LINK([
#include <stdio.h>
#include <plot.h>
],[
plPlotter* plotter;
plPlotterParams* params;
params = pl_newplparams ();
plotter = pl_newpl_r ("X",stdin,stdout,stderr,params);
pl_deletepl_r (plotter);
pl_deleteplparams (params);
],[ ac_can_link_libplot=yes
AC_MSG_RESULT(yes)
],[ AC_MSG_RESULT(no)
])
LDFLAGS=$ac_libplot_ldflags
fi
fi
])