File: aclocal.m4

package info (click to toggle)
libflorist 2017-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 2,212 kB
  • sloc: ada: 11,902; ansic: 7,195; makefile: 137; sh: 18
file content (274 lines) | stat: -rw-r--r-- 7,520 bytes parent folder | download | duplicates (3)
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
dnl auto-configuration macros for Florist
dnl This version requires autoconf-2.10.

dnl AC_POSIX_HEADER(HEADER-FILE,
dnl   [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl side-effect: extend file "pconfig.h",
dnl with includes for this header, if present.
AC_DEFUN(AC_POSIX_HEADER,
[dnl Do the transliteration at runtime so arg 1 can be a shell variable.
ac_old_cflags=$CFLAGS
# CFLAGS="$CFLAGS -Werror"
ac_safe=`echo "$1" | tr './\055' '___'`
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(ac_cv_header_$ac_safe,
[AC_TRY_CPP([#include <$1>], 
AC_TRY_COMPILE([#include "confsrc/pconfig.h"
#include <$1>],,
eval "ac_cv_header_$ac_safe=yes",
eval "ac_cv_header_$ac_safe=no"),
eval "ac_cv_header_$ac_safe=no")])dnl
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  AC_MSG_RESULT(yes)
  echo "#include <$1>" >> confsrc/pconfig.h
  ifelse([$2], , :, [$2])
else
  AC_MSG_RESULT(no)
ifelse([$3], , , [$3
])dnl
fi
CFLAGS=$ac_old_cflags
])dnl

dnl AC_POSIX_HEADERS(NAMES...)
dnl side-effect: create file "pconfig.h" containing includes
dnl for all the headers that are present.
AC_DEFUN(AC_POSIX_HEADERS,
[rm -f confsrc/pconfig.h
cp pconfig.h.in confsrc/pconfig.h
chmod 644 confsrc/pconfig.h
if ( test ! -f confsrc/pconfig.h ) then
   AC_MSG_ERROR(missing confsrc/pconfig.h);
fi
for ac_hdr in $1
do
  AC_POSIX_HEADER($ac_hdr,
    [ac_tr_hdr=HAVE_$(echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___')
     AC_DEFINE_UNQUOTED($ac_tr_hdr)])dnl
done
])dnl

dnl AC_POSIX5C_HEADERS(NAMES...)
dnl side-effect: create file "pconfig.h" containing includes
dnl for all the headers that are present.
AC_DEFUN(AC_POSIX5C_HEADERS,
[for ac_hdr in $1
do
  AC_POSIX_HEADER($ac_hdr,
    [ac_tr_hdr=HAVE_$(echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___')
     AC_DEFINE_UNQUOTED($ac_tr_hdr)])dnl
done
AC_POSIX_HEADER(xti.h, AC_DEFINE_UNQUOTED(HAVE_XTI_H)
[    echo "--  don't want TLI because we have xti.h
TLI := False" >> gnatprep.config;],
AC_POSIX_HEADER(tli.h, AC_DEFINE_UNQUOTED(HAVE_TLI_H)
[    echo "--  using TLI because could not find xti.h
TLI := True" >> gnatprep.config;],
[    echo "--  could not find tli.h
TLI := False" >> gnatprep.config;],
))

AC_TRY_COMPILE([#include "confsrc/pconfig.h"],
[  struct msghdr hdr;
   hdr.msg_controllen = 0;],
[echo "Socket interface looks like BSD 4.4";

 # Put BSD flag in gnatprep.config
 if (grep BSD4_3 gnatprep.config >/dev/null 2>&1); then true;
 else
    (echo "--  set BSD4_3 to False if using 4.4 style socket msghdr";
     echo "BSD4_3 := False") >> gnatprep.config;
 fi;
 if (grep _BSD4_4_ confsrc/pconfig.h >/dev/null 2>&1); then true;
 else
   echo "#define _BSD4_4_" >> confsrc/pconfig.h;
 fi;],
[echo "Socket interface Looks like BSD 4.3";
 if (grep BSD4_3 gnatprep.config >/dev/null 2>&1); then true;
 else
    (echo "--  set BSD4_3 to False if using 4.4 style socket msghdr";
     echo "BSD4_3 := True") >> gnatprep.config;
 fi;
 if (grep _BSD4_3_ confsrc/pconfig.h >/dev/null 2>&1); then true;
 else
   echo "#define _BSD4_3_" >> confsrc/pconfig.h;
 fi;])

[if (grep xti.h confsrc/pconfig.h >/dev/null 2>&1); then
 if (grep _XTI_ confsrc/pconfig.h >/dev/null 2>&1); then true;
 else
   echo "#define _XTI_" >> confsrc/pconfig.h;
 fi ;
else
 if [ -f /usr/include/sys/tiuser.h ]; then
   echo "Have only TLI, will use that in place of XTI";
   if (grep _TLI_ confsrc/pconfig.h >/dev/null 2>&1); then true; 
   else
     echo "#define _TLI_" >> confsrc/pconfig.h;
     echo "#include <sys/tiuser.h>" >> confsrc/pconfig.h;
   fi;
 fi;
fi]

dnl For some reason the line below cannot be removed???
dnl AC_CHECK_FUNC(getaddrinfo, [], [])

])dnl

dnl AC_POSIX_LIBS(LIBRARY..., FUNCTION
dnl    [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
AC_DEFUN(AC_POSIX_LIBS,
[for ac_lib in $1
do
   AC_POSIX_LIB($ac_lib,$2,ac_lib_success="yes",ac_lib_success="no")
   if [[ "$ac_lib_success" = "yes" ]]
   then break;
   fi
done])

dnl AC_POSIX_TYPE(TYPE-NAME)
AC_DEFUN(AC_POSIX_TYPE,
[AC_REQUIRE([AC_POSIX_HEADERS])dnl
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL(ac_cv_type_$1,
AC_EGREP_CPP($1[[[^0-9A-Za-z_]]],[#include "confsrc/pconfig.h"],
eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no"))
if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then
  AC_DEFINE_UNQUOTED(HAVE_$1)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi
])

dnl AC_POSIX_TYPES(TYPE-NAME...)
AC_DEFUN(AC_POSIX_TYPES,
[for ac_typ in $1
do
  AC_POSIX_TYPE($ac_typ)
done
])

dnl AC_POSIX_CONST(CONST)
AC_DEFUN(AC_POSIX_CONST,
[AC_REQUIRE([AC_POSIX_HEADERS])dnl
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL(ac_cv_const_$1,
[AC_EGREP_CPP($1, [#include "confsrc/pconfig.h"], eval "ac_cv_const_$1=yes",
AC_EGREP_CPP(yes, [#include "confsrc/pconfig.h"
#ifdef $1
  yes
#endif], eval "ac_cv_const_$1=yes",
eval "ac_cv_const_$1=no"))])dnl
if eval "test \"`echo '$ac_cv_const_'$1`\" = yes"; then
  AC_DEFINE_UNQUOTED(HAVE_$1)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi
])

dnl AC_POSIX_CONSTS(CONST-NAME...)
AC_DEFUN(AC_POSIX_CONSTS,
[for ac_const in $1
do
  AC_POSIX_CONST($ac_const)
done
])

dnl AC_POSIX_STRUCT(NAME,
dnl   [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
AC_DEFUN(AC_POSIX_STRUCT,
[AC_REQUIRE([AC_POSIX_HEADERS])dnl
AC_MSG_CHECKING(for struct $1)
AC_CACHE_VAL(ac_cv_struct_$1,
[AC_TRY_COMPILE([#include "confsrc/pconfig.h"
struct $1 x;],,eval "ac_cv_struct_$1=yes",
 eval "ac_cv_struct_$1=no")])dnl
if eval "test \"`echo '$ac_cv_struct_'$1`\" = yes"; then
  AC_DEFINE_UNQUOTED(HAVE_struct_$1)
  AC_MSG_RESULT(yes)
  ifelse([$2], , :, [$2])
else
  AC_MSG_RESULT(no)
  ifelse([$3], , , [$3])dnl
fi
])

dnl AC_POSIX_STRUCTS(NAME...)
AC_DEFUN(AC_POSIX_STRUCTS,
[for ac_struct in $1
do
  AC_POSIX_STRUCT($ac_struct)
done
])

dnl AC_POSIX_FUNCS(FUNCTION... )
AC_DEFUN(AC_POSIX_FUNCS,
[for ac_func in $1
do
AC_CHECK_FUNC($ac_func,
[AC_DEFINE_UNQUOTED(HAVE_$ac_func,1)],
[AC_DEFINE_UNQUOTED(HAVE_$ac_func,0)])dnl
done
])

dnl AC_POSIX_VAR(NAME)
AC_DEFUN(AC_POSIX_VAR,
[AC_REQUIRE([AC_POSIX_HEADERS])dnl
AC_MSG_CHECKING(for global variable or macro $1)
AC_CACHE_VAL(ac_cv_comp_$1,
[AC_EGREP_CPP($1, [#include "confsrc/pconfig.h"], eval "ac_cv_comp_$1=yes",
eval "ac_cv_comp_$1=no")])dnl
if eval "test \"`echo '$ac_cv_comp_'$1`\" = yes"; then
  AC_DEFINE_UNQUOTED(HAVE_$1)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi
])

dnl AC_POSIX_COMP(STRUCTNAME, COMPNAME)
AC_DEFUN(AC_POSIX_COMP,
[AC_REQUIRE([AC_POSIX_HEADERS])dnl
AC_MSG_CHECKING(for struct $1 component $2)
AC_CACHE_VAL(ac_cv_comp_$2,
[AC_TRY_COMPILE([#include "confsrc/pconfig.h"
struct $1 x;],
[x.$2 = x.$2;], eval "ac_cv_comp_$2=yes",
eval "ac_cv_comp_$2=no")])dnl
if eval "test \"`echo '$ac_cv_comp_'$2`\" = yes"; then
  AC_DEFINE_UNQUOTED(HAVE_component_$2)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi
])

dnl AC_POSIX_COMP_OVERLAY(STRUCTNAME, COMPNAME1, COMPNAME2)
dnl check for COMPNAME1 but only if it does not overlay in memory
dnl layout with COMPNAME2; e.g. see overlaying of sigaction components
dnl sa_handler and sa_sigaction
AC_DEFUN(AC_POSIX_COMP_OVERLAY,
[AC_REQUIRE([AC_POSIX_HEADERS])dnl
AC_MSG_CHECKING(for struct $1 component $2 overlaying $3)
AC_CACHE_VAL(ac_cv_comp_$2,
AC_TRY_RUN([#include "confsrc/pconfig.h"
main()
{
  struct $1 x;
  if (&x.$2 == &x.$3) {
    fprintf(stderr,"$2 overlays $3...");
    exit (1);
  } else {
    exit (0);
  }
}], eval "ac_cv_comp_$2=yes",
eval "ac_cv_comp_$2=no", eval "ac_cv_comp_$2=nu"))dnl
if eval "test \"`echo '$ac_cv_comp_'$2`\" = yes"; then
  AC_DEFINE_UNQUOTED(HAVE_component_$2)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi
])