Fix string split when last part is shorter than delimiter

Summary: The bug is when ignoreEmpty is true, we use the wrong token size, which will be 0 when last token is shorter than delimiter.

Test Plan:
1. Add unit test
2. fbconfig -r folly && fbmake runtests

Reviewed By: philipp@fb.com

Subscribers: maxime, xiaol

FB internal diff: D1415803
(wangle) s/FutureObject/detail::State/

Summary:
codemod
I never was satisfied with this name. `State` feels a little better. More descriptive. But still pretty generic, so I'm open to alternative ideas.

Test Plan: It still builds and tests pass.

Reviewed By: hannesr@fb.com

Subscribers: jsedgwick, net-systems@, fugalh, exa

FB internal diff: D1411506
(wangle) s/continuation_/callback/ (missed some)

Summary: In the spirit of D1406753

Test Plan: still builds and tests pass

Reviewed By: hannesr@fb.com

Subscribers: jsedgwick, net-systems@, fugalh, exa

FB internal diff: D1412002
s/setCallback_/setCallback/ for detail::State

Summary: This isn't really an internal-to-this-class method. :-/

Test Plan: builds

Reviewed By: hannesr@fb.com

Subscribers: jsedgwick, net-systems@, fugalh, exa

FB internal diff: D1412008
folly: StringPiece: add skipWhitespace

Test Plan: copied from folly::json

Reviewed By: philipp@fb.com, soren@fb.com

FB internal diff: D1417992

Tasks: 4527315
(Folly/FBString) Enum class for category

Summary: Suggested by @aalexandre.

Test Plan: Compile.

Reviewed By: andrei.alexandrescu@fb.com

Subscribers: folly@lists, njormrod, aalexandre

FB internal diff: D1246180
(wangle) Future/Promise detachment

Summary:
Bring a bit more sanity to the lifetime. Now Future and Promise detach by calling the respective methods on State, and they do it during their destruction only. State manages its own lifetime.

Besides being cleaner, this also sets the stage for cancellation (where we'll need Future to hang on to its reference to State after setting the callback), and for folding in Later (we will have a bool for whether the future is hot and hold off executing the callback if it isn't).

Also cleans up various things I noticed while auditing the code for usages of `state_`.

Test Plan:
All the unit tests still pass.
Ran with ASAN (and found I had introduced a bug, then fixed it. yay)

Reviewed By: hannesr@fb.com

Subscribers: jsedgwick, net-systems@, fugalh, exa

FB internal diff: D1412038

Tasks: 4618297
(wangle) cold via

Summary:
Instead of returning a Later, `via` returns a cold future.
This works without keeping a backreference like Later does, because an inactive Future will always activate on destruction. Alternatively we could have an extra Promise, a la Later, and pass that along like Later does, and require launch() at the end (though, implicit launching on destruction would be an option there too).

If you think this approach is viable I'll clean it up on Wednesday: make sure all the calling sites work, etc.

Test Plan:
new unit test
This may fail in contbuild, I haven't done the codemod for calling sites, if there are any.

Reviewed By: hannesr@fb.com

Subscribers: jsedgwick, net-systems@, fugalh, exa

FB internal diff: D1412499

Tasks: 4480567
gflags now likes namespace gflags, not google

Summary:
Use namespace gflags going forward, import namespace google into it if
backward.

Also added a few "checking for..." messages in autoconf.

Test Plan: fbconfig -r folly && fbmake runtests_opt, OSS build

Reviewed By: meyering@fb.com

Subscribers: fjargsto, ntv, jhj, lesha, kma, davejwatson

FB internal diff: D1420575
fix Makefile.am

Summary: wangle/detail.h -> wangle/detail/State.h

Test Plan: OSS build

Reviewed By: meyering@fb.com

Subscribers: fugalh, lesha

FB internal diff: D1421490
Depend on a system-provided google-gtest library
Add packaging/, that allows for a folly SRPM to be created

The SRPM can be built, as long as the double-converion-devel RPM is
installed. The change include a spec file for the SRPM, and a bash
script that can run on a Fedora-system to generate the srpm in
a user-provided directory.

For example:

    ./packaging/build-srpm -o .

Will generate an SRPM in the local directory, for example:

    folly-2014.01.17.092909.gitfc78584-1.fc19.src.rpm