Skip to content

Commit a114289

Browse files
drafnelgitster
authored andcommitted
configure.ac: rework/fix the NEEDS_RESOLV and NEEDS_LIBGEN tests
The "action" parameters for these two tests were supplied incorrectly for the way the tests were implemented. The tests check whether a program which calls hstrerror() or basename() successfully links when -lresolv or -lgen are used, respectively. A successful linking would result in NEEDS_RESOLV or NEEDS_LIBGEN being unset, and failure would result in setting the respective variable. Aside from that issue, the tests did not handle the case where neither library was necessary for accessing the functions in question. So solve both of these issues by re-working the two tests so that their form is like the NEEDS_SOCKET test which attempts to link with just the c library, and if it fails then assumes that the additional library is necessary and sets the appropriate variable. Also an entry in the config.mak.in file is necessary for the NEEDS_LIBGEN variable to appear in the config.mak.autogen file with the value assigned by the configure script. Without it, the generated shell script would contain a snippet like this: for ac_lib in ; do ... which is incorrect. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 248b6c0 commit a114289

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

config.mak.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ NO_LIBGEN_H=@NO_LIBGEN_H@
3434
NEEDS_LIBICONV=@NEEDS_LIBICONV@
3535
NEEDS_SOCKET=@NEEDS_SOCKET@
3636
NEEDS_RESOLV=@NEEDS_RESOLV@
37+
NEEDS_LIBGEN=@NEEDS_LIBGEN@
3738
NO_SYS_SELECT_H=@NO_SYS_SELECT_H@
3839
NO_D_INO_IN_DIRENT=@NO_D_INO_IN_DIRENT@
3940
NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,13 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
479479
# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
480480
# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
481481
# inet_ntop and inet_pton additionally reside there.
482-
AC_CHECK_LIB([resolv], [hstrerror],
482+
AC_CHECK_LIB([c], [hstrerror],
483483
[NEEDS_RESOLV=],
484484
[NEEDS_RESOLV=YesPlease])
485485
AC_SUBST(NEEDS_RESOLV)
486486
test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
487487

488-
AC_CHECK_LIB([gen], [basename],
488+
AC_CHECK_LIB([c], [basename],
489489
[NEEDS_LIBGEN=],
490490
[NEEDS_LIBGEN=YesPlease])
491491
AC_SUBST(NEEDS_LIBGEN)

0 commit comments

Comments
 (0)