Fix build when building on OSX, using non standard libssl, and a non standard version of clang/gcc (or a < OSX 10.9 version of clang/gcc)

--sysroot (only passed under the above conditions) appears to take precedence over -L if listed before it, so the standard library check functions have to use CPPFLAGS to specify library search directories (as CPPFLAGS appear earliest in the CC invocation), so they're used in preference to the default <sysroot>/lib <sysroot>/usr/lib.

The --sysroot problem is especially bad because the search path GCC uses for includes starts with /usr/local/include and the one the apple linker users is /usr/lib, which means, by default, any libraries installed in /usr/local which are also bundled with OSX, have their headers taken from /usr/local/include but are linked from /usr/lib, and any header/library version checks fail... or the compiler emits code which may be incompatible with the linked libraries ABI and bad things happen.
FR_SMART_CHECK_LIB now sets smart_lib and smart_ldflags, this is important for controlling search path ordering

Change default search path of Apple's LD to more match the Linux LD, this fixes some issues where bundled libraries would be used with user installed headers