Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

FFTW3 configure script for Android

By: mpoullet on Sep 5th, 2011  |  syntax: Bash  |  size: 2.49 KB  |  views: 786  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/sh
  2. # Taken from:
  3. # http://warpedtimes.wordpress.com/2010/02/03/building-open-source-libraries-with-android-ndk/
  4.  
  5. # -host=arm-eabi: This tells the configure script if the cross compilation is being done or not. It is also used as a prefix to some of the cross compiler tools like strip, nm etc.
  6. # CC=arm-eabi-gcc: This tells which compiler should be used for building.
  7. # CPPFLAGS: This tells the location where the header files should be searched which were specified in configure.ac with AC_CHECK_HEADER macro.
  8. # CFLAGS="-nostdlib" passes the option to build some test programs during configure process run.
  9. #  If you don’t pass this the compiler would link the standard C library of the host system which wouldn’t be compatible with the C library of the target system.
  10. # LIBS="-lc": This option tells that it should explicitly link to a library called libc.so which is present in the location specified using the -L in the LDFLAGS option.
  11. #  If you are wondering that usually to build a C executable one doesn’t need to provide -lc as libc is automatically linked, then why do we need to specify this here?
  12. #  The answer lies in -nostdlib flag, which instructs not to link with the standard C library on the build system.
  13. # LDFLAGS: This option is also passed to build some test programs during configure process run.
  14. #  If you don’t pass the -Wl,-rpath-link option, then linker does not know where do the libraries dependent on the library specific using LIBS reside.
  15. #  If you don’t pass the -L option then the linker doesn’t know where do the libraries specified in LIBS reside.
  16.  
  17. # Debugging
  18. # set -x
  19.  
  20. # Cleanup previous configuration
  21. if [ -f Makefile ]; then
  22. make distclean
  23. fi
  24.  
  25. # Set this to your NDK location
  26. export ANDROID_NDK_ROOT=~/android-ndk
  27.  
  28. # See: http://developer.android.com/guide/appendix/api-levels.html
  29. export ANDROID_API_LEVEL="android-8"
  30.  
  31. # Run configure script
  32. export PATH=$ANDROID_NDK_ROOT/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin:$PATH
  33. ./configure -host=arm-eabi \
  34.             CC=arm-eabi-gcc \
  35.             CPPFLAGS="-I$ANDROID_NDK_ROOT/platforms/$ANDROID_API_LEVEL/arch-arm/usr/include/" \
  36.             CFLAGS="-nostdlib" \
  37.             LDFLAGS="-Wl,-rpath-link=$ANDROID_NDK_ROOT/platforms/$ANDROID_API_LEVEL/arch-arm/usr/lib/ -L$ANDROID_NDK_ROOT/platforms/$ANDROID_API_LEVEL/arch-arm/usr/lib/" \
  38.             LIBS="-lc" \
  39.             --disable-fortran \
  40.             --disable-alloca
  41.  
  42. mv config.h config.h.android
  43. make distclean
  44. mv config.h.android config.h