Skip to content

Commit 5fe9cd0

Browse files
committed
Merge branch 'ds/autoconf'
* ds/autoconf: autoconf: Add link tests to each AC_CHECK_FUNC() test
2 parents 1e2bba9 + 1689c5d commit 5fe9cd0

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

configure.ac

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,17 @@ else \
6565
fi \
6666
])# GIT_PARSE_WITH
6767

68-
68+
dnl
69+
dnl GIT_CHECK_FUNC(FUNCTION, IFTRUE, IFFALSE)
70+
dnl -----------------------------------------
71+
dnl Similar to AC_CHECK_FUNC, but on systems that do not generate
72+
dnl warnings for missing prototypes (e.g. FreeBSD when compiling without
73+
dnl -Wall), it does not work. By looking for function definition in
74+
dnl libraries, this problem can be worked around.
75+
AC_DEFUN([GIT_CHECK_FUNC],[AC_CHECK_FUNC([$1],[
76+
AC_SEARCH_LIBS([$1],,
77+
[$2],[$3])
78+
],[$3])])
6979
## Site configuration related to programs (before tests)
7080
## --with-PACKAGE[=ARG] and --without-PACKAGE
7181
#
@@ -325,7 +335,7 @@ AC_SUBST(NO_SOCKADDR_STORAGE)
325335
#
326336
# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
327337
AC_CHECK_TYPE([struct addrinfo],[
328-
AC_CHECK_FUNC([getaddrinfo],
338+
GIT_CHECK_FUNC([getaddrinfo],
329339
[NO_IPV6=],
330340
[NO_IPV6=YesPlease])
331341
],[NO_IPV6=YesPlease],[
@@ -419,43 +429,43 @@ AC_SUBST(SNPRINTF_RETURNS_BOGUS)
419429
AC_MSG_NOTICE([CHECKS for library functions])
420430
#
421431
# Define NO_STRCASESTR if you don't have strcasestr.
422-
AC_CHECK_FUNC(strcasestr,
432+
GIT_CHECK_FUNC(strcasestr,
423433
[NO_STRCASESTR=],
424434
[NO_STRCASESTR=YesPlease])
425435
AC_SUBST(NO_STRCASESTR)
426436
#
427437
# Define NO_MEMMEM if you don't have memmem.
428-
AC_CHECK_FUNC(memmem,
438+
GIT_CHECK_FUNC(memmem,
429439
[NO_MEMMEM=],
430440
[NO_MEMMEM=YesPlease])
431441
AC_SUBST(NO_MEMMEM)
432442
#
433443
# Define NO_STRLCPY if you don't have strlcpy.
434-
AC_CHECK_FUNC(strlcpy,
444+
GIT_CHECK_FUNC(strlcpy,
435445
[NO_STRLCPY=],
436446
[NO_STRLCPY=YesPlease])
437447
AC_SUBST(NO_STRLCPY)
438448
#
439449
# Define NO_STRTOUMAX if you don't have strtoumax in the C library.
440-
AC_CHECK_FUNC(strtoumax,
450+
GIT_CHECK_FUNC(strtoumax,
441451
[NO_STRTOUMAX=],
442452
[NO_STRTOUMAX=YesPlease])
443453
AC_SUBST(NO_STRTOUMAX)
444454
#
445455
# Define NO_SETENV if you don't have setenv in the C library.
446-
AC_CHECK_FUNC(setenv,
456+
GIT_CHECK_FUNC(setenv,
447457
[NO_SETENV=],
448458
[NO_SETENV=YesPlease])
449459
AC_SUBST(NO_SETENV)
450460
#
451461
# Define NO_UNSETENV if you don't have unsetenv in the C library.
452-
AC_CHECK_FUNC(unsetenv,
462+
GIT_CHECK_FUNC(unsetenv,
453463
[NO_UNSETENV=],
454464
[NO_UNSETENV=YesPlease])
455465
AC_SUBST(NO_UNSETENV)
456466
#
457467
# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
458-
AC_CHECK_FUNC(mkdtemp,
468+
GIT_CHECK_FUNC(mkdtemp,
459469
[NO_MKDTEMP=],
460470
[NO_MKDTEMP=YesPlease])
461471
AC_SUBST(NO_MKDTEMP)

0 commit comments

Comments
 (0)