Skip to content

Commit

Permalink
configure.ac, common/common.c: search_paths[]: introduce MULTIARCH_TA…
Browse files Browse the repository at this point in the history
…RGET_ALIAS as/if suggested by compiler [networkupstools#317]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Sep 30, 2023
1 parent 4e893fe commit 501aaa5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,19 @@ static const char * search_paths[] = {
LIBDIR,
"/usr"LIBDIR, /* Note: this can lead to bogus strings like */
"/usr/local"LIBDIR, /* "/usr/usr/lib" which would be ignored quickly */
/* TOTHINK: Should AUTOTOOLS_* specs also be highly preferred?
* Currently they are listed after the "legacy" hard-coded paths...
*/
#ifdef MULTIARCH_TARGET_ALIAS
# ifdef BUILD_64
"/usr/lib/64/" MULTIARCH_TARGET_ALIAS,
"/usr/lib64/" MULTIARCH_TARGET_ALIAS,
"/lib/64/" MULTIARCH_TARGET_ALIAS,
"/lib64/" MULTIARCH_TARGET_ALIAS,
# endif /* MULTIARCH_TARGET_ALIAS && BUILD_64 */
"/usr/lib/" MULTIARCH_TARGET_ALIAS,
"/lib/" MULTIARCH_TARGET_ALIAS,
#endif /* MULTIARCH_TARGET_ALIAS */
#ifdef BUILD_64
/* Fall back to explicit preference of 64-bit paths as named on some OSes */
"/usr/lib/64",
Expand Down
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3860,6 +3860,14 @@ if test -n "${target_cpu}" -a -n "${target_os}" ; then
NUT_REPORT_TARGET(AUTOTOOLS_TARGET_SHORT_ALIAS, "${target_cpu}-${target_os}", [host OS short spec we built for])
fi

AC_MSG_CHECKING([whether compiler suggests a MULTIARCH value])
dnl Recent GCC generally supports this call, although it often returns empty
dnl Some versions of CLANG also have it, others reject the unknown CLI switch
compiler_multiarch="`${CC} -print-multiarch 2>/dev/null`" || compiler_multiarch=""
if test -n "${compiler_multiarch}" ; then
NUT_REPORT_TARGET(MULTIARCH_TARGET_ALIAS, "${compiler_multiarch}", [host multiarch spec we build for (as suggested by compiler being used)])
fi

dnl ----------------------------------------------------------------------
dnl Check the user and group to run as last, so we can use the paths configured
dnl above as data sources for default values if building an in-place replacement
Expand Down

0 comments on commit 501aaa5

Please sign in to comment.