# Proposal to make functions in \`julia-config.jl\` and \`build\_sysimg.jl\` reusable

**URL:** <https://discourse.julialang.org/t/proposal-to-make-functions-in-julia-config-jl-and-build-sysimg-jl-reusable/8578>\
**Category:** Internals & Design\
**Tags:** proposal\
**Created:** [January 24, 2018, 10:51pm UTC](https://discourse.julialang.org/t/proposal-to-make-functions-in-julia-config-jl-and-build-sysimg-jl-reusable/8578 "2018-01-24T22:51:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucatrv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lucatrv/32/5650_2.png) [@lucatrv](https://discourse.julialang.org/u/lucatrv)\
**Post date:** [January 24, 2018, 10:51pm UTC](https://discourse.julialang.org/t/proposal-to-make-functions-in-julia-config-jl-and-build-sysimg-jl-reusable/8578/1 "2018-01-24T22:51:39Z")

</div>

It would be useful to make some of the functions in `julia-config.jl` and `build_sysimg.jl` accessible and reusable by other scripts.

Some functions are for instance currently used by `juliac.jl` (see [static-julia](https://github.com/JuliaComputing/static-julia), which I am contributing to), but awkward code is needed to access them from outside the original scripts:

```julia
command = `$(Base.julia_cmd()) --startup-file=no $(joinpath(dirname(JULIA_HOME), "share", "julia", "julia-config.jl"))`
cflags = Base.shell_split(readstring(`$command --cflags`))
ldflags = Base.shell_split(readstring(`$command --ldflags`))
ldlibs = Base.shell_split(readstring(`$command --ldlibs`))

```

Here is in my opinion the list of functions in `julia-config.jl` and `build_sysimg.jl` which should be made reusable (maybe there are others as well):

- cflags
- ldflags
- ldlibs
- allflags
- find\_system\_compiler

I would like to ask your opinion on this, and if you agree to ask suggestions on the best approach to follow. At present I would think to include them in a separate module (for instance `BuildTools.jl`), and then to make `julia-config.jl` and `build_sysimg.jl` (as well as other scripts such as `juliac.jl`) use that module. Moreover, as discussed [here](https://github.com/JuliaLang/julia/pull/24427), `julia-config.jl` could be better renamed `build_config.jl`. In future, once `juliac.jl` is finalized, maybe also its main function `julia_compile` could be added to `BuildTools.jl`, so that it could be accessed and used programmatically by other scripts.
