binutils/oprofile: disable mips16 to fix build errors (#19522)
[openwrt.git] / package / libs / nettle / patches / 0003-Include-local-macros-in-nettle.m4-to-allow-regenerat.patch
1 From a6d49f192166d20755a6651d4612d3abcd780822 Mon Sep 17 00:00:00 2001
2 From: Nikos Mavrogiannopoulos <nmav@gnutls.org>
3 Date: Sun, 9 Mar 2014 11:58:05 +0100
4 Subject: [PATCH 3/5] Include local macros in nettle.m4 to allow regeneration.
5
6 ---
7  configure.ac |    1 +
8  nettle.m4    | 1209 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9  2 files changed, 1210 insertions(+)
10  create mode 100644 nettle.m4
11
12 diff --git a/configure.ac b/configure.ac
13 index 93eb09a..c24f954 100644
14 --- a/configure.ac
15 +++ b/configure.ac
16 @@ -7,6 +7,7 @@ AC_PREREQ(2.61)
17  AC_CONFIG_SRCDIR([arcfour.c])
18  # Needed to stop autoconf from looking for files in parent directories.
19  AC_CONFIG_AUX_DIR([.])
20 +AC_CONFIG_MACRO_DIR([.])
21  
22  AC_CONFIG_HEADER([config.h])
23  
24 diff --git a/nettle.m4 b/nettle.m4
25 new file mode 100644
26 index 0000000..98b399b
27 --- /dev/null
28 +++ b/nettle.m4
29 @@ -0,0 +1,1209 @@
30 +dnl Try to detect the type of the third arg to getsockname() et al
31 +AC_DEFUN([LSH_TYPE_SOCKLEN_T],
32 +[AH_TEMPLATE([socklen_t], [Length type used by getsockopt])
33 +AC_CACHE_CHECK([for socklen_t in sys/socket.h], ac_cv_type_socklen_t,
34 +[AC_EGREP_HEADER(socklen_t, sys/socket.h,
35 +  [ac_cv_type_socklen_t=yes], [ac_cv_type_socklen_t=no])])
36 +if test $ac_cv_type_socklen_t = no; then
37 +        AC_MSG_CHECKING(for AIX)
38 +        AC_EGREP_CPP(yes, [
39 +#ifdef _AIX
40 + yes
41 +#endif
42 +],[
43 +AC_MSG_RESULT(yes)
44 +AC_DEFINE(socklen_t, size_t)
45 +],[
46 +AC_MSG_RESULT(no)
47 +AC_DEFINE(socklen_t, int)
48 +])
49 +fi
50 +])
51 +
52 +dnl Choose cc flags for compiling position independent code
53 +dnl FIXME: Doesn't do the right thing when crosscompiling.
54 +AC_DEFUN([LSH_CCPIC],
55 +[AC_REQUIRE([AC_CANONICAL_HOST])dnl
56 +AC_MSG_CHECKING(CCPIC)
57 +AC_CACHE_VAL(lsh_cv_sys_ccpic,[
58 +  if test -z "$CCPIC" ; then
59 +    if test "$GCC" = yes ; then
60 +      case "$host_os" in
61 +       bsdi4.*)        CCPIC="-fPIC" ;;
62 +       bsdi*)          CCPIC="" ;;
63 +       darwin*)        CCPIC="-fPIC" ;;
64 +       # Could also use -fpic, depending on the number of symbol references
65 +       solaris*)       CCPIC="-fPIC" ;;
66 +       cygwin*)        CCPIC="" ;;
67 +       mingw32*)       CCPIC="" ;;
68 +       *)              CCPIC="-fpic" ;;
69 +      esac
70 +    else
71 +      case "$host_os" in
72 +       darwin*)        CCPIC="-fPIC" ;;
73 +        irix*)         CCPIC="-share" ;;
74 +       hpux*)          CCPIC="+z"; ;;
75 +       *freebsd*)      CCPIC="-fpic" ;;
76 +       sco*|sysv4.*)   CCPIC="-KPIC -dy -Bdynamic" ;;
77 +       solaris*)       CCPIC="-KPIC -Bdynamic" ;;
78 +       winnt*)         CCPIC="-shared" ;;
79 +       *)              CCPIC="" ;;
80 +      esac
81 +    fi
82 +  fi
83 +  OLD_CFLAGS="$CFLAGS"
84 +  CFLAGS="$CFLAGS $CCPIC"
85 +  AC_TRY_COMPILE([], [exit(0);],
86 +    lsh_cv_sys_ccpic="$CCPIC", lsh_cv_sys_ccpic='')
87 +  CFLAGS="$OLD_CFLAGS"
88 +])
89 +CCPIC="$lsh_cv_sys_ccpic"
90 +AC_MSG_RESULT($CCPIC)
91 +AC_SUBST([CCPIC])])
92 +
93 +dnl LSH_PATH_ADD(path-id, directory)
94 +AC_DEFUN([LSH_PATH_ADD],
95 +[AC_MSG_CHECKING($2)
96 +ac_exists=no
97 +if test -d "$2/." ; then
98 +  ac_real_dir=`cd $2 && pwd`
99 +  if test -n "$ac_real_dir" ; then
100 +    ac_exists=yes
101 +    for old in $1_REAL_DIRS ; do
102 +      ac_found=no
103 +      if test x$ac_real_dir = x$old ; then
104 +        ac_found=yes;
105 +       break;
106 +      fi
107 +    done
108 +    if test $ac_found = yes ; then
109 +      AC_MSG_RESULT(already added)
110 +    else
111 +      AC_MSG_RESULT(added)
112 +      # LDFLAGS="$LDFLAGS -L $2"
113 +      $1_REAL_DIRS="$ac_real_dir [$]$1_REAL_DIRS"
114 +      $1_DIRS="$2 [$]$1_DIRS"
115 +    fi
116 +  fi
117 +fi
118 +if test $ac_exists = no ; then
119 +  AC_MSG_RESULT(not found)
120 +fi
121 +])
122 +
123 +dnl LSH_RPATH_ADD(dir)
124 +AC_DEFUN([LSH_RPATH_ADD], [LSH_PATH_ADD(RPATH_CANDIDATE, $1)])
125 +
126 +dnl LSH_RPATH_INIT(candidates)
127 +AC_DEFUN([LSH_RPATH_INIT],
128 +[AC_REQUIRE([AC_CANONICAL_HOST])dnl
129 +AC_MSG_CHECKING([for -R flag])
130 +RPATHFLAG=''
131 +case "$host_os" in
132 +  osf1*)               RPATHFLAG="-rpath " ;;
133 +  irix6.*|irix5.*)     RPATHFLAG="-rpath " ;;
134 +  solaris*)
135 +    if test "$TCC" = "yes"; then
136 +      # tcc doesn't know about -R
137 +      RPATHFLAG="-Wl,-R,"
138 +    else
139 +      RPATHFLAG=-R
140 +    fi
141 +    ;;
142 +  linux*)              RPATHFLAG="-Wl,-rpath," ;;
143 +  *)                   RPATHFLAG="" ;;
144 +esac
145 +
146 +if test x$RPATHFLAG = x ; then
147 +  AC_MSG_RESULT(none)
148 +else
149 +  AC_MSG_RESULT([using $RPATHFLAG])
150 +fi
151 +
152 +RPATH_CANDIDATE_REAL_DIRS=''
153 +RPATH_CANDIDATE_DIRS=''
154 +
155 +AC_MSG_RESULT([Searching for libraries])
156 +
157 +for d in $1 ; do
158 +  LSH_RPATH_ADD($d)
159 +done
160 +])    
161 +
162 +dnl Try to execute a main program, and if it fails, try adding some
163 +dnl -R flag.
164 +dnl LSH_RPATH_FIX
165 +AC_DEFUN([LSH_RPATH_FIX],
166 +[if test $cross_compiling = no -a "x$RPATHFLAG" != x ; then
167 +  ac_success=no
168 +  AC_TRY_RUN([int main(int argc, char **argv) { return 0; }],
169 +    ac_success=yes, ac_success=no, :)
170 +  
171 +  if test $ac_success = no ; then
172 +    AC_MSG_CHECKING([Running simple test program failed. Trying -R flags])
173 +dnl echo RPATH_CANDIDATE_DIRS = $RPATH_CANDIDATE_DIRS
174 +    ac_remaining_dirs=''
175 +    ac_rpath_save_LDFLAGS="$LDFLAGS"
176 +    for d in $RPATH_CANDIDATE_DIRS ; do
177 +      if test $ac_success = yes ; then
178 +       ac_remaining_dirs="$ac_remaining_dirs $d"
179 +      else
180 +       LDFLAGS="$RPATHFLAG$d $LDFLAGS"
181 +dnl echo LDFLAGS = $LDFLAGS
182 +       AC_TRY_RUN([int main(int argc, char **argv) { return 0; }],
183 +         [ac_success=yes
184 +         ac_rpath_save_LDFLAGS="$LDFLAGS"
185 +         AC_MSG_RESULT([adding $RPATHFLAG$d])
186 +         ],
187 +         [ac_remaining_dirs="$ac_remaining_dirs $d"], :)
188 +       LDFLAGS="$ac_rpath_save_LDFLAGS"
189 +      fi
190 +    done
191 +    RPATH_CANDIDATE_DIRS=$ac_remaining_dirs
192 +  fi
193 +  if test $ac_success = no ; then
194 +    AC_MSG_RESULT(failed)
195 +  fi
196 +fi
197 +])
198 +
199 +dnl Like AC_CHECK_LIB, but uses $KRB_LIBS rather than $LIBS.
200 +dnl LSH_CHECK_KRB_LIB(LIBRARY, FUNCTION, [, ACTION-IF-FOUND [,
201 +dnl                  ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
202 +
203 +AC_DEFUN([LSH_CHECK_KRB_LIB],
204 +[AC_CHECK_LIB([$1], [$2],
205 +  ifelse([$3], ,
206 +      [[ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
207 +           -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
208 +        AC_DEFINE_UNQUOTED($ac_tr_lib)
209 +        KRB_LIBS="-l$1 $KRB_LIBS"
210 +      ]], [$3]),
211 +  ifelse([$4], , , [$4
212 +])dnl
213 +, [$5 $KRB_LIBS])
214 +])
215 +
216 +dnl LSH_LIB_ARGP(ACTION-IF-OK, ACTION-IF-BAD)
217 +AC_DEFUN([LSH_LIB_ARGP],
218 +[ ac_argp_save_LIBS="$LIBS"
219 +  ac_argp_save_LDFLAGS="$LDFLAGS"
220 +  ac_argp_ok=no
221 +  # First check if we can link with argp.
222 +  AC_SEARCH_LIBS(argp_parse, argp,
223 +  [ LSH_RPATH_FIX
224 +    AC_CACHE_CHECK([for working argp],
225 +      lsh_cv_lib_argp_works,
226 +      [ AC_TRY_RUN(
227 +[#include <argp.h>
228 +#include <stdlib.h>
229 +
230 +static const struct argp_option
231 +options[] =
232 +{
233 +  { NULL, 0, NULL, 0, NULL, 0 }
234 +};
235 +
236 +struct child_state
237 +{
238 +  int n;
239 +};
240 +
241 +static error_t
242 +child_parser(int key, char *arg, struct argp_state *state)
243 +{
244 +  struct child_state *input = (struct child_state *) state->input;
245 +  
246 +  switch(key)
247 +    {
248 +    default:
249 +      return ARGP_ERR_UNKNOWN;
250 +    case ARGP_KEY_END:
251 +      if (!input->n)
252 +       input->n = 1;
253 +      break;
254 +    }
255 +  return 0;
256 +}
257 +
258 +const struct argp child_argp =
259 +{
260 +  options,
261 +  child_parser,
262 +  NULL, NULL, NULL, NULL, NULL
263 +};
264 +
265 +struct main_state
266 +{
267 +  struct child_state child;
268 +  int m;
269 +};
270 +
271 +static error_t
272 +main_parser(int key, char *arg, struct argp_state *state)
273 +{
274 +  struct main_state *input = (struct main_state *) state->input;
275 +
276 +  switch(key)
277 +    {
278 +    default:
279 +      return ARGP_ERR_UNKNOWN;
280 +    case ARGP_KEY_INIT:
281 +      state->child_inputs[0] = &input->child;
282 +      break;
283 +    case ARGP_KEY_END:
284 +      if (!input->m)
285 +       input->m = input->child.n;
286 +      
287 +      break;
288 +    }
289 +  return 0;
290 +}
291 +
292 +static const struct argp_child
293 +main_children[] =
294 +{
295 +  { &child_argp, 0, "", 0 },
296 +  { NULL, 0, NULL, 0}
297 +};
298 +
299 +static const struct argp
300 +main_argp =
301 +{ options, main_parser, 
302 +  NULL,
303 +  NULL,
304 +  main_children,
305 +  NULL, NULL
306 +};
307 +
308 +int main(int argc, char **argv)
309 +{
310 +  struct main_state input = { { 0 }, 0 };
311 +  char *v[2] = { "foo", NULL };
312 +
313 +  argp_parse(&main_argp, 1, v, 0, NULL, &input);
314 +
315 +  if ( (input.m == 1) && (input.child.n == 1) )
316 +    return 0;
317 +  else
318 +    return 1;
319 +}
320 +], lsh_cv_lib_argp_works=yes,
321 +   lsh_cv_lib_argp_works=no,
322 +   lsh_cv_lib_argp_works=no)])
323 +
324 +  if test x$lsh_cv_lib_argp_works = xyes ; then
325 +    ac_argp_ok=yes
326 +  else
327 +    # Reset link flags
328 +    LIBS="$ac_argp_save_LIBS"
329 +    LDFLAGS="$ac_argp_save_LDFLAGS"
330 +  fi])
331 +
332 +  if test x$ac_argp_ok = xyes ; then
333 +    ifelse([$1],, true, [$1])
334 +  else
335 +    ifelse([$2],, true, [$2])
336 +  fi   
337 +])
338 +
339 +dnl LSH_GCC_ATTRIBUTES
340 +dnl Check for gcc's __attribute__ construction
341 +
342 +AC_DEFUN([LSH_GCC_ATTRIBUTES],
343 +[AC_CACHE_CHECK(for __attribute__,
344 +              lsh_cv_c_attribute,
345 +[ AC_TRY_COMPILE([
346 +#include <stdlib.h>
347 +
348 +static void foo(void) __attribute__ ((noreturn));
349 +
350 +static void __attribute__ ((noreturn))
351 +foo(void)
352 +{
353 +  exit(1);
354 +}
355 +],[],
356 +lsh_cv_c_attribute=yes,
357 +lsh_cv_c_attribute=no)])
358 +
359 +AH_TEMPLATE([HAVE_GCC_ATTRIBUTE], [Define if the compiler understands __attribute__])
360 +if test "x$lsh_cv_c_attribute" = "xyes"; then
361 +  AC_DEFINE(HAVE_GCC_ATTRIBUTE)
362 +fi
363 +
364 +AH_BOTTOM(
365 +[#if __GNUC__ && HAVE_GCC_ATTRIBUTE
366 +# define NORETURN __attribute__ ((__noreturn__))
367 +# define PRINTF_STYLE(f, a) __attribute__ ((__format__ (__printf__, f, a)))
368 +# define UNUSED __attribute__ ((__unused__))
369 +#else
370 +# define NORETURN
371 +# define PRINTF_STYLE(f, a)
372 +# define UNUSED
373 +#endif
374 +])])
375 +
376 +# Check for alloca, and include the standard blurb in config.h
377 +AC_DEFUN([LSH_FUNC_ALLOCA],
378 +[AC_FUNC_ALLOCA
379 +AC_CHECK_HEADERS([malloc.h])
380 +AH_BOTTOM(
381 +[/* AIX requires this to be the first thing in the file.  */
382 +#ifndef __GNUC__
383 +# if HAVE_ALLOCA_H
384 +#  include <alloca.h>
385 +# else
386 +#  ifdef _AIX
387 + #pragma alloca
388 +#  else
389 +#   ifndef alloca /* predefined by HP cc +Olibcalls */
390 +char *alloca ();
391 +#   endif
392 +#  endif
393 +/* Needed for alloca on windows */
394 +#  if HAVE_MALLOC_H
395 +#   include <malloc.h>
396 +#  endif
397 +# endif
398 +#else /* defined __GNUC__ */
399 +# if HAVE_ALLOCA_H
400 +#  include <alloca.h>
401 +# else
402 +/* Needed for alloca on windows, also with gcc */
403 +#  if HAVE_MALLOC_H
404 +#   include <malloc.h>
405 +#  endif
406 +# endif
407 +#endif
408 +])])
409 +
410 +AC_DEFUN([LSH_FUNC_STRERROR],
411 +[AC_CHECK_FUNCS(strerror)
412 +AH_BOTTOM(
413 +[#if HAVE_STRERROR
414 +#define STRERROR strerror
415 +#else
416 +#define STRERROR(x) (sys_errlist[x])
417 +#endif
418 +])])
419 +
420 +AC_DEFUN([LSH_FUNC_STRSIGNAL],
421 +[AC_CHECK_FUNCS(strsignal)
422 +AC_CHECK_DECLS([sys_siglist, _sys_siglist])
423 +AH_BOTTOM(
424 +[#if HAVE_STRSIGNAL
425 +# define STRSIGNAL strsignal
426 +#else /* !HAVE_STRSIGNAL */
427 +# if HAVE_DECL_SYS_SIGLIST
428 +#  define STRSIGNAL(x) (sys_siglist[x])
429 +# else
430 +#  if HAVE_DECL__SYS_SIGLIST
431 +#   define STRSIGNAL(x) (_sys_siglist[x])
432 +#  else
433 +#   define STRSIGNAL(x) "Unknown signal"
434 +#   if __GNUC__
435 +#    warning Using dummy STRSIGNAL
436 +#   endif
437 +#  endif
438 +# endif
439 +#endif /* !HAVE_STRSIGNAL */
440 +])])
441 +
442 +dnl LSH_MAKE_CONDITIONAL(symbol, test)
443 +AC_DEFUN([LSH_MAKE_CONDITIONAL],
444 +[if $2 ; then
445 +  IF_$1=''
446 +  UNLESS_$1='# '
447 +else
448 +  IF_$1='# '
449 +  UNLESS_$1=''
450 +fi 
451 +AC_SUBST(IF_$1)
452 +AC_SUBST(UNLESS_$1)])
453 +
454 +dnl LSH_DEPENDENCY_TRACKING
455 +
456 +dnl Defines compiler flags DEP_FLAGS to generate dependency
457 +dnl information, and DEP_PROCESS that is any shell commands needed for
458 +dnl massaging the dependency information further. Dependencies are
459 +dnl generated as a side effect of compilation. Dependency files
460 +dnl themselves are not treated as targets.
461 +
462 +AC_DEFUN([LSH_DEPENDENCY_TRACKING],
463 +[AC_ARG_ENABLE(dependency_tracking,
464 +  AC_HELP_STRING([--disable-dependency-tracking],
465 +    [Disable dependency tracking. Dependency tracking doesn't work with BSD make]),,
466 +  [enable_dependency_tracking=yes])
467 +
468 +DEP_FLAGS=''
469 +DEP_PROCESS='true'
470 +if test x$enable_dependency_tracking = xyes ; then
471 +  if test x$GCC = xyes ; then
472 +    gcc_version=`gcc --version | head -1`
473 +    case "$gcc_version" in
474 +      2.*|*[[!0-9.]]2.*)
475 +        enable_dependency_tracking=no
476 +        AC_MSG_WARN([Dependency tracking disabled, gcc-3.x is needed])
477 +      ;;
478 +      *)
479 +        DEP_FLAGS='-MT $[]@ -MD -MP -MF $[]@.d'
480 +        DEP_PROCESS='true'
481 +      ;;
482 +    esac
483 +  else
484 +    enable_dependency_tracking=no
485 +    AC_MSG_WARN([Dependency tracking disabled])
486 +  fi
487 +fi
488 +
489 +if test x$enable_dependency_tracking = xyes ; then
490 +  DEP_INCLUDE='include '
491 +else
492 +  DEP_INCLUDE='# '
493 +fi
494 +
495 +AC_SUBST([DEP_INCLUDE])
496 +AC_SUBST([DEP_FLAGS])
497 +AC_SUBST([DEP_PROCESS])])
498 +
499 +dnl  GMP_TRY_ASSEMBLE(asm-code,[action-success][,action-fail])
500 +dnl  ----------------------------------------------------------
501 +dnl  Attempt to assemble the given code.
502 +dnl  Do "action-success" if this succeeds, "action-fail" if not.
503 +dnl
504 +dnl  conftest.o and conftest.out are available for inspection in
505 +dnl  "action-success".  If either action does a "break" out of a loop then
506 +dnl  an explicit "rm -f conftest*" will be necessary.
507 +dnl
508 +dnl  This is not unlike AC_TRY_COMPILE, but there's no default includes or
509 +dnl  anything in "asm-code", everything wanted must be given explicitly.
510 +
511 +AC_DEFUN([GMP_TRY_ASSEMBLE],
512 +[cat >conftest.s <<EOF
513 +[$1]
514 +EOF
515 +gmp_assemble="$CC $CFLAGS $CPPFLAGS -c conftest.s >conftest.out 2>&1"
516 +if AC_TRY_EVAL(gmp_assemble); then
517 +  cat conftest.out >&AC_FD_CC
518 +  ifelse([$2],,:,[$2])
519 +else
520 +  cat conftest.out >&AC_FD_CC
521 +  echo "configure: failed program was:" >&AC_FD_CC
522 +  cat conftest.s >&AC_FD_CC
523 +  ifelse([$3],,:,[$3])
524 +fi
525 +rm -f conftest*
526 +])
527 +
528 +dnl  GMP_PROG_CC_FOR_BUILD
529 +dnl  ---------------------
530 +dnl  Establish CC_FOR_BUILD, a C compiler for the build system.
531 +dnl
532 +dnl  If CC_FOR_BUILD is set then it's expected to work, likewise the old
533 +dnl  style HOST_CC, otherwise some likely candidates are tried, the same as
534 +dnl  configfsf.guess.
535 +
536 +AC_DEFUN([GMP_PROG_CC_FOR_BUILD],
537 +[AC_REQUIRE([AC_PROG_CC])
538 +if test -n "$CC_FOR_BUILD"; then
539 +  GMP_PROG_CC_FOR_BUILD_WORKS($CC_FOR_BUILD,,
540 +    [AC_MSG_ERROR([Specified CC_FOR_BUILD doesn't seem to work])])
541 +elif test -n "$HOST_CC"; then
542 +  GMP_PROG_CC_FOR_BUILD_WORKS($HOST_CC,
543 +    [CC_FOR_BUILD=$HOST_CC],
544 +    [AC_MSG_ERROR([Specified HOST_CC doesn't seem to work])])
545 +elif test $cross_compiling = no ; then
546 +  CC_FOR_BUILD="$CC"
547 +else
548 +  for i in cc gcc c89 c99; do
549 +    GMP_PROG_CC_FOR_BUILD_WORKS($i,
550 +      [CC_FOR_BUILD=$i
551 +       break])
552 +  done
553 +  if test -z "$CC_FOR_BUILD"; then
554 +    AC_MSG_ERROR([Cannot find a build system compiler])
555 +  fi
556 +fi
557 +
558 +AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
559 +AC_SUBST(CC_FOR_BUILD)
560 +])
561 +
562 +
563 +dnl  GMP_PROG_CC_FOR_BUILD_WORKS(cc/cflags[,[action-if-good][,action-if-bad]])
564 +dnl  -------------------------------------------------------------------------
565 +dnl  See if the given cc/cflags works on the build system.
566 +dnl
567 +dnl  It seems easiest to just use the default compiler output, rather than
568 +dnl  figuring out the .exe or whatever at this stage.
569 +
570 +AC_DEFUN([GMP_PROG_CC_FOR_BUILD_WORKS],
571 +[AC_MSG_CHECKING([build system compiler $1])
572 +# remove anything that might look like compiler output to our "||" expression
573 +rm -f conftest* a.out b.out a.exe a_out.exe
574 +cat >conftest.c <<EOF
575 +int
576 +main ()
577 +{
578 +  exit(0);
579 +}
580 +EOF
581 +gmp_compile="$1 conftest.c"
582 +cc_for_build_works=no
583 +if AC_TRY_EVAL(gmp_compile); then
584 +  if (./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest) >&AC_FD_CC 2>&1; then
585 +    cc_for_build_works=yes
586 +  fi
587 +fi
588 +rm -f conftest* a.out b.out a.exe a_out.exe
589 +AC_MSG_RESULT($cc_for_build_works)
590 +if test "$cc_for_build_works" = yes; then
591 +  ifelse([$2],,:,[$2])
592 +else
593 +  ifelse([$3],,:,[$3])
594 +fi
595 +])
596 +
597 +dnl  GMP_PROG_EXEEXT_FOR_BUILD
598 +dnl  -------------------------
599 +dnl  Determine EXEEXT_FOR_BUILD, the build system executable suffix.
600 +dnl
601 +dnl  The idea is to find what "-o conftest$foo" will make it possible to run
602 +dnl  the program with ./conftest.  On Unix-like systems this is of course
603 +dnl  nothing, for DOS it's ".exe", or for a strange RISC OS foreign file
604 +dnl  system cross compile it can be ",ff8" apparently.  Not sure if the
605 +dnl  latter actually applies to a build-system executable, maybe it doesn't,
606 +dnl  but it won't hurt to try.
607 +
608 +AC_DEFUN([GMP_PROG_EXEEXT_FOR_BUILD],
609 +[AC_REQUIRE([GMP_PROG_CC_FOR_BUILD])
610 +AC_CACHE_CHECK([for build system executable suffix],
611 +               gmp_cv_prog_exeext_for_build,
612 +[if test $cross_compiling = no ; then
613 +  gmp_cv_prog_exeext_for_build="$EXEEXT"
614 +else
615 +  cat >conftest.c <<EOF
616 +int
617 +main ()
618 +{
619 +  exit (0);
620 +}
621 +EOF
622 +  for i in .exe ,ff8 ""; do
623 +    gmp_compile="$CC_FOR_BUILD conftest.c -o conftest$i"
624 +    if AC_TRY_EVAL(gmp_compile); then
625 +      if (./conftest) 2>&AC_FD_CC; then
626 +        gmp_cv_prog_exeext_for_build=$i
627 +        break
628 +      fi
629 +    fi
630 +  done
631 +  rm -f conftest*
632 +  if test "${gmp_cv_prog_exeext_for_build+set}" != set; then
633 +    AC_MSG_ERROR([Cannot determine executable suffix])
634 +  fi
635 +fi
636 +])
637 +AC_SUBST(EXEEXT_FOR_BUILD,$gmp_cv_prog_exeext_for_build)
638 +])
639 +
640 +dnl NETTLE_CHECK_ARM_NEON
641 +dnl ---------------------
642 +dnl Check if ARM Neon instructions should be used.
643 +dnl Obeys enable_arm_neon, which should be set earlier.
644 +AC_DEFUN([NETTLE_CHECK_ARM_NEON],
645 +[if test "$enable_arm_neon" = auto ; then
646 +  if test "$cross_compiling" = yes ; then
647 +    dnl Check if compiler/assembler accepts it,
648 +    dnl without an explicit .fpu neon directive.
649 +    AC_CACHE_CHECK([if assembler accepts Neon instructions],
650 +      nettle_cv_asm_arm_neon,
651 +      [GMP_TRY_ASSEMBLE([
652 +.text
653 +foo:
654 +       vmlal.u32       q1, d0, d1
655 +],
656 +      [nettle_cv_asm_arm_neon=yes],
657 +      [nettle_cv_asm_arm_neon=no])])
658 +    enable_arm_neon="$nettle_cv_asm_arm_neon"
659 +  else
660 +    AC_MSG_CHECKING([if /proc/cpuinfo claims neon support])
661 +    if grep '^Features.*:.* neon' /proc/cpuinfo >/dev/null ; then
662 +      enable_arm_neon=yes
663 +    else
664 +      enable_arm_neon=no
665 +    fi
666 +    AC_MSG_RESULT($enable_arm_neon)
667 +  fi
668 +fi
669 +])
670 +
671 +dnl @synopsis AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEADERS-TO-CHECK])]
672 +dnl
673 +dnl the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the
674 +dnl existence of an include file <stdint.h> that defines a set of 
675 +dnl typedefs, especially uint8_t,int32_t,uintptr_t.
676 +dnl Many older installations will not provide this file, but some will
677 +dnl have the very same definitions in <inttypes.h>. In other enviroments
678 +dnl we can use the inet-types in <sys/types.h> which would define the
679 +dnl typedefs int8_t and u_int8_t respectivly.
680 +dnl
681 +dnl This macros will create a local "_stdint.h" or the headerfile given as 
682 +dnl an argument. In many cases that file will just "#include <stdint.h>" 
683 +dnl or "#include <inttypes.h>", while in other environments it will provide 
684 +dnl the set of basic 'stdint's definitions/typedefs: 
685 +dnl   int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t
686 +dnl   int_least32_t.. int_fast32_t.. intmax_t
687 +dnl which may or may not rely on the definitions of other files,
688 +dnl or using the AC_CHECK_SIZEOF macro to determine the actual
689 +dnl sizeof each type.
690 +dnl
691 +dnl if your header files require the stdint-types you will want to create an
692 +dnl installable file mylib-int.h that all your other installable header
693 +dnl may include. So if you have a library package named "mylib", just use
694 +dnl      AX_CREATE_STDINT_H(mylib-int.h) 
695 +dnl in configure.ac and go to install that very header file in Makefile.am
696 +dnl along with the other headers (mylib.h) - and the mylib-specific headers
697 +dnl can simply use "#include <mylib-int.h>" to obtain the stdint-types.
698 +dnl
699 +dnl Remember, if the system already had a valid <stdint.h>, the generated
700 +dnl file will include it directly. No need for fuzzy HAVE_STDINT_H things...
701 +dnl
702 +dnl @, (status: used on new platforms) (see http://ac-archive.sf.net/gstdint/)
703 +dnl @author  Guido Draheim <guidod@gmx.de> 
704 +
705 +AC_DEFUN([AX_CREATE_STDINT_H],
706 +[# ------ AX CREATE STDINT H -------------------------------------
707 +AC_MSG_CHECKING([for stdint types])
708 +ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)`
709 +# try to shortcircuit - if the default include path of the compiler
710 +# can find a "stdint.h" header then we assume that all compilers can.
711 +AC_CACHE_VAL([ac_cv_header_stdint_t],[
712 +old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS=""
713 +old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS=""
714 +old_CFLAGS="$CFLAGS"     ; CFLAGS=""
715 +AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
716 +[ac_cv_stdint_result="(assuming C99 compatible system)"
717 + ac_cv_header_stdint_t="stdint.h"; ],
718 +[ac_cv_header_stdint_t=""])
719 +CXXFLAGS="$old_CXXFLAGS"
720 +CPPFLAGS="$old_CPPFLAGS"
721 +CFLAGS="$old_CFLAGS" ])
722 +
723 +v="... $ac_cv_header_stdint_h"
724 +if test "$ac_stdint_h" = "stdint.h" ; then
725 + AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)])
726 +elif test "$ac_stdint_h" = "inttypes.h" ; then
727 + AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)])
728 +elif test "_$ac_cv_header_stdint_t" = "_" ; then
729 + AC_MSG_RESULT([(putting them into $ac_stdint_h)$v])
730 +else
731 + ac_cv_header_stdint="$ac_cv_header_stdint_t"
732 + AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)])
733 +fi
734 +
735 +if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit..
736 +
737 +dnl .....intro message done, now do a few system checks.....
738 +dnl btw, all CHECK_TYPE macros do automatically "DEFINE" a type, therefore
739 +dnl we use the autoconf implementation detail _AC CHECK_TYPE_NEW instead
740 +
741 +inttype_headers=`echo $2 | sed -e 's/,/ /g'`
742 +
743 +ac_cv_stdint_result="(no helpful system typedefs seen)"
744 +AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[
745 + ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h)
746 +  AC_MSG_RESULT([(..)])
747 +  for i in stdint.h inttypes.h sys/inttypes.h $inttype_headers ; do
748 +   unset ac_cv_type_uintptr_t 
749 +   unset ac_cv_type_uint64_t
750 +   _AC_CHECK_TYPE_NEW(uintptr_t,[ac_cv_header_stdint_x=$i],dnl
751 +     continue,[#include <$i>])
752 +   AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
753 +   ac_cv_stdint_result="(seen uintptr_t$and64 in $i)"
754 +   break;
755 +  done
756 +  AC_MSG_CHECKING([for stdint uintptr_t])
757 + ])
758 +
759 +if test "_$ac_cv_header_stdint_x" = "_" ; then
760 +AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[
761 + ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h)
762 +  AC_MSG_RESULT([(..)])
763 +  for i in inttypes.h sys/inttypes.h stdint.h $inttype_headers ; do
764 +   unset ac_cv_type_uint32_t
765 +   unset ac_cv_type_uint64_t
766 +   AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],dnl
767 +     continue,[#include <$i>])
768 +   AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
769 +   ac_cv_stdint_result="(seen uint32_t$and64 in $i)"
770 +   break;
771 +  done
772 +  AC_MSG_CHECKING([for stdint uint32_t])
773 + ])
774 +fi
775 +
776 +if test "_$ac_cv_header_stdint_x" = "_" ; then
777 +if test "_$ac_cv_header_stdint_o" = "_" ; then
778 +AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[
779 + ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h)
780 +  AC_MSG_RESULT([(..)])
781 +  for i in sys/types.h inttypes.h sys/inttypes.h $inttype_headers ; do
782 +   unset ac_cv_type_u_int32_t
783 +   unset ac_cv_type_u_int64_t
784 +   AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],dnl
785 +     continue,[#include <$i>])
786 +   AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>])
787 +   ac_cv_stdint_result="(seen u_int32_t$and64 in $i)"
788 +   break;
789 +  done
790 +  AC_MSG_CHECKING([for stdint u_int32_t])
791 + ])
792 +fi fi
793 +
794 +dnl if there was no good C99 header file, do some typedef checks...
795 +if test "_$ac_cv_header_stdint_x" = "_" ; then
796 +   AC_MSG_CHECKING([for stdint datatype model])
797 +   AC_MSG_RESULT([(..)])
798 +   AC_CHECK_SIZEOF(char)
799 +   AC_CHECK_SIZEOF(short)
800 +   AC_CHECK_SIZEOF(int)
801 +   AC_CHECK_SIZEOF(long)
802 +   AC_CHECK_SIZEOF(void*)
803 +   ac_cv_stdint_char_model=""
804 +   ac_cv_stdint_char_model="$ac_cv_stdint_char_model$ac_cv_sizeof_char"
805 +   ac_cv_stdint_char_model="$ac_cv_stdint_char_model$ac_cv_sizeof_short"
806 +   ac_cv_stdint_char_model="$ac_cv_stdint_char_model$ac_cv_sizeof_int"
807 +   ac_cv_stdint_long_model=""
808 +   ac_cv_stdint_long_model="$ac_cv_stdint_long_model$ac_cv_sizeof_int"
809 +   ac_cv_stdint_long_model="$ac_cv_stdint_long_model$ac_cv_sizeof_long"
810 +   ac_cv_stdint_long_model="$ac_cv_stdint_long_model$ac_cv_sizeof_voidp"
811 +   name="$ac_cv_stdint_long_model"
812 +   case "$ac_cv_stdint_char_model/$ac_cv_stdint_long_model" in
813 +    122/242)     name="$name,  IP16 (standard 16bit machine)" ;;
814 +    122/244)     name="$name,  LP32 (standard 32bit mac/win)" ;;
815 +    122/*)       name="$name        (unusual int16 model)" ;; 
816 +    124/444)     name="$name, ILP32 (standard 32bit unixish)" ;;
817 +    124/488)     name="$name,  LP64 (standard 64bit unixish)" ;;
818 +    124/448)     name="$name, LLP64 (unusual  64bit unixish)" ;;
819 +    124/*)       name="$name        (unusual int32 model)" ;; 
820 +    128/888)     name="$name, ILP64 (unusual  64bit numeric)" ;;
821 +    128/*)       name="$name        (unusual int64 model)" ;; 
822 +    222/*|444/*) name="$name        (unusual dsptype)" ;;
823 +     *)          name="$name        (very unusal model)" ;;
824 +   esac
825 +   AC_MSG_RESULT([combined for stdint datatype model...  $name])
826 +fi
827 +
828 +if test "_$ac_cv_header_stdint_x" != "_" ; then
829 +   ac_cv_header_stdint="$ac_cv_header_stdint_x"
830 +elif  test "_$ac_cv_header_stdint_o" != "_" ; then
831 +   ac_cv_header_stdint="$ac_cv_header_stdint_o"
832 +elif  test "_$ac_cv_header_stdint_u" != "_" ; then
833 +   ac_cv_header_stdint="$ac_cv_header_stdint_u"
834 +else
835 +   ac_cv_header_stdint="stddef.h"
836 +fi
837 +
838 +AC_MSG_CHECKING([for extra inttypes in chosen header])
839 +AC_MSG_RESULT([($ac_cv_header_stdint)])
840 +dnl see if int_least and int_fast types are present in _this_ header.
841 +unset ac_cv_type_int_least32_t
842 +unset ac_cv_type_int_fast32_t
843 +AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>])
844 +AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>])
845 +AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>])
846 +
847 +fi # shortcircut to system "stdint.h"
848 +# ------------------ PREPARE VARIABLES ------------------------------
849 +if test "$GCC" = "yes" ; then
850 +ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1` 
851 +else
852 +ac_cv_stdint_message="using $CC"
853 +fi
854 +
855 +AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl
856 +$ac_cv_stdint_result])
857 +
858 +# ----------------- DONE inttypes.h checks START header -------------
859 +AC_CONFIG_COMMANDS([$ac_stdint_h],[
860 +AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h)
861 +ac_stdint=$tmp/_stdint.h
862 +
863 +echo "#ifndef" $_ac_stdint_h >$ac_stdint
864 +echo "#define" $_ac_stdint_h "1" >>$ac_stdint
865 +echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint
866 +echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint
867 +echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint
868 +if test "_$ac_cv_header_stdint_t" != "_" ; then 
869 +echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint
870 +fi
871 +
872 +cat >>$ac_stdint <<STDINT_EOF
873 +
874 +/* ................... shortcircuit part ........................... */
875 +
876 +#if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
877 +#include <stdint.h>
878 +#else
879 +#include <stddef.h>
880 +
881 +/* .................... configured part ............................ */
882 +
883 +STDINT_EOF
884 +
885 +echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint
886 +if test "_$ac_cv_header_stdint_x" != "_" ; then
887 +  ac_header="$ac_cv_header_stdint_x"
888 +  echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint
889 +else
890 +  echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint
891 +fi
892 +
893 +echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint
894 +if  test "_$ac_cv_header_stdint_o" != "_" ; then
895 +  ac_header="$ac_cv_header_stdint_o"
896 +  echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint
897 +else
898 +  echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint
899 +fi
900 +
901 +echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint
902 +if  test "_$ac_cv_header_stdint_u" != "_" ; then
903 +  ac_header="$ac_cv_header_stdint_u"
904 +  echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint
905 +else
906 +  echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint
907 +fi
908 +
909 +echo "" >>$ac_stdint
910 +
911 +if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then
912 +  echo "#include <$ac_header>" >>$ac_stdint
913 +  echo "" >>$ac_stdint
914 +fi fi
915 +
916 +echo "/* which 64bit typedef has been found */" >>$ac_stdint
917 +if test "$ac_cv_type_uint64_t" = "yes" ; then
918 +echo "#define   _STDINT_HAVE_UINT64_T" "1"  >>$ac_stdint
919 +else
920 +echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint
921 +fi
922 +if test "$ac_cv_type_u_int64_t" = "yes" ; then
923 +echo "#define   _STDINT_HAVE_U_INT64_T" "1"  >>$ac_stdint
924 +else
925 +echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint
926 +fi
927 +echo "" >>$ac_stdint
928 +
929 +echo "/* which type model has been detected */" >>$ac_stdint
930 +if test "_$ac_cv_stdint_char_model" != "_" ; then
931 +echo "#define   _STDINT_CHAR_MODEL" "$ac_cv_stdint_char_model" >>$ac_stdint
932 +echo "#define   _STDINT_LONG_MODEL" "$ac_cv_stdint_long_model" >>$ac_stdint
933 +else
934 +echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint
935 +echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint
936 +fi
937 +echo "" >>$ac_stdint
938 +
939 +echo "/* whether int_least types were detected */" >>$ac_stdint
940 +if test "$ac_cv_type_int_least32_t" = "yes"; then
941 +echo "#define   _STDINT_HAVE_INT_LEAST32_T" "1"  >>$ac_stdint
942 +else
943 +echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint
944 +fi
945 +echo "/* whether int_fast types were detected */" >>$ac_stdint
946 +if test "$ac_cv_type_int_fast32_t" = "yes"; then
947 +echo "#define   _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint
948 +else
949 +echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint
950 +fi
951 +echo "/* whether intmax_t type was detected */" >>$ac_stdint
952 +if test "$ac_cv_type_intmax_t" = "yes"; then
953 +echo "#define   _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint
954 +else
955 +echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint
956 +fi
957 +echo "" >>$ac_stdint
958 +
959 +  cat >>$ac_stdint <<STDINT_EOF
960 +/* .................... detections part ............................ */
961 +
962 +/* whether we need to define bitspecific types from compiler base types */
963 +#ifndef _STDINT_HEADER_INTPTR
964 +#ifndef _STDINT_HEADER_UINT32
965 +#ifndef _STDINT_HEADER_U_INT32
966 +#define _STDINT_NEED_INT_MODEL_T
967 +#else
968 +#define _STDINT_HAVE_U_INT_TYPES
969 +#endif
970 +#endif
971 +#endif
972 +
973 +#ifdef _STDINT_HAVE_U_INT_TYPES
974 +#undef _STDINT_NEED_INT_MODEL_T
975 +#endif
976 +
977 +#ifdef  _STDINT_CHAR_MODEL
978 +#if     _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
979 +#ifndef _STDINT_BYTE_MODEL
980 +#define _STDINT_BYTE_MODEL 12
981 +#endif
982 +#endif
983 +#endif
984 +
985 +#ifndef _STDINT_HAVE_INT_LEAST32_T
986 +#define _STDINT_NEED_INT_LEAST_T
987 +#endif
988 +
989 +#ifndef _STDINT_HAVE_INT_FAST32_T
990 +#define _STDINT_NEED_INT_FAST_T
991 +#endif
992 +
993 +#ifndef _STDINT_HEADER_INTPTR
994 +#define _STDINT_NEED_INTPTR_T
995 +#ifndef _STDINT_HAVE_INTMAX_T
996 +#define _STDINT_NEED_INTMAX_T
997 +#endif
998 +#endif
999 +
1000 +
1001 +/* .................... definition part ............................ */
1002 +
1003 +/* some system headers have good uint64_t */
1004 +#ifndef _HAVE_UINT64_T
1005 +#if     defined _STDINT_HAVE_UINT64_T  || defined HAVE_UINT64_T
1006 +#define _HAVE_UINT64_T
1007 +#elif   defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
1008 +#define _HAVE_UINT64_T
1009 +typedef u_int64_t uint64_t;
1010 +#endif
1011 +#endif
1012 +
1013 +#ifndef _HAVE_UINT64_T
1014 +/* .. here are some common heuristics using compiler runtime specifics */
1015 +#if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
1016 +#define _HAVE_UINT64_T
1017 +typedef long long int64_t;
1018 +typedef unsigned long long uint64_t;
1019 +
1020 +#elif !defined __STRICT_ANSI__
1021 +#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
1022 +#define _HAVE_UINT64_T
1023 +typedef __int64 int64_t;
1024 +typedef unsigned __int64 uint64_t;
1025 +
1026 +#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
1027 +/* note: all ELF-systems seem to have loff-support which needs 64-bit */
1028 +#if !defined _NO_LONGLONG
1029 +#define _HAVE_UINT64_T
1030 +typedef long long int64_t;
1031 +typedef unsigned long long uint64_t;
1032 +#endif
1033 +
1034 +#elif defined __alpha || (defined __mips && defined _ABIN32)
1035 +#if !defined _NO_LONGLONG
1036 +typedef long int64_t;
1037 +typedef unsigned long uint64_t;
1038 +#endif
1039 +  /* compiler/cpu type to define int64_t */
1040 +#endif
1041 +#endif
1042 +#endif
1043 +
1044 +#if defined _STDINT_HAVE_U_INT_TYPES
1045 +/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
1046 +typedef u_int8_t uint8_t;
1047 +typedef u_int16_t uint16_t;
1048 +typedef u_int32_t uint32_t;
1049 +
1050 +/* glibc compatibility */
1051 +#ifndef __int8_t_defined
1052 +#define __int8_t_defined
1053 +#endif
1054 +#endif
1055 +
1056 +#ifdef _STDINT_NEED_INT_MODEL_T
1057 +/* we must guess all the basic types. Apart from byte-adressable system, */
1058 +/* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
1059 +/* (btw, those nibble-addressable systems are way off, or so we assume) */
1060 +
1061 +dnl   /* have a look at "64bit and data size neutrality" at */
1062 +dnl   /* http://unix.org/version2/whatsnew/login_64bit.html */
1063 +dnl   /* (the shorthand "ILP" types always have a "P" part) */
1064 +
1065 +#if defined _STDINT_BYTE_MODEL
1066 +#if _STDINT_LONG_MODEL+0 == 242
1067 +/* 2:4:2 =  IP16 = a normal 16-bit system                */
1068 +typedef unsigned char   uint8_t;
1069 +typedef unsigned short  uint16_t;
1070 +typedef unsigned long   uint32_t;
1071 +#ifndef __int8_t_defined
1072 +#define __int8_t_defined
1073 +typedef          char    int8_t;
1074 +typedef          short   int16_t;
1075 +typedef          long    int32_t;
1076 +#endif
1077 +#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
1078 +/* 2:4:4 =  LP32 = a 32-bit system derived from a 16-bit */
1079 +/* 4:4:4 = ILP32 = a normal 32-bit system                */
1080 +typedef unsigned char   uint8_t;
1081 +typedef unsigned short  uint16_t;
1082 +typedef unsigned int    uint32_t;
1083 +#ifndef __int8_t_defined
1084 +#define __int8_t_defined
1085 +typedef          char    int8_t;
1086 +typedef          short   int16_t;
1087 +typedef          int     int32_t;
1088 +#endif
1089 +#elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
1090 +/* 4:8:4 =  IP32 = a 32-bit system prepared for 64-bit    */
1091 +/* 4:8:8 =  LP64 = a normal 64-bit system                 */
1092 +typedef unsigned char   uint8_t;
1093 +typedef unsigned short  uint16_t;
1094 +typedef unsigned int    uint32_t;
1095 +#ifndef __int8_t_defined
1096 +#define __int8_t_defined
1097 +typedef          char    int8_t;
1098 +typedef          short   int16_t;
1099 +typedef          int     int32_t;
1100 +#endif
1101 +/* this system has a "long" of 64bit */
1102 +#ifndef _HAVE_UINT64_T
1103 +#define _HAVE_UINT64_T
1104 +typedef unsigned long   uint64_t;
1105 +typedef          long    int64_t;
1106 +#endif
1107 +#elif _STDINT_LONG_MODEL+0 == 448
1108 +/*      LLP64   a 64-bit system derived from a 32-bit system */
1109 +typedef unsigned char   uint8_t;
1110 +typedef unsigned short  uint16_t;
1111 +typedef unsigned int    uint32_t;
1112 +#ifndef __int8_t_defined
1113 +#define __int8_t_defined
1114 +typedef          char    int8_t;
1115 +typedef          short   int16_t;
1116 +typedef          int     int32_t;
1117 +#endif
1118 +/* assuming the system has a "long long" */
1119 +#ifndef _HAVE_UINT64_T
1120 +#define _HAVE_UINT64_T
1121 +typedef unsigned long long uint64_t;
1122 +typedef          long long  int64_t;
1123 +#endif
1124 +#else
1125 +#define _STDINT_NO_INT32_T
1126 +#endif
1127 +#else
1128 +#define _STDINT_NO_INT8_T
1129 +#define _STDINT_NO_INT32_T
1130 +#endif
1131 +#endif
1132 +
1133 +/*
1134 + * quote from SunOS-5.8 sys/inttypes.h:
1135 + * Use at your own risk.  As of February 1996, the committee is squarely
1136 + * behind the fixed sized types; the "least" and "fast" types are still being
1137 + * discussed.  The probability that the "fast" types may be removed before
1138 + * the standard is finalized is high enough that they are not currently
1139 + * implemented.
1140 + */
1141 +
1142 +#if defined _STDINT_NEED_INT_LEAST_T
1143 +typedef  int8_t    int_least8_t;
1144 +typedef  int16_t   int_least16_t;
1145 +typedef  int32_t   int_least32_t;
1146 +#ifdef _HAVE_UINT64_T
1147 +typedef  int64_t   int_least64_t;
1148 +#endif
1149 +
1150 +typedef uint8_t   uint_least8_t;
1151 +typedef uint16_t  uint_least16_t;
1152 +typedef uint32_t  uint_least32_t;
1153 +#ifdef _HAVE_UINT64_T
1154 +typedef uint64_t  uint_least64_t;
1155 +#endif
1156 +  /* least types */
1157 +#endif
1158 +
1159 +#if defined _STDINT_NEED_INT_FAST_T
1160 +typedef  int8_t    int_fast8_t; 
1161 +typedef  int       int_fast16_t;
1162 +typedef  int32_t   int_fast32_t;
1163 +#ifdef _HAVE_UINT64_T
1164 +typedef  int64_t   int_fast64_t;
1165 +#endif
1166 +
1167 +typedef uint8_t   uint_fast8_t; 
1168 +typedef unsigned  uint_fast16_t;
1169 +typedef uint32_t  uint_fast32_t;
1170 +#ifdef _HAVE_UINT64_T
1171 +typedef uint64_t  uint_fast64_t;
1172 +#endif
1173 +  /* fast types */
1174 +#endif
1175 +
1176 +#ifdef _STDINT_NEED_INTMAX_T
1177 +#ifdef _HAVE_UINT64_T
1178 +typedef  int64_t       intmax_t;
1179 +typedef uint64_t      uintmax_t;
1180 +#else
1181 +typedef          long  intmax_t;
1182 +typedef unsigned long uintmax_t;
1183 +#endif
1184 +#endif
1185 +
1186 +#ifdef _STDINT_NEED_INTPTR_T
1187 +#ifndef __intptr_t_defined
1188 +#define __intptr_t_defined
1189 +/* we encourage using "long" to store pointer values, never use "int" ! */
1190 +#if   _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
1191 +typedef  unsinged int   uintptr_t;
1192 +typedef           int    intptr_t;
1193 +#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
1194 +typedef  unsigned long  uintptr_t;
1195 +typedef           long   intptr_t;
1196 +#elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
1197 +typedef        uint64_t uintptr_t;
1198 +typedef         int64_t  intptr_t;
1199 +#else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
1200 +typedef  unsigned long  uintptr_t;
1201 +typedef           long   intptr_t;
1202 +#endif
1203 +#endif
1204 +#endif
1205 +
1206 +  /* shortcircuit*/
1207 +#endif
1208 +  /* once */
1209 +#endif
1210 +#endif
1211 +STDINT_EOF
1212 +    if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then
1213 +      AC_MSG_NOTICE([$ac_stdint_h is unchanged])
1214 +    else
1215 +      ac_dir=`AS_DIRNAME(["$ac_stdint_h"])`
1216 +      AS_MKDIR_P(["$ac_dir"])
1217 +      rm -f $ac_stdint_h
1218 +      mv $ac_stdint $ac_stdint_h
1219 +    fi
1220 +],[# variables for create stdint.h replacement
1221 +PACKAGE="$PACKAGE"
1222 +VERSION="$VERSION"
1223 +ac_stdint_h="$ac_stdint_h"
1224 +_ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h)
1225 +ac_cv_stdint_message="$ac_cv_stdint_message"
1226 +ac_cv_header_stdint_t="$ac_cv_header_stdint_t"
1227 +ac_cv_header_stdint_x="$ac_cv_header_stdint_x"
1228 +ac_cv_header_stdint_o="$ac_cv_header_stdint_o"
1229 +ac_cv_header_stdint_u="$ac_cv_header_stdint_u"
1230 +ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
1231 +ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
1232 +ac_cv_stdint_char_model="$ac_cv_stdint_char_model"
1233 +ac_cv_stdint_long_model="$ac_cv_stdint_long_model"
1234 +ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
1235 +ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
1236 +ac_cv_type_intmax_t="$ac_cv_type_intmax_t"
1237 +])
1238 +])
1239 -- 
1240 1.9.2
1241