timmerk / nfc-tools

Automatically exported from code.google.com/p/nfc-tools
0 stars 0 forks source link

Get configure running on MacOS X #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Attached is a patch to get nfc-tools configuring on OS X. I haven't tried 
actually running any code yet, I'll get there soon.

I had to use Macports autotools to get it going - there are problems with 
the pkg config check macro on the Xcode provided ones, so putting Macports 
path first is required,
i.e
export PATH=/opt/local/bin:$PATH
./configure

Original issue reported on code.google.com by MathewMc...@gmail.com on 25 Mar 2010 at 2:04

Attachments:

GoogleCodeExporter commented 9 years ago
This is on the desfire branch, hence the change in reference from -lssl to 
-lcrypto. 
I'm guessing using -lssl gives an implicit -lcrypto on other systems, but not 
OS X.

Original comment by MathewMc...@gmail.com on 25 Mar 2010 at 2:08

GoogleCodeExporter commented 9 years ago

Original comment by romu...@libnfc.org on 31 Mar 2010 at 9:36

GoogleCodeExporter commented 9 years ago
Hey Matt'

I would like to have a complete fix to commit rather than pushing pacthes for 
configure, and then Makefiles, and the C code :-).

The machine/endian.h detection leads me to think that apple systems do not ship 
with either endian.h or sys/endian.h, right ?  I don't have a mac so I can't 
check... 
I found this:
http://fxr.watson.org/fxr/source/bsd/machine/endian.h?v=xnu-1456.1.26

If it is basically what you have, I guess some more code like the follwoing 
will be required in files using endianess functions (welcome in the GNU 
autohell):

#if defined(HAVE_MACHINE_ENDIAN_H)
#  define _DARWIN_C_SOURCE
#  include <machine/endian.h>
#endif

Regarding -lssl vs. -lcrypto, I am not sure about what you say.  Fox example, 
-lcrypto brings you some DES functions that are part of the Kernel on FreeBSD 
and -
lssl brings you functions from OpenSSL.  libssl is linked against libcrypto on 
FreeBSD, so I guess that a-lcrypto is not required here, but in your patch you 
removed 
this and replace it by a check fro libcrypto.  This will not be enough on many 
systems.  Did you want to add a line to link explicitely to libcrypto?

Thanks!
Romain 

Original comment by romain.t...@gmail.com on 15 Apr 2010 at 10:32

GoogleCodeExporter commented 9 years ago
Romain,
its true that OS X doesn't ship with any GNU endian functions (i.e htole32) , 
but CoreFoundation (part of OS X 
and open source) has some. Here is how I've modified freefare_internal.h

#if defined(HAVE_BYTESWAP_H)
#include <byteswap.h>
#if !defined(le32toh) || !defined(htole32)
  #if BYTE_ORDER == LITTLE_ENDIAN
    #define le32toh(x) (x)
    #define htole32(x) bswap_32(x)
  #else
    #define le32toh(x) bswap_32(x)
    #define htole32(x) (x)
  #endif
#endif
#elif defined(HAVE_COREFOUNDATION_COREFOUNDATION_H)
#include <CoreFoundation/CoreFoundation.h>
#define htole32(x) CFSwapInt32HostToLittle(x)
#define le32toh(x) CFSwapInt32LittleToHost(x)
#endif

I think -lcrypto on OS X is part of OpenSSL (it has the same version number in 
the file name). -lssl on its own 
did not work. Maybe we should just -l both?

I'll send you my work on DESfire soon - I have create/delete/read/write for 
basic files so far.

Original comment by MathewMc...@gmail.com on 15 Apr 2010 at 11:22

GoogleCodeExporter commented 9 years ago
I haven't worked on libfreefare for a few weeks (low priority), but I've 
checked out 
the latest branch head and created a proper configure.ac patch

As well as the CoreFoundation based byte swap.

Original comment by MathewMc...@gmail.com on 4 May 2010 at 9:53

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by romu...@libnfc.org on 12 Aug 2010 at 1:08

GoogleCodeExporter commented 9 years ago
I'll take it!

Original comment by romain.t...@gmail.com on 4 Sep 2010 at 9:18

GoogleCodeExporter commented 9 years ago
r577 should fix the issue.  Can you please give it a try and report any success 
/ failure ?

Thanks!

Original comment by romain.t...@gmail.com on 4 Sep 2010 at 11:08

GoogleCodeExporter commented 9 years ago
Considered as fixed since there is no news since Apr 15, 2010.

Original comment by romu...@libnfc.org on 28 Jun 2011 at 6:47

GoogleCodeExporter commented 9 years ago
Tried to compile libfreefare. Fails to find libnfc despite it being installed.

Original comment by yzuker...@gmail.com on 8 Sep 2011 at 3:25