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
  
AC_INIT(image_xface.c) 
AC_CONFIG_HEADER(config.h) 
AC_ARG_WITH(gmp,     [  --with(out)-gmp        Support bignums],[],[with_gmp=yes]) 
 
AC_MODULE_INIT() 
 
############################################################################# 
# Copied from ../../configure.in 
 
AC_MSG_CHECKING(how to concatenate two symbols) 
AC_CACHE_VAL(pike_cv_cpp_symbol_concat, [ 
  AC_TRY_COMPILE([ 
int AABB=0; 
#define CONCAT(X,Y)     X##Y 
  ], [ 
    return CONCAT(AA,BB); 
  ], pike_cv_cpp_symbol_concat=ANSI, [ 
    AC_TRY_COMPILE([ 
int AABB=0; 
#define CONCAT(X,Y)     X/**/Y 
    ], [ 
      return CONCAT(AA,BB); 
    ], pike_cv_cpp_symbol_concat=KR, [ 
      pike_cv_cpp_symbol_concat=Unknown 
    ]) 
  ]) 
]) 
AC_MSG_RESULT($pike_cv_cpp_symbol_concat) 
case "$pike_cv_cpp_symbol_concat" in 
  "ANSI") 
    AC_DEFINE(HAVE_ANSI_CONCAT) 
  ;; 
  "KR") 
    AC_DEFINE(HAVE_KR_CONCAT) 
  ;; 
esac 
 
############################################################################# 
 
define([AC_CHECK_GMP], 
[ 
  done=no 
  ORIG_CHECK_HEADERS($2,[ 
 
    # This test is needed since the __MPN macro 
    # is broken on many versions of gmp, since 
    # many ANSI compilers only define __STDC__ 
    # in strict ansi mode. Some of the affected 
    # compilers also don't allow redefining 
    # __STDC__. 
    AC_MSG_CHECKING(prefix for __MPN in $2) 
    define(PIKE_PREFIX_NAME,[pike_cv_$1___MPN_prefix]) 
    AC_CACHE_VAL(PIKE_PREFIX_NAME, [ 
      AC_EGREP_CPP([__gmpn_.*PiKe], [ 
#include <$2> 
__MPN(PiKe) 
      ], [ 
        PIKE_PREFIX_NAME="__gmpn_" 
      ], [ 
        AC_EGREP_CPP([__mpn_.*PiKe], [ 
#include <$2> 
__MPN(PiKe) 
        ], [ 
          PIKE_PREFIX_NAME="__mpn_" 
        ], [ 
          PIKE_PREFIX_NAME="no" 
        ]) 
      ]) 
    ]) 
    if test "x$PIKE_PREFIX_NAME" = "xno"; then 
      AC_MSG_RESULT(warning -- prefix not found) 
    else 
      AC_MSG_RESULT($PIKE_PREFIX_NAME) 
      AC_DEFINE_UNQUOTED(PIKE_MPN_PREFIX, $PIKE_PREFIX_NAME) 
    fi 
 
dnl  
dnl  Autoconf 2.52 seems to barf on this undefine for 
dnl  some unknown reason. This file should work just 
dnl  as well without it. 
dnl 
dnl    undefine(PIKE_PREFIX_NAME) 
 
    AC_MSG_CHECKING(working <$2>) 
    AC_CACHE_VAL(pike_cv_working_$1,[ 
      OLDLIBS="${LIBS-}" 
      LIBS="${LIBS-} -l$1" 
      AC_TRY_RUN([ 
#include <stdio.h> 
 
/* Kludge for some compilers only defining __STDC__ in strict mode. */ 
#if !defined(__STDC__) && defined(HAVE_ANSI_CONCAT) && defined(PIKE_MPN_PREFIX) 
#define PIKE_LOW_MPN_CONCAT(x,y)        x##y 
#define PIKE_MPN_CONCAT(x,y)    PIKE_LOW_MPN_CONCAT(x,y) 
#define __MPN(x)        PIKE_MPN_CONCAT(PIKE_MPN_PREFIX,x) 
#endif /* !__STDC__ && HAVE_ANSI_CONCAT && PIKE_MPN_PREFIX */ 
 
#include <$2> 
int main(int argc, char **argv) 
{ 
 mpz_t tmp,tmp2; 
 char buffer[1000]; 
 mpz_init(tmp); 
 mpz_init(tmp2); 
 mpz_set_ui(tmp ,1000000000); 
 mpz_set_ui(tmp2,1000000000); 
 mpz_mul(tmp,tmp,tmp2); 
 mpz_mul(tmp,tmp,tmp2); 
 mpz_mul(tmp,tmp,tmp2); 
 fprintf(stderr,"FNORD: %d\n",mpz_sizeinbase(tmp,10)); 
  exit( mpz_sizeinbase(tmp,10) !=  9*4+1 ); 
} 
 
      ],pike_cv_working_$1=yes,pike_cv_working_$1=no, 
        AC_TRY_LINK([ 
#include <stdio.h> 
 
/* Kludge for some compilers only defining __STDC__ in strict mode. */ 
#if !defined(__STDC__) && defined(HAVE_ANSI_CONCAT) && defined(PIKE_MPN_PREFIX) 
#define PIKE_LOW_MPN_CONCAT(x,y)        x##y 
#define PIKE_MPN_CONCAT(x,y)    PIKE_LOW_MPN_CONCAT(x,y) 
#define __MPN(x)        PIKE_MPN_CONCAT(PIKE_MPN_PREFIX,x) 
#endif /* !__STDC__ && HAVE_ANSI_CONCAT && PIKE_MPN_PREFIX */ 
 
#include <$2> 
 
        ],[ 
          mpz_t tmp,tmp2; 
          char buffer[1000]; 
          mpz_init(tmp); 
          mpz_init(tmp2); 
          mpz_set_ui(tmp ,1000000000); 
          mpz_set_ui(tmp2,1000000000); 
          mpz_mul(tmp,tmp,tmp2); 
          mpz_mul(tmp,tmp,tmp2); 
          mpz_mul(tmp,tmp,tmp2); 
          fprintf(stderr,"FNORD: %d\n",mpz_sizeinbase(tmp,10)); 
          exit( mpz_sizeinbase(tmp,10) !=  9*4+1 ); 
        ],pike_cv_working_$1=yes,pike_cv_working_$1=no) 
      ) 
    ]) 
    LIBS="$OLDLIBS" 
    if test "x$pike_cv_working_$1" = xyes; then 
      AC_MSG_RESULT(yes) 
      AC_DEFINE(translit(HAVE_LIB$1,[a-z],[A-Z])) 
      LIBS="${LIBS-} -l$1" 
      done=yes 
      PIKE_FEATURE_OK(Image.XFace) 
    else 
      AC_MSG_RESULT(no) 
    fi 
  ]) 
 
  if test "x$done" = "xno"; then 
    $3 
    : 
  fi 
]) 
 
PIKE_FEATURE_WITHOUT(Image.XFace) 
 
if test x$with_gmp = xyes ; then 
  PIKE_FEATURE_NODEP(Image.XFace) 
  AC_CHECK_GMP(gmp2,gmp2/gmp.h,[AC_CHECK_GMP(gmp,gmp.h,[])]) 
fi 
 
AC_OUTPUT(Makefile,echo FOO >stamp-h )