~ubuntu-branches/ubuntu/utopic/nettle/utopic-proposed

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Package Import Robot
  • Author(s): Magnus Holmgren
  • Date: 2013-05-07 22:57:14 UTC
  • mfrom: (8.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130507225714-s331yr8ov53dtt17
Tags: 2.7-2
Tag some (ECC related) symbols that only exist on some architectures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
dnl Process this file with autoconf to produce a configure script.
4
4
 
5
 
AC_INIT([nettle], [2.4], [nettle-bugs@lists.lysator.liu.se])
 
5
AC_INIT([nettle], [2.7], [nettle-bugs@lists.lysator.liu.se])
6
6
AC_PREREQ(2.61)
7
7
AC_CONFIG_SRCDIR([arcfour.c])
8
8
# Needed to stop autoconf from looking for files in parent directories.
11
11
AC_CONFIG_HEADER([config.h])
12
12
 
13
13
LIBNETTLE_MAJOR=4
14
 
LIBNETTLE_MINOR=3
 
14
LIBNETTLE_MINOR=6
15
15
 
16
16
LIBHOGWEED_MAJOR=2
17
 
LIBHOGWEED_MINOR=1
 
17
LIBHOGWEED_MINOR=4
18
18
 
19
19
AC_CANONICAL_HOST
20
20
 
43
43
  AC_HELP_STRING([--disable-assembler],[Disable assembler code]),,
44
44
  [enable_assembler=yes])
45
45
 
 
46
AC_ARG_ENABLE(static,
 
47
  AC_HELP_STRING([--disable-static], [Do not build any static library]),,
 
48
  [enable_static=yes])
 
49
 
46
50
AC_ARG_ENABLE(shared,
47
 
  AC_HELP_STRING([--enable-shared], [Build a shared library]),,
48
 
  [enable_shared=no])
 
51
  AC_HELP_STRING([--disable-shared], [Do not build any shared library]),,
 
52
  [enable_shared=yes])
49
53
 
50
54
AC_ARG_ENABLE(pic,
51
55
  AC_HELP_STRING([--disable-pic],
60
64
  AC_HELP_STRING([--enable-gcov], [Instrument for gcov (requires a modern gcc)]),,
61
65
  [enable_gcov=no])
62
66
 
 
67
AC_ARG_ENABLE(documentation,
 
68
  AC_HELP_STRING([--disable-documentation], [Omit building and installing the documentation. (default=auto)]),,
 
69
  [enable_documentation=auto])
 
70
 
 
71
AC_ARG_ENABLE(arm-neon,
 
72
  AC_HELP_STRING([--enable-arm-neon], [Enable ARM Neon assembly. (default=auto)]),,
 
73
  [enable_arm_neon=auto])
 
74
 
63
75
LSH_RPATH_INIT([`echo $with_lib_path | sed 's/:/ /g'` \
64
76
    `echo $exec_prefix | sed "s@^NONE@$prefix/lib@g" | sed "s@^NONE@$ac_default_prefix/lib@g"` \
65
77
    /usr/local/lib /sw/local/lib /sw/lib \
87
99
AC_PROG_CXX
88
100
 
89
101
AC_LANG_PUSH(C++)
90
 
AC_TRY_COMPILE([],[return 0;],[CXX_TESTS='cxx-test$(EXEEXT)'], [CXX_TESTS=''])
91
 
AC_SUBST([CXX_TESTS])
 
102
AC_TRY_COMPILE([],[return 0;],[IF_CXX=''], [IF_CXX='#'])
 
103
AC_SUBST([IF_CXX])
92
104
AC_LANG_POP
93
105
 
94
106
AC_PROG_MAKE_SET
96
108
AC_CHECK_TOOL(NM, nm, strings)
97
109
# Used only for the GNU-stack configure test.
98
110
AC_CHECK_TOOL(OBJDUMP, objdump, false)
 
111
AC_CHECK_TOOL(AR, ar, false)
99
112
 
100
113
if test "x$ac_cv_prog_cc_stdc" = xno ; then
101
114
  AC_ERROR([the C compiler doesn't handle ANSI-C]) #'
107
120
# autoconf-2.60 or automake-1.10 to avoid races.
108
121
AC_PROG_MKDIR_P
109
122
 
 
123
AC_PROG_LN_S
 
124
 
 
125
# Compiler tests for the build system
 
126
GMP_PROG_CC_FOR_BUILD
 
127
GMP_PROG_EXEEXT_FOR_BUILD
 
128
 
110
129
LSH_DEPENDENCY_TRACKING
111
130
 
112
131
if test x$enable_dependency_tracking = xyes ; then
115
134
  # actually needed.
116
135
 
117
136
  AC_CONFIG_COMMANDS([dummy-dep-files],
118
 
  [(cd "$srcdir" && find . -name '*.c' -print) \
119
 
 | sed 's/\.c$//' | (while read f; do echo > "$f.o.d"; echo > "$f.po.d"; done)
 
137
  [(cd "$srcdir" && find . '(' -name '*.c' -o -name '*.cxx' ')' -print) \
 
138
 | sed 's/\.c\(xx\)\{0,1\}$//' | (while read f; do echo > "$f.o.d"; echo > "$f.po.d"; done)
120
139
])
121
140
fi
122
141
 
218
237
        asm_path=sparc32
219
238
      fi
220
239
      ;;
 
240
    arm*)
 
241
      NETTLE_CHECK_ARM_NEON
 
242
 
 
243
      asm_path=arm
 
244
      if test "x$enable_arm_neon" = xyes ; then
 
245
        asm_path="arm/neon $asm_path"
 
246
      fi
 
247
      ;;
221
248
    *)
222
249
      enable_assembler=no
223
250
      ;;
224
251
  esac
225
252
fi
226
 
# echo "enable_assembler: $enable_assembler, asm_path: $asm_path"
 
253
 
 
254
# Files which replace a C source file (or otherwise don't correspond
 
255
# to a new object file).
 
256
asm_replace_list="aes-encrypt-internal.asm aes-decrypt-internal.asm \
 
257
                arcfour-crypt.asm camellia-crypt-internal.asm \
 
258
                md5-compress.asm memxor.asm \
 
259
                salsa20-crypt.asm salsa20-core-internal.asm \
 
260
                serpent-encrypt.asm serpent-decrypt.asm \
 
261
                sha1-compress.asm sha256-compress.asm sha512-compress.asm \
 
262
                sha3-permute.asm umac-nh.asm umac-nh-n.asm machine.m4"
 
263
 
 
264
# Assembler files which generate additional object files if they are used.
 
265
asm_optional_list=""
 
266
 
 
267
if test "x$enable_public_key" = "xyes" ; then
 
268
  asm_optional_list="ecc-192-modp.asm ecc-224-modp.asm ecc-256-redc.asm \
 
269
      ecc-384-modp.asm ecc-521-modp.asm"
 
270
fi
 
271
 
 
272
OPT_ASM_SOURCES=""
 
273
 
 
274
asm_file_list=""
227
275
 
228
276
if test "x$enable_assembler" = xyes ; then
229
277
  if test -n "$asm_path"; then
230
 
    AC_MSG_NOTICE([Looking for assembler files in $asm_path/.])
231
 
    found=no
232
 
    for tmp_f in aes-encrypt-internal.asm aes-decrypt-internal.asm \
233
 
                 arcfour-crypt.asm camellia-crypt-internal.asm \
234
 
                 md5-compress.asm memxor.asm \
235
 
                 serpent-encrypt.asm serpent-decrypt.asm \
236
 
                 sha1-compress.asm machine.m4; do
237
 
#       echo "Looking for $srcdir/$asm_path/$tmp_f"
238
 
      if test -f "$srcdir/$asm_path/$tmp_f"; then
239
 
#        echo found
240
 
        found=yes
241
 
        AC_CONFIG_LINKS($tmp_f:$asm_path/$tmp_f)
242
 
      fi
 
278
    AC_MSG_NOTICE([Looking for assembler files in $asm_path.])
 
279
    for tmp_f in $asm_replace_list ; do
 
280
      for asm_dir in $asm_path ; do
 
281
        if test -f "$srcdir/$asm_dir/$tmp_f"; then
 
282
          asm_file_list="$asm_file_list $tmp_f"
 
283
          AC_CONFIG_LINKS($tmp_f:$asm_dir/$tmp_f)
 
284
          break
 
285
        fi
 
286
      done
243
287
    done
244
 
    if test "$found" = no; then
 
288
    dnl Workaround for AC_CONFIG_LINKS, which complains if we use the
 
289
    dnl same destination argument $tmp_f multiple times.
 
290
    for tmp_o in $asm_optional_list ; do
 
291
      for asm_dir in $asm_path ; do
 
292
        if test -f "$srcdir/$asm_dir/$tmp_o"; then
 
293
          asm_file_list="$asm_file_list $tmp_o"
 
294
          AC_CONFIG_LINKS($tmp_o:$asm_dir/$tmp_o)
 
295
          while read tmp_func ; do
 
296
            AC_DEFINE_UNQUOTED(HAVE_NATIVE_$tmp_func)
 
297
            eval HAVE_NATIVE_$tmp_func=yes
 
298
          done <<EOF
 
299
[`sed -n 's/[^  ]*PROLOGUE(_*\(nettle_\)*\([^)]*\)).*$/\2/p' < "$srcdir/$asm_dir/$tmp_o"`]
 
300
EOF
 
301
          OPT_ASM_SOURCES="$OPT_ASM_SOURCES $tmp_o"
 
302
          break
 
303
        fi
 
304
      done
 
305
    done        
 
306
    if test -z "$asm_file_list"; then
245
307
      enable_assembler=no
246
308
      AC_MSG_WARN([No assembler files found.])
247
309
    fi
248
310
  fi
249
311
fi
250
312
 
 
313
AC_SUBST([OPT_ASM_SOURCES])
 
314
 
 
315
AH_VERBATIM([HAVE_NATIVE],
 
316
[/* Define to 1 each of the following for which a native (ie. CPU specific)
 
317
    implementation of the corresponding routine exists.  */
 
318
#undef HAVE_NATIVE_ecc_192_modp
 
319
#undef HAVE_NATIVE_ecc_192_redc
 
320
#undef HAVE_NATIVE_ecc_224_modp
 
321
#undef HAVE_NATIVE_ecc_224_redc
 
322
#undef HAVE_NATIVE_ecc_256_modp
 
323
#undef HAVE_NATIVE_ecc_256_redc
 
324
#undef HAVE_NATIVE_ecc_384_modp
 
325
#undef HAVE_NATIVE_ecc_384_redc
 
326
#undef HAVE_NATIVE_ecc_521_modp
 
327
#undef HAVE_NATIVE_ecc_521_redc])
 
328
 
 
329
# Besides getting correct dependencies, the explicit rules also tell
 
330
# make that the .s files "ought to exist", so they are preferred over
 
331
# .c files.
 
332
AC_CONFIG_COMMANDS([asm.d],
 
333
    [ for f in $asm_file_list
 
334
      do
 
335
        case $f in
 
336
          *.asm)
 
337
            echo "`basename $f .asm`.s : $f "'$(srcdir)/asm.m4 machine.m4 config.m4'
 
338
            ;;
 
339
        esac
 
340
      done > asm.d
 
341
    ],
 
342
    [ asm_file_list="$asm_file_list" ]
 
343
)
 
344
 
251
345
LSH_CCPIC
252
346
 
253
347
SHLIBCFLAGS="$CCPIC"
254
348
 
 
349
IF_DLL='#'
 
350
LIBNETTLE_FILE_SRC='$(LIBNETTLE_FORLINK)'
 
351
LIBHOGWEED_FILE_SRC='$(LIBHOGWEED_FORLINK)'
 
352
EMULATOR=''
 
353
W64_ABI=no
 
354
 
255
355
case "$host_os" in
256
 
  mingw32*)
257
 
    LIBNETTLE_FORLINK='libnettle-$(LIBNETTLE_MAJOR)-$(LIBNETTLE_MINOR).dll'
 
356
  mingw32*|cygwin*)
 
357
    # The actual DLLs, e.g. libnettle-$major-$minor.dll, are normally
 
358
    # installed into the bin dir (or more exactly $libdir/../bin, for
 
359
    # automake), while libnettle.dll.a, which is a stub file for
 
360
    # linking to the DLL, is installed into the lib dir.
 
361
    case "$host_os" in
 
362
      mingw32*)
 
363
        LIBNETTLE_FORLINK='libnettle-$(LIBNETTLE_MAJOR)-$(LIBNETTLE_MINOR).dll'
 
364
        LIBHOGWEED_FORLINK='libhogweed-$(LIBHOGWEED_MAJOR)-$(LIBHOGWEED_MINOR).dll'
 
365
        ;;
 
366
      cygwin*)
 
367
        LIBNETTLE_FORLINK='cygnettle-$(LIBNETTLE_MAJOR)-$(LIBNETTLE_MINOR).dll'
 
368
        LIBHOGWEED_FORLINK='cyghogweed-$(LIBHOGWEED_MAJOR)-$(LIBHOGWEED_MINOR).dll'
 
369
        ;;
 
370
    esac
 
371
    if test "x$cross_compiling" = xyes ; then
 
372
        case "$ABI" in
 
373
            64)
 
374
                EMULATOR=wine64
 
375
                ;;
 
376
            *)
 
377
                EMULATOR=wine
 
378
                ;;
 
379
        esac
 
380
    fi
 
381
    if test "x$ABI" = x64 ; then
 
382
        W64_ABI=yes
 
383
    fi
258
384
    LIBNETTLE_SONAME=''
259
385
    LIBNETTLE_FILE='libnettle.dll.a'
260
 
    LIBNETTLE_LINK='$(CC) $(LDFLAGS) -shared -Wl,--out-implib=$(LIBNETTLE_FILE) -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive'
 
386
    LIBNETTLE_FILE_SRC='$(LIBNETTLE_FILE)'
 
387
    LIBNETTLE_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,--out-implib=$(LIBNETTLE_FILE) -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive'
261
388
    LIBNETTLE_LIBS='-Wl,--no-whole-archive $(LIBS)'
262
389
 
263
 
    LIBHOGWEED_FORLINK='libhogweed-$(LIBHOGWEED_MAJOR)-$(LIBHOGWEED_MINOR).dll'
264
390
    LIBHOGWEED_SONAME=''
265
391
    LIBHOGWEED_FILE='libhogweed.dll.a'
266
 
    LIBHOGWEED_LINK='$(CC) $(LDFLAGS) -shared -Wl,--out-implib=$(LIBHOGWEED_FILE) -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive'
 
392
    LIBHOGWEED_FILE_SRC='$(LIBHOGWEED_FILE)'
 
393
    LIBHOGWEED_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,--out-implib=$(LIBHOGWEED_FILE) -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive'
267
394
    LIBHOGWEED_LIBS='-Wl,--no-whole-archive $(LIBS) libnettle.dll.a'
268
 
    ;;
269
 
  cygwin*)
270
 
    LIBNETTLE_FORLINK='cygnettle-$(LIBNETTLE_MAJOR)-$(LIBNETTLE_MINOR).dll'
271
 
    LIBNETTLE_SONAME=''
272
 
    LIBNETTLE_FILE='libnettle.dll.a'
273
 
    LIBNETTLE_LINK='$(CC) $(LDFLAGS) -shared -Wl,--out-implib=$(LIBNETTLE_FILE) -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive'
274
 
    LIBNETTLE_LIBS='-Wl,--no-whole-archive $(LIBS)'
275
 
 
276
 
    LIBHOGWEED_FORLINK='cyghogweed-$(LIBHOGWEED_MAJOR)-$(LIBHOGWEED_MINOR).dll'
277
 
    LIBHOGWEED_SONAME=''
278
 
    LIBHOGWEED_FILE='libhogweed.dll.a'
279
 
    LIBHOGWEED_LINK='$(CC) $(LDFLAGS) -shared -Wl,--out-implib=$(LIBHOGWEED_FILE) -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive'
280
 
    LIBHOGWEED_LIBS='-Wl,--no-whole-archive $(LIBS)'
 
395
    IF_DLL=''
281
396
    ;;
282
397
  darwin*)
283
398
    LIBNETTLE_FORLINK=libnettle.dylib
284
 
    LIBNETTLE_SONAME='$(LIBNETTLE_FORLINK).$(LIBNETTLE_MAJOR)'
285
 
    LIBNETTLE_FILE='$(LIBNETTLE_SONAME).$(LIBNETTLE_MINOR)'
286
 
    LIBNETTLE_LINK='$(CC) -dynamiclib $(LDFLAGS)'
 
399
    LIBNETTLE_SONAME='libnettle.$(LIBNETTLE_MAJOR).dylib'
 
400
    LIBNETTLE_FILE='libnettle.$(LIBNETTLE_MAJOR).$(LIBNETTLE_MINOR).dylib'
 
401
    LIBNETTLE_LINK='$(CC) $(CFLAGS) -dynamiclib $(LDFLAGS) -install_name ${libdir}/$(LIBNETTLE_SONAME) -compatibility_version $(LIBNETTLE_MAJOR) -current_version $(LIBNETTLE_MAJOR).$(LIBNETTLE_MINOR)'
287
402
    LIBNETTLE_LIBS=''
288
403
 
289
404
    LIBHOGWEED_FORLINK=libhogweed.dylib
290
 
    LIBHOGWEED_SONAME='$(LIBHOGWEED_FORLINK).$(LIBHOGWEED_MAJOR)'
291
 
    LIBHOGWEED_FILE='$(LIBHOGWEED_SONAME).$(LIBHOGWEED_MINOR)'
292
 
    LIBHOGWEED_LINK='$(CC) -dynamiclib $(LDFLAGS)'
293
 
    LIBHOGWEED_LIBS=''
 
405
    LIBHOGWEED_SONAME='libhogweed.$(LIBHOGWEED_MAJOR).dylib'
 
406
    LIBHOGWEED_FILE='libhogweed.$(LIBHOGWEED_MAJOR).$(LIBHOGWEED_MINOR).dylib'
 
407
    LIBHOGWEED_LINK='$(CC) $(CFLAGS) -dynamiclib -L. $(LDFLAGS) -install_name ${libdir}/$(LIBHOGWEED_SONAME) -compatibility_version $(LIBHOGWEED_MAJOR) -current_version $(LIBHOGWEED_MAJOR).$(LIBHOGWEED_MINOR)'
 
408
    LIBHOGWEED_LIBS='-lnettle -lgmp'
294
409
    ;;
295
410
  solaris*)
296
411
    # Sun's ld uses -h to set the soname, and this option is passed
299
414
    LIBNETTLE_FORLINK=libnettle.so
300
415
    LIBNETTLE_SONAME='$(LIBNETTLE_FORLINK).$(LIBNETTLE_MAJOR)'
301
416
    LIBNETTLE_FILE='$(LIBNETTLE_SONAME).$(LIBNETTLE_MINOR)'
302
 
    LIBNETTLE_LINK='$(CC) $(LDFLAGS) -G -h $(LIBNETTLE_SONAME)'
 
417
    LIBNETTLE_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -G -h $(LIBNETTLE_SONAME)'
303
418
    LIBNETTLE_LIBS=''
304
419
 
305
420
    LIBHOGWEED_FORLINK=libhogweed.so
306
421
    LIBHOGWEED_SONAME='$(LIBHOGWEED_FORLINK).$(LIBHOGWEED_MAJOR)'
307
422
    LIBHOGWEED_FILE='$(LIBHOGWEED_SONAME).$(LIBHOGWEED_MINOR)'
308
 
    LIBHOGWEED_LINK='$(CC) $(LDFLAGS) -L. -G -h $(LIBHOGWEED_SONAME)'
 
423
    LIBHOGWEED_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -L. -G -h $(LIBHOGWEED_SONAME)'
309
424
    LIBHOGWEED_LIBS='-lnettle -lgmp'
310
425
    ;;
311
426
  *)
312
427
    LIBNETTLE_FORLINK=libnettle.so
313
428
    LIBNETTLE_SONAME='$(LIBNETTLE_FORLINK).$(LIBNETTLE_MAJOR)'
314
429
    LIBNETTLE_FILE='$(LIBNETTLE_SONAME).$(LIBNETTLE_MINOR)'
315
 
    LIBNETTLE_LINK='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(LIBNETTLE_SONAME)'
 
430
    LIBNETTLE_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname=$(LIBNETTLE_SONAME)'
316
431
    LIBNETTLE_LIBS=''
317
432
 
318
433
    LIBHOGWEED_FORLINK=libhogweed.so
319
434
    LIBHOGWEED_SONAME='$(LIBHOGWEED_FORLINK).$(LIBHOGWEED_MAJOR)'
320
435
    LIBHOGWEED_FILE='$(LIBHOGWEED_SONAME).$(LIBHOGWEED_MINOR)'
321
 
    LIBHOGWEED_LINK='$(CC) $(LDFLAGS) -L. -shared -Wl,-soname=$(LIBHOGWEED_SONAME)'
 
436
    LIBHOGWEED_LINK='$(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -Wl,-soname=$(LIBHOGWEED_SONAME)'
322
437
    # Requested by debian, to make linking with only -lhogweed work
323
438
    # (does not work in general, e.g., with static linking all of
324
439
    # -lhogweed -lgmp -lnettle are still required). Also makes dlopen
337
452
 
338
453
ASM_SYMBOL_PREFIX=''
339
454
ASM_ELF_STYLE='no'
340
 
ASM_TYPE_FUNCTION=''
 
455
# GNU as default is to use @
 
456
ASM_TYPE_FUNCTION='@function'
 
457
ASM_TYPE_PROGBITS='@progbits'
341
458
ASM_MARK_NOEXEC_STACK=''
342
459
ASM_ALIGN_LOG=''
343
460
 
347
464
  [ # Default is no underscore
348
465
    nettle_cv_asm_underscore=no
349
466
    AC_COMPILE_IFELSE(
350
 
      [int a_global_symbol;],
 
467
      [AC_LANG_SOURCE([int a_global_symbol;])],
351
468
      [ $NM conftest.$OBJEXT >conftest.out
352
469
        if grep _a_global_symbol conftest.out >/dev/null ; then
353
470
          nettle_cv_asm_underscore=yes
361
478
    ASM_SYMBOL_PREFIX='_'
362
479
  fi
363
480
 
364
 
  AC_CACHE_CHECK([if we should use a .note.GNU-stack section],
365
 
  nettle_cv_asm_gnu_stack,
366
 
  [ # Default
367
 
    nettle_cv_asm_gnu_stack=no
368
 
 
369
 
    cat >conftest.c <<EOF
370
 
int foo() { return 0; }
371
 
EOF
372
 
    nettle_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >conftest.out 2>&1"
373
 
    if AC_TRY_EVAL(nettle_compile); then
374
 
      cat conftest.out >&AC_FD_CC
375
 
      $OBJDUMP -x conftest.o | grep '\.note\.GNU-stack' > /dev/null \
376
 
      && nettle_cv_asm_gnu_stack=yes
377
 
    else
378
 
      cat conftest.out >&AC_FD_CC
379
 
      echo "configure: failed program was:" >&AC_FD_CC
380
 
      cat conftest.s >&AC_FD_CC
381
 
    fi
382
 
    rm -f conftest.*])
383
 
  if test x$nettle_cv_asm_gnu_stack = xyes ; then
384
 
    ASM_MARK_NOEXEC_STACK='.section .note.GNU-stack,"",@progbits'
385
 
  fi
386
 
 
387
481
  AC_CACHE_CHECK([for ELF-style .type,%function pseudo-ops],
388
482
    [nettle_cv_asm_type_percent_function],
389
483
    [GMP_TRY_ASSEMBLE([
416
510
  if test x$nettle_cv_asm_type_percent_function = xyes ; then
417
511
    ASM_ELF_STYLE='yes'
418
512
    ASM_TYPE_FUNCTION='%function'
 
513
    ASM_TYPE_PROGBITS='%progbits'
419
514
  else
420
515
    if test x$nettle_cv_asm_type_hash_function = xyes ; then
421
516
      ASM_ELF_STYLE='yes'
422
517
      ASM_TYPE_FUNCTION='#function'
423
 
    fi
424
 
  fi
 
518
      ASM_TYPE_PROGBITS='#progbits'
 
519
    fi
 
520
  fi
 
521
 
 
522
  AC_CACHE_CHECK([if we should use a .note.GNU-stack section],
 
523
  nettle_cv_asm_gnu_stack,
 
524
  [ # Default
 
525
    nettle_cv_asm_gnu_stack=no
 
526
 
 
527
    cat >conftest.c <<EOF
 
528
int foo() { return 0; }
 
529
EOF
 
530
    nettle_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >conftest.out 2>&1"
 
531
    if AC_TRY_EVAL(nettle_compile); then
 
532
      cat conftest.out >&AC_FD_CC
 
533
      $OBJDUMP -x conftest.o | grep '\.note\.GNU-stack' > /dev/null \
 
534
      && nettle_cv_asm_gnu_stack=yes
 
535
    else
 
536
      cat conftest.out >&AC_FD_CC
 
537
      echo "configure: failed program was:" >&AC_FD_CC
 
538
      cat conftest.s >&AC_FD_CC
 
539
    fi
 
540
    rm -f conftest.*])
 
541
  if test x$nettle_cv_asm_gnu_stack = xyes ; then
 
542
    ASM_MARK_NOEXEC_STACK='.section .note.GNU-stack,"",TYPE_PROGBITS'
 
543
  fi
 
544
 
425
545
  AC_CACHE_CHECK([if .align assembly directive is logarithmic],
426
546
    [nettle_cv_asm_align_log],
427
547
    [GMP_TRY_ASSEMBLE([
429
549
],
430
550
       [nettle_cv_asm_align_log=yes],
431
551
       [nettle_cv_asm_align_log=no])])
432
 
  if test x$nettle_cv_asm_align_log = xyes ; then
433
 
    ASM_ALIGN_LOG='yes'
434
 
  fi
 
552
  ASM_ALIGN_LOG="$nettle_cv_asm_align_log"
435
553
fi
436
554
 
437
555
AC_SUBST(ASM_SYMBOL_PREFIX)
438
556
AC_SUBST(ASM_ELF_STYLE)
439
557
AC_SUBST(ASM_TYPE_FUNCTION)
 
558
AC_SUBST(ASM_TYPE_PROGBITS)
440
559
AC_SUBST(ASM_MARK_NOEXEC_STACK)
441
560
AC_SUBST(ASM_ALIGN_LOG)
 
561
AC_SUBST(W64_ABI)
 
562
AC_SUBST(EMULATOR)
442
563
 
443
564
AC_SUBST(SHLIBCFLAGS)
444
565
 
447
568
AC_SUBST(LIBNETTLE_FORLINK)
448
569
AC_SUBST(LIBNETTLE_SONAME)
449
570
AC_SUBST(LIBNETTLE_FILE)
 
571
AC_SUBST(LIBNETTLE_FILE_SRC)
450
572
AC_SUBST(LIBNETTLE_LINK)
451
573
AC_SUBST(LIBNETTLE_LIBS)
452
574
 
455
577
AC_SUBST(LIBHOGWEED_FORLINK)
456
578
AC_SUBST(LIBHOGWEED_SONAME)
457
579
AC_SUBST(LIBHOGWEED_FILE)
 
580
AC_SUBST(LIBHOGWEED_FILE_SRC)
458
581
AC_SUBST(LIBHOGWEED_LINK)
459
582
AC_SUBST(LIBHOGWEED_LIBS)
460
583
 
471
594
AC_TYPE_SIZE_T
472
595
AC_HEADER_TIME
473
596
AC_CHECK_SIZEOF(long)
 
597
AC_CHECK_ALIGNOF(uint64_t)
 
598
 
 
599
ALIGNOF_UINT64_T="$ac_cv_alignof_uint64_t"
 
600
AC_SUBST(ALIGNOF_UINT64_T)
474
601
 
475
602
AC_CHECK_HEADERS([openssl/blowfish.h openssl/des.h openssl/cast.h openssl/aes.h],,
476
603
[enable_openssl=no
523
650
# Add -R flags needed to run programs linked with gmp
524
651
LSH_RPATH_FIX
525
652
 
 
653
# Check for gmp limb size
 
654
nettle_cv_gmp_numb_bits=0
 
655
if test "$enable_public_key" = yes; then
 
656
  AC_MSG_CHECKING([for GMP limb size])
 
657
  AC_COMPUTE_INT(nettle_cv_gmp_numb_bits, [GMP_NUMB_BITS],
 
658
      [#include <gmp.h>],
 
659
      [AC_MSG_FAILURE([cannot find value of GMP_NUMB_BITS])])
 
660
 
 
661
  AC_MSG_RESULT([$nettle_cv_gmp_numb_bits bits])
 
662
fi
 
663
 
 
664
GMP_NUMB_BITS="$nettle_cv_gmp_numb_bits"
 
665
AC_SUBST([GMP_NUMB_BITS])
 
666
 
526
667
AH_TEMPLATE([HAVE_MPZ_POWM_SEC], [Define if mpz_powm_sec is available (appeared in GMP-5)])
527
668
AC_CHECK_FUNC(__gmpz_powm_sec, [AC_DEFINE(HAVE_MPZ_POWM_SEC)])
528
669
 
535
676
  IF_HOGWEED='#'
536
677
fi
537
678
 
 
679
if test "x$enable_static" = xyes ; then
 
680
  IF_STATIC=''
 
681
else
 
682
  IF_STATIC='#'
 
683
fi
 
684
 
538
685
if test "x$enable_shared" = xyes ; then
539
686
  IF_SHARED=''
540
687
else
541
688
  IF_SHARED='#'
542
689
fi
543
690
 
 
691
# Documentation tools
 
692
if test "x$enable_documentation" != "xno"; then
 
693
  AC_PATH_PROG(MAKEINFO, makeinfo, not-found)
 
694
 
 
695
  if test "x$MAKEINFO" != "xnot-found"; then
 
696
    enable_documentation=yes
 
697
    AC_SUBST(MAKEINFO)
 
698
  else
 
699
    if test "x$enable_documentation" == "xauto" ; then
 
700
      enable_documentation=no
 
701
    else
 
702
      AC_MSG_ERROR([Cannot find 'makeinfo', required for documentation.])
 
703
    fi
 
704
  fi
 
705
fi
 
706
 
 
707
if test "x$enable_documentation" = "xyes" ; then
 
708
  IF_DOCUMENTATION=''
 
709
else
 
710
  IF_DOCUMENTATION='#'
 
711
fi
 
712
 
544
713
AC_SUBST(IF_HOGWEED)
 
714
AC_SUBST(IF_STATIC)
545
715
AC_SUBST(IF_SHARED)
 
716
AC_SUBST(IF_DOCUMENTATION)
 
717
AC_SUBST(IF_DLL)
546
718
 
547
719
OPENSSL_LIBFLAGS=''
548
720
 
554
726
fi
555
727
 
556
728
AH_TEMPLATE([WITH_OPENSSL],
557
 
            [Define if you have openssl's libcrypto (used for benchmarking)])
 
729
            [Define if you have openssl's libcrypto (used for benchmarking)]) dnl'
558
730
 
559
731
if test x$enable_openssl = xyes ; then
560
732
  AC_DEFINE(WITH_OPENSSL)
562
734
 
563
735
AC_SUBST(OPENSSL_LIBFLAGS)
564
736
 
565
 
# Choose strategy for Camellia round
566
737
AH_BOTTOM(
567
 
[/* Needs include of <limits.h> before use. */
568
 
#define HAVE_NATIVE_64_BIT (SIZEOF_LONG * CHAR_BIT >= 64)
 
738
[#if defined(__x86_64__) || defined(__arch64__)
 
739
# define HAVE_NATIVE_64_BIT 1
 
740
#else
 
741
/* Needs include of <limits.h> before use. */
 
742
# define HAVE_NATIVE_64_BIT (SIZEOF_LONG * CHAR_BIT >= 64)
 
743
#endif
569
744
])
570
745
 
571
746
# clock_gettime is in librt on *-*-osf5.1 and on glibc, so add -lrt to
575
750
 
576
751
old_LIBS="$LIBS"
577
752
AC_SEARCH_LIBS(clock_gettime, rt, [
578
 
  AC_DEFINE([HAVE_CLOCK_GETTIME],1,[Define to 1 if you have the `clock_gettime' function])])
 
753
  AC_DEFINE([HAVE_CLOCK_GETTIME],1,[Define if clock_gettime is available])])
579
754
BENCH_LIBS="$LIBS"
580
755
LIBS="$old_LIBS"
581
756
 
619
794
  Install prefix:    ${prefix}
620
795
  Library directory: ${libdir}
621
796
  Compiler:          ${CC}
 
797
  Static libraries:  ${enable_static}
622
798
  Shared libraries:  ${enable_shared}
623
799
  Public key crypto: ${enable_public_key}
 
800
  Documentation:     ${enable_documentation}
624
801
])