configure.py 763 B

12345678910111213141516171819202122232425262728293031
  1. #! /usr/bin/env python
  2. import os
  3. CFLAGS = []
  4. OSX_LDFLAGS = "-bundle -undefined suppress -flat_namespace"
  5. def we_have_sse():
  6. try: return 'sse' in open ('/proc/cpuinfo').read().split()
  7. except: return 0
  8. def we_have_ssse3():
  9. try: return 'ssse3' in open ('/proc/cpuinfo').read().split()
  10. except: return 0
  11. def we_think_so_different_dude():
  12. try: return 'Darwin' == os.popen ('uname -s').read().strip()
  13. except: return 0
  14. def store():
  15. f = open ('defines.make', 'w')
  16. f.write ("_CFLAGS=" + ' '.join (CFLAGS) + "\n")
  17. if we_think_so_different_dude():
  18. f.write ("_LDFLAGS=" + OSX_LDFLAGS + "\n")
  19. f.write ("STRIP = echo\n")
  20. if __name__ == '__main__':
  21. if we_have_sse():
  22. CFLAGS += ('-msse', '-mfpmath=sse')
  23. if we_have_ssse3():
  24. CFLAGS += ('-msse3',)
  25. store()