move Android build config into core tor
Guardian Project has maintained a wrapper build system for building tor for Android since the beginning. Since many more people are now building tor for Android, I'm working to upstream as much of that as possible. The goal is that the requirements for building on Android can be fulfilled by tor's own configure.ac.
The first change is to remove the unnecessary ./configure --enable-android
option.
- Android NDK compilers define
__ANDROID__
so that can be used for Android-only code without adding anything in configure.ac, (following the standard pattern like__APPLE__
,__linux__
,__FreeBSD__
,_WIN32
, etc. -
android/log.h and
__android_log_write()
are always present if building for Android, so this would be like testing forprintf()
on UNIX.
Then move the Android config into configure.ac reusing the ./configure --enable-android
flag. A working sketch for that is here:
https://trac.torproject.org/projects/tor/ticket/28766#comment:6
The last piece is including a Java JNI wrapper in tor, enabled by ./configure --enable-jni
. This lets us run tor as an Android Service
, which is the Android equivalent of a UNIX daemon (UNIX daemons are not really supported on Android and using them is quite problematic). This JNI API should be generic enough to be useable in Java in general, though that's not a priority for us.
I'll add patches for merging once we agree on these details. I have this all working already on my machine.