[LLVMdev] Linking Clang with an optional external library

Duncan Sands baldrick at free.fr
Wed Nov 14 00:39:02 PST 2012


Hi Ryan,

> I'd like to link Clang against the STP theorem prover.

why?  If it's because you want to load a plugin that uses STP, why not link the
plugin itself against STP?

Ciao, Duncan.

  Since Clang is built by the LLVM build system, I hope this is the correct 
place to ask for advice.
>
> The attached patch allows me to pass `configure` a --with-stp option and provide a path to the install prefix for STP. However, I am not familiar with autoconf, so I am not confident that my changes are the correct way to do this. I would appreciate feedback on the proposed change.
>
>
>
>
>
> Besides the configure.ac changes in the patch, I am unsure of the appropriate place to add the linker flag. Currently I am simply appending to LDFLAGS in Clang's tools/driver/Makefile:
>
> +ifdef STP_INSTALL_PREFIX
> +LDFLAGS += -L$(STP_INSTALL_PREFIX)/lib -lstp
> +endif
>
>
> To support CMake builds as well, is it sufficient to add the following to config.h.cmake, and expect the user to pass -DWITH_STP_PREFIX= if they would like to use this feature?
>
> #cmakedefine STP_C_INTERFACE ${WITH_STP_PREFIX}/include/stp/c_interface.h
>
>
> One potential issue I noticed in writing this patch is that LLVM's config.h and Clang's config.h are both #include-guarded by the CONFIG_H macro, and consequently both cannot be included from the same source file. Perhaps these should be changed to LLVM_CONFIG_H and CLANG_CONFIG_H, respectively?
>
>
> Thanks,
> Ryan
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list