1

It is possible to get gcc configure options with gcc -v (an example is here). Is there a similar way to retrieve the compilation options of clang?

My real task is the following one: I have an environment with a compiler (clang) which I want to improve. Now I have some patch for clang that I applied and I want to rebuild the patched sources, but I also want to be sure that nothing changes from the vanilla build apart from my patch; in particular, that all the build flags I use are the same.

Community
  • 1
  • 1
gluk47
  • 1,812
  • 20
  • 31

1 Answers1

1

No, probably not. But it's possible to get the CXXFLAGS/LDFLAGS clang was compiled with via llvm-config.

$ llvm-config --cxxflags
-I/opt/compiler/llvm-trunk/include -march=native  -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -ffunction-sections -fdata-sections -O3 -DNDEBUG  -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS

$ llvm-config --ldflags
-L/opt/compiler/llvm-trunk/lib

$ llvm-config --system-libs
-lrt -ldl -lcurses -latomic -lpthread -lz -lm

If you are on a Linux distribution, then simply check the PKGBUILD (or similar) to find the exact flags.

Thomas
  • 3,074
  • 1
  • 25
  • 39
  • Yeah, I'm on a linux distribution, but the environment I modify is a custom-built one, so not PKGBUILD is available and I found no build script for that prebuilt clang so far. – gluk47 Jul 14 '15 at 17:40
  • @gluk47: Usually `./configure --enable-optimized --disable-assertions --path=<...>` is all you need. – Thomas Jul 14 '15 at 17:42