Skip to content

Commit

Permalink
buildsys: allow overriding Julia config via env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Oct 28, 2024
1 parent 2664be8 commit 0ad09af
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -793,30 +793,40 @@ AS_IF([test "x$with_julia" != xno ],[
AS_IF([test "x$JULIA" = x],[ AC_MSG_ERROR([no julia executable found]) ])
AC_MSG_CHECKING([for Julia version])
JULIA_VERSION=$(${JULIA} --startup-file=no -e 'print("$(VERSION.major).$(VERSION.minor)")')
AS_IF([ test $? != 0 ], [AC_MSG_ERROR([failed to obtain Julia version])])
AS_IF([test "x$JULIA_VERSION" = x],[
JULIA_VERSION=$(${JULIA} --startup-file=no -e 'print("$(VERSION.major).$(VERSION.minor)")')
AS_IF([ test $? != 0 ], [AC_MSG_ERROR([failed to obtain Julia version])])
])
AC_MSG_RESULT([${JULIA_VERSION}])
JL_SHARE=$($JULIA --startup-file=no -e 'print(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia"))')
AS_IF([test -f "${JL_SHARE}/julia-config.jl"], [], [AC_MSG_ERROR([no julia-config.jl found])])
AC_MSG_CHECKING([for JULIA_CFLAGS])
JULIA_CFLAGS=$(${JULIA} --startup-file=no ${JL_SHARE}/julia-config.jl --cflags 2>/dev/null)
JULIA_CFLAGS=${JULIA_CFLAGS/-std=gnu99/} # need to remove -std=gnu99 for our C11 and C++ code
AS_IF([ test $? != 0 ], [AC_MSG_ERROR([failed to obtain JULIA_CFLAGS from julia-config.jl])])
AS_IF([test "x$JULIA_CFLAGS" = x],[
AS_IF([test -f "${JL_SHARE}/julia-config.jl"], [], [AC_MSG_ERROR([no julia-config.jl found])])
JULIA_CFLAGS=$(${JULIA} --startup-file=no ${JL_SHARE}/julia-config.jl --cflags 2>/dev/null)
JULIA_CFLAGS=${JULIA_CFLAGS/-std=gnu99/} # need to remove -std=gnu99 for our C11 and C++ code
AS_IF([ test $? != 0 ], [AC_MSG_ERROR([failed to obtain JULIA_CFLAGS from julia-config.jl])])
])
AC_MSG_RESULT([${JULIA_CFLAGS}])
AC_MSG_CHECKING([for JULIA_LDFLAGS])
JULIA_LDFLAGS=$(${JULIA} --startup-file=no ${JL_SHARE}/julia-config.jl --ldflags)
AS_IF([ test $? != 0 ], [AC_MSG_ERROR([failed to obtain JULIA_LDFLAGS from julia-config.jl])])
JULIA_LDFLAGS=${JULIA_LDFLAGS//\'/}
AS_IF([test "x$JULIA_LDFLAGS" = x],[
AS_IF([test -f "${JL_SHARE}/julia-config.jl"], [], [AC_MSG_ERROR([no julia-config.jl found])])
JULIA_LDFLAGS=$(${JULIA} --startup-file=no ${JL_SHARE}/julia-config.jl --ldflags)
AS_IF([ test $? != 0 ], [AC_MSG_ERROR([failed to obtain JULIA_LDFLAGS from julia-config.jl])])
JULIA_LDFLAGS=${JULIA_LDFLAGS//\'/}
])
AC_MSG_RESULT([${JULIA_LDFLAGS}])
AC_MSG_CHECKING([for JULIA_LIBS])
JULIA_LIBS=$(${JULIA} --startup-file=no ${JL_SHARE}/julia-config.jl --ldlibs)
AS_IF([ test $? != 0 ], [AC_MSG_ERROR([failed to obtain JULIA_LIBS from julia-config.jl])])
# remove apostrophes, they confuse libtool in some cases.
JULIA_LIBS=${JULIA_LIBS//\'/}
AS_IF([test "x$JULIA_LIBS" = x],[
AS_IF([test -f "${JL_SHARE}/julia-config.jl"], [], [AC_MSG_ERROR([no julia-config.jl found])])
JULIA_LIBS=$(${JULIA} --startup-file=no ${JL_SHARE}/julia-config.jl --ldlibs)
AS_IF([ test $? != 0 ], [AC_MSG_ERROR([failed to obtain JULIA_LIBS from julia-config.jl])])
# remove apostrophes, they confuse libtool in some cases.
JULIA_LIBS=${JULIA_LIBS//\'/}
])
AC_MSG_RESULT([${JULIA_LIBS}])
],
[
Expand Down

0 comments on commit 0ad09af

Please sign in to comment.