jedisct1/libsodium — pull request #135 by ignisf (2014-04-20 16:00:01+00:00)
Title: Introduce a --disable-sse switch

Attempting to compile the library on a MIPS-based system causes the build to fail with the following message:

```
CC crypto_pwhash/scryptxsalsa208sha256/sse/libsodium_la-pwhash_scryptxsalsa208sha256.lo
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:31:23: error: emmintrin.h: No such file or directory
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:105: warning: type defaults to 'int' in declaration of '__m128i'
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:105: error: expected ';', ',' or ')' before '*' token
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:156: warning: type defaults to 'int' in declaration of '__m128i'
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:156: error: expected ';', ',' or ')' before '*' token
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c: In function 'smix':
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:226: error: '__m128i' undeclared (first use in this function)
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:226: error: (Each undeclared identifier is reported only once
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:226: error: for each function it appears in.)
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:226: error: 'X' undeclared (first use in this function)
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:226: error: expected expression before ')' token
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:244: error: 'Y' undeclared (first use in this function)
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:244: error: expected expression before ')' token
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:245: warning: implicit declaration of function 'blockmix_salsa8'
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:249: error: expected expression before ')' token
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:255: error: expected expression before ')' token
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:260: error: expected expression before ')' token
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:264: error: expected expression before ')' token
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:271: error: 'V_j' undeclared (first use in this function)
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:271: error: expected expression before ')' token
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:275: warning: implicit declaration of function 'blockmix_salsa8_xor'
crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c:276: error: expected expression before ')' token
*** Error code 1
```

Introducing a `--disable-sse` flag and not compiling `scryptxsalsa208sha256/sse/libsodium_la-pwhash_scryptxsalsa208sha256` when it is set is a workaround for the issue (at least until CPU detection is introduced in the build scripts).

As a side note, all the tests fail with an `exec: x: Exec format error` when built with `make check`. For some reason they are getting compiled as shared objects but I haven't been able to track down why. They run fine when built manually.