1
dnl ACX_SAVE_STATE/ACX_RESTORE_STATE
5
AC_DEFUN(ACX_SAVE_STATE,
8
save_CPPFLAGS=$CPPFLAGS
13
AC_DEFUN(ACX_RESTORE_STATE,
16
CPPFLAGS=$save_CPPFLAGS
22
AC_DEFUN(ACX_CHECK_CC_FLAGS,
24
AC_REQUIRE([AC_PROG_CC])
25
AC_CACHE_CHECK(whether ${CC-cc} accepts $1, ac_$2,
26
[echo 'void f(){}' > conftest.c
27
if test -z "`${CC-cc} $1 -c conftest.c 2>&1`"; then
34
if test "$ac_$2" = yes; then
43
dnl **** Check for gcc strength-reduce bug ****
44
AC_DEFUN(ACX_GCC_STRENGTH_REDUCE,
46
AC_REQUIRE([AC_PROG_CC])
47
AC_CACHE_CHECK([for gcc strength-reduce bug], ac_cv_c_gcc_strength_bug,
50
static int Array[[3]];
53
for(i=0; i<B; i++) Array[[i]] = i - 3;
54
exit( Array[[1]] != -2 );
58
ac_cv_c_gcc_strength_bug="no",
59
ac_cv_c_gcc_strength_bug="yes",
60
ac_cv_c_gcc_strength_bug="yes")
63
if test "$ac_cv_c_gcc_strength_bug" = "yes"
73
dnl **** Checks for FPU arithmetics
74
AC_DEFUN(ACX_CHECK_FPU,
76
AC_CACHE_CHECK([for FPU arithmetics type], ac_cv_c_fpu_arithmetics_type,
81
#define LOG2EA 0.44269504088896340735992
82
#define ACCURACY "%1.4f"
84
typedef union {unsigned short s[[4]]; double d;} XTYPE;
87
{{0,0,0,0}}, /* Unknown */
88
{{0x3fdc,0x551d,0x94ae,0x0bf8}}, /* Big endian IEEE */
89
{{0x0bf8,0x94ae,0x551d,0x3fdc}}, /* Littile endian IEEE */
90
{{0037742,0124354,0122560,0057703}} /* DEC */
95
int i; char TMPSTR[[1024]]; char LOG2EA_STR[[80]];
98
sprintf(LOG2EA_STR, ACCURACY, LOG2EA);
100
for (i=3; i >= 0; i--)
102
sprintf(TMPSTR, ACCURACY, X[[i]].d);
103
if (strcmp(TMPSTR, LOG2EA_STR) == 0) {
110
ac_cv_c_fpu_arithmetics_type="Unknown",
112
"1"[)] ac_cv_c_fpu_arithmetics_type="Big endian IEEE" ;;
113
"2"[)] ac_cv_c_fpu_arithmetics_type="Little endian IEEE" ;;
114
"3"[)] ac_cv_c_fpu_arithmetics_type="DEC" ;;
116
ac_cv_c_fpu_arithmetics_type="Unknown") )
118
case "$ac_cv_c_fpu_arithmetics_type" in
119
"DEC") AC_DEFINE(HAVE_DEC_FPU) ;;
120
"Little endian IEEE") AC_DEFINE(HAVE_LIEEE_FPU) ;;
121
"Big endian IEEE") AC_DEFINE(HAVE_BIEEE_FPU) ;;
127
AC_DEFUN(ACX_ANSI_TYPES,
129
dnl **** Check which ANSI integer type is 16 bit
130
AC_CACHE_CHECK( "which ANSI integer type is 16 bit", ac_16bit_type,
133
if (sizeof(short)==2)
135
else if (sizeof(int)==2)
139
}], ac_16bit_type="short", ac_16bit_type="int", ac_16bit_type=))
140
if test "$ac_16bit_type" = "short"
147
dnl **** Check which ANSI integer type is 32 bit
148
AC_CACHE_CHECK( "which ANSI integer type is 32 bit", ac_32bit_type,
153
else if (sizeof(long)==4)
157
}], ac_32bit_type="int", ac_32bit_type="long", ac_32bit_type=))
158
if test "$ac_32bit_type" = "int"
165
dnl **** Check which ANSI integer type is 64 bit
166
AC_CACHE_CHECK( "which ANSI integer type is 64 bit", ac_64bit_type,
173
}], ac_64bit_type="long", ac_64bit_type="<none>", ac_64bit_type=))
174
if test "$ac_64bit_type" = "long"
182
dnl **** Check for buggy realloc()
183
AC_DEFUN(ACX_CHECK_REALLOC,
185
AC_CACHE_CHECK([whether realloc is buggy], ac_cv_c_realloc_bug,
192
ptr = realloc(ptr, 1);
195
ac_cv_c_realloc_bug="no",
196
ac_cv_c_realloc_bug="yes",
197
ac_cv_c_realloc_bug="yes") )
198
if test "$ac_cv_c_realloc_bug" = "yes"
209
dnl ICE_CHECK_DECL (FUNCTION, HEADER-FILE...)
210
dnl -----------------------------------------
212
dnl If FUNCTION is available, define `HAVE_FUNCTION'. If it is declared
213
dnl in one of the headers named in the whitespace-separated list
214
dnl HEADER_FILE, define `HAVE_FUNCTION_DECL` (in all capitals).
216
AC_DEFUN(ICE_CHECK_DECL,
219
ice_tr=`echo $1 | tr '[a-z]' '[A-Z]'`
221
ice_have_tr=HAVE_$ice_tr
222
ice_have_decl_tr=${ice_have_tr}_DECL
224
AC_CHECK_FUNCS($1, ice_have_$1=yes)
225
if test "${ice_have_$1}" = yes; then
226
AC_MSG_CHECKING(for $1 declaration in $2)
227
AC_CACHE_VAL(ice_cv_have_$1_decl,
229
ice_cv_have_$1_decl=no
231
ice_re_params='[a-zA-Z_][a-zA-Z0-9_]*'
232
ice_re_word='(^|[^a-zA-Z_0-9_])'
235
# Check for ordinary declaration
236
AC_EGREP_HEADER([${ice_re_word}$1 *\(], $header,
237
ice_cv_have_$1_decl=yes)
238
if test "$ice_cv_have_$1_decl" = yes; then
241
# Check for "fixed" declaration like "getpid _PARAMS((int))"
242
AC_EGREP_HEADER([${ice_re_word}$1 *$ice_re_params\(\(], $header,
243
ice_cv_have_$1_decl=yes)
244
if test "$ice_cv_have_$1_decl" = yes; then
249
AC_MSG_RESULT($ice_cv_have_$1_decl)
250
if test "$ice_cv_have_$1_decl" = yes; then
251
AC_DEFINE_UNQUOTED(${ice_have_decl_tr})
256
dnl --- *@-mdw_CHECK_MANYLIBS-@* ---
258
dnl Author: Mark Wooding
260
dnl Synopsis: mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND])
262
dnl Arguments: FUNC = a function to try to find
263
dnl LIBS = a whitespace-separated list of libraries to search
264
dnl IF-FOUND = what to do when the function is found
265
dnl IF-NOT-FOUND = what to do when the function isn't found
267
dnl Use: Searches for a library which defines FUNC. It first tries
268
dnl without any libraries; then it tries each library specified
269
dnl in LIBS in turn. If it finds a match, it adds the
270
dnl appropriate library to `LIBS'.
272
dnl This is particularly handy under DIREIX: if you link with
273
dnl `-lnsl' then you get non-NIS-aware versions of getpwnam and
274
dnl so on, which is clearly a Bad Thing.
276
dnl Modified: by Evgeny Stambulchik to add (found) libraries to `LIBS'
277
dnl *only* if `IF-FOUND' is absent. As well, if no additional
278
dnl library is needed for `FUNC', `mdw_cv_lib_$1' sets to "".
280
AC_DEFUN(mdw_CHECK_MANYLIBS,
281
[AC_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1],
282
[mdw_save_LIBS="$LIBS"
284
AC_TRY_LINK(,[$1()], [mdw_cv_lib_$1="none required"])
285
test "$mdw_cv_lib_$1" = "no" && for i in $2; do
286
LIBS="-l$i $mdw_save_LIBS"
288
[mdw_cv_lib_$1="-l$i"
291
LIBS="$mdw_save_LIBS"])
292
if test "$mdw_cv_lib_$1" != "no"; then
293
if test "x$3" != "x"; then
294
test "$mdw_cv_lib_$1" = "none required" && mdw_cv_lib_$1=""
297
test "$mdw_cv_lib_$1" = "none required" || LIBS="$mdw_cv_lib_$1 $LIBS"
306
AC_DEFUN(ACX_CHECK_MOTIF,
308
AC_REQUIRE([AC_PATH_XTRA])
309
AC_ARG_WITH(motif_library,
310
[ --with-motif-library=OBJ use OBJ as Motif library [[-lXm]]],
311
motif_library="$withval")
312
if test "x$motif_library" = "x"
319
AC_CACHE_CHECK([for a Motif >= $1 compatible API], acx_cv_motif,
320
AC_CACHE_VAL(acx_cv_motif_library, acx_cv_motif_library=$motif_library)
321
LIBS="$acx_cv_motif_library $GUI_LIBS"
322
CFLAGS="$X_CFLAGS $CFLAGS"
323
CPPFLAGS="$X_CFLAGS $CPPFLAGS"
324
LDFLAGS="$X_LIBS $LDFLAGS"
326
#include <Xm/XmAll.h>
330
XmRegisterConverters();
331
vlibn = xmUseVersion;
335
if (vincn != vlibn) {
347
if test "$acx_cv_motif" = "yes"
349
AC_DEFINE(HAVE_MOTIF)
350
MOTIF_LIB="$acx_cv_motif_library"
352
dnl **** Check whether Motif is actually Lesstif
354
dnl **** Check whether _XmVersionString[] can be referred to
355
ACX_CHECK_XMVERSIONSTRING
365
dnl ICE_CHECK_LESSTIF
366
dnl -----------------
368
dnl Define `HAVE_LESSTIF' if the Motif library is actually a LessTif library
370
AC_DEFUN(ICE_CHECK_LESSTIF,
372
AC_MSG_CHECKING(whether the Motif library is actually a LessTif library)
373
AC_CACHE_VAL(ice_cv_have_lesstif,
376
#ifdef LesstifVersion
379
], ice_cv_have_lesstif=yes, ice_cv_have_lesstif=no))
380
AC_MSG_RESULT($ice_cv_have_lesstif)
381
if test "$ice_cv_have_lesstif" = yes; then
382
AC_DEFINE(HAVE_LESSTIF)
387
dnl ACX_CHECK_XMVERSIONSTRING
389
AC_DEFUN(ACX_CHECK_XMVERSIONSTRING,
391
AC_CACHE_CHECK([whether _XmVersionString[] can be referred to],
392
acx_cv__xmversionstring,
393
AC_TRY_LINK([#include <stdio.h>],
394
[extern char _XmVersionString[[]]; printf("%s\n", _XmVersionString);],
395
[acx_cv__xmversionstring="yes"],
396
[acx_cv__xmversionstring="no"]
399
if test "$acx_cv__xmversionstring" = "yes"
401
AC_DEFINE(HAVE__XMVERSIONSTRING)
412
AC_DEFUN(ACX_CHECK_T1LIB,
414
AC_CACHE_CHECK([for T1lib >= $1], acx_cv_t1lib,
416
LIBS="-lt1 -lm $LIBS"
422
vlib = T1_GetLibIdent();
423
if (strcmp(vlib, "[$1]") < 0) {
436
if test "$acx_cv_t1lib" = "yes"
448
AC_DEFUN(ACX_CHECK_ZLIB,
450
AC_ARG_WITH(zlib_library,
451
[ --with-zlib-library=OBJ use OBJ as ZLIB library [[-lz]]],
452
zlib_library="$withval")
453
if test "x$zlib_library" = "x"
458
AC_CACHE_CHECK([for zlib >= $1], acx_cv_zlib,
459
AC_CACHE_VAL(acx_cv_zlib_library, acx_cv_zlib_library=$zlib_library)
461
LIBS="$acx_cv_zlib_library $LIBS"
467
vlib = zlibVersion();
469
if (strcmp(vinc, "[$1]") < 0) {
472
if (strcmp(vinc, vlib) != 0) {
485
if test "$acx_cv_zlib" = "yes"
487
Z_LIB="$acx_cv_zlib_library"
497
AC_DEFUN(ACX_CHECK_JPEG,
499
AC_ARG_WITH(jpeg_library,
500
[ --with-jpeg-library=OBJ use OBJ as JPEG library [[-ljpeg]]],
501
jpeg_library="$withval")
502
if test "x$jpeg_library" = "x"
507
AC_CACHE_CHECK([for IJG JPEG software >= $1], acx_cv_jpeg,
508
AC_CACHE_VAL(acx_cv_jpeg_library, acx_cv_jpeg_library=$jpeg_library)
510
LIBS="$acx_cv_jpeg_library $LIBS"
516
struct jpeg_compress_struct cinfo;
517
jpeg_create_compress(&cinfo);
518
vinc = JPEG_LIB_VERSION;
532
if test "$acx_cv_jpeg" = "yes"
534
JPEG_LIB=$acx_cv_jpeg_library
544
AC_DEFUN(ACX_CHECK_PNG,
546
AC_ARG_WITH(png_library,
547
[ --with-png-library=OBJ use OBJ as PNG library [[-lpng]]],
548
png_library="$withval")
549
if test "x$png_library" = "x"
554
AC_CACHE_CHECK([for libpng >= $1], acx_cv_png,
555
AC_CACHE_VAL(acx_cv_png_library, acx_cv_png_library=$png_library)
557
LIBS="$acx_cv_png_library $Z_LIB $LIBS"
563
vlib = png_libpng_ver;
564
vinc = PNG_LIBPNG_VER_STRING;
565
if (strcmp(vinc, "[$1]") < 0) {
568
if (strcmp(vinc, vlib) != 0) {
581
if test "$acx_cv_png" = "yes"
583
PNG_LIB="$acx_cv_png_library"
593
AC_DEFUN(ACX_CHECK_PDFLIB,
595
AC_ARG_WITH(pdf_library,
596
[ --with-pdf-library=OBJ use OBJ as PDFlib library [[-lpdf]]],
597
pdf_library="$withval")
598
if test "x$pdf_library" = "x"
603
AC_CACHE_CHECK([for PDFlib >= $1], acx_cv_pdflib,
604
AC_CACHE_VAL(acx_cv_pdf_library, acx_cv_pdf_library=$pdf_library)
606
LIBS="$acx_cv_pdf_library $JPEG_LIB $PNG_LIB $Z_LIB $LIBS"
612
vlibn = 100*PDF_get_majorversion() + PDF_get_minorversion();
613
vincn = 100*PDFLIB_MAJORVERSION + PDFLIB_MINORVERSION;
614
vinc = PDFLIB_VERSIONSTRING;
615
if (strcmp(vinc, "[$1]") < 0) {
618
if (vincn != vlibn) {
631
if test "$acx_cv_pdflib" = "yes"
633
PDF_LIB="$acx_cv_pdf_library"
643
AC_DEFUN(ACX_CHECK_NETCDF,
645
AC_ARG_WITH(netcdf_libraries,
646
[ --with-netcdf-libraries=OBJ use OBJ as netCDF libraries [[-lnetcdf]]],
647
netcdf_libraries="$withval")
648
if test "x$netcdf_libraries" = "x"
650
netcdf_libraries=-lnetcdf
653
AC_CACHE_CHECK([for netCDF API version >= $1], acx_cv_netcdf,
654
AC_CACHE_VAL(acx_cv_netcdf_libraries, acx_cv_netcdf_libraries=$netcdf_libraries)
656
LIBS="$acx_cv_netcdf_libraries $LIBS"
664
vlib = nc_inq_libvers();
665
if (strcmp(vlib, "[$1]") < 0) {
678
if test "$acx_cv_netcdf" = "yes"
680
NETCDF_LIBS="$acx_cv_netcdf_libraries"
690
AC_DEFUN(ACX_CHECK_FFTW,
692
AC_ARG_WITH(fftw_library,
693
[ --with-fftw-library=OBJ use OBJ as FFTW library [[-lfftw]]],
694
fftw_library="$withval")
695
if test "x$fftw_library" = "x"
700
AC_CACHE_CHECK([for FFTW library >= $1], acx_cv_fftw,
701
AC_CACHE_VAL(acx_cv_fftw_library, acx_cv_fftw_library=$fftw_library)
703
LIBS="$acx_cv_fftw_library $LIBS"
708
char *vlib = (char *) fftw_version;
709
if (strcmp(vlib, "[$1]") < 0) {
723
if test "$acx_cv_fftw" = "yes"
725
FFTW_LIB="$acx_cv_fftw_library"
736
AC_DEFUN(ACX_CHECK_XMHTML,
738
AC_ARG_WITH(xmhtml_library,
739
[ --with-xmhtml-library=OBJ use OBJ as XmHTML library [[-lXmHTML]]],
740
xmhtml_library="$withval")
741
if test "x$xmhtml_library" = "x"
743
xmhtml_library=-lXmHTML
746
AC_CACHE_CHECK([for XmHTML widget >= $1], acx_cv_xmhtml,
747
AC_CACHE_VAL(acx_cv_xmhtml_library, acx_cv_xmhtml_library=$xmhtml_library)
749
LIBS="$acx_cv_xmhtml_library $JPEG_LIB $PNG_LIB $Z_LIB $LIBS"
751
#include <XmHTML/XmHTML.h>
754
vlib = XmHTMLGetVersion();
755
vinc = XmHTMLVersion;
772
if test "$acx_cv_xmhtml" = "yes"
774
XMHTML_LIB="$acx_cv_xmhtml_library"