autoconf: Add link tests to each AC_CHECK_FUNC() test
Update configure.ac to test libraries for getaddrinfo, strcasestr, memmem, strlcpy, strtoumax, setenv, unsetenv, and mkdtemp. The default compilers on FreeBSD 4.9-SECURITY and FreeBSD 6.2-RELEASE-p4 do not generate warnings for missing prototypes unless `-Wall' is used. This behavior renders the results of AC_CHECK_FUNC() void on these platforms. The test AC_SEARCH_LIBS() verifies a function is valid by linking to symbol within the system libraries. Since this pattern needs to be repeated for many functions that are checked with AC_CHECK_FUNC(), we add GIT_CHECK_FUNC() to drive the two autoconf macros together. Signed-off-by: David M. Syzdek <david.syzdek@acsalaska.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
David M. Syzdek committed
Oct 26, 2008 at 03:52 UTC
1689c5de8730ea334535337a341db3c7a21ad002
1 file changed
+19
-9
configure.ac
+19
-9
@@ -65,7 +65,17 @@ else \
65
fi \
66
])# GIT_PARSE_WITH
67
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])])
79
## Site configuration related to programs (before tests)
80
## --with-PACKAGE[=ARG] and --without-PACKAGE
81
#
@@ -325,7 +335,7 @@ AC_SUBST(NO_SOCKADDR_STORAGE)
335
#
336
# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
337
AC_CHECK_TYPE([struct addrinfo],[
328
- AC_CHECK_FUNC([getaddrinfo],
338
+ GIT_CHECK_FUNC([getaddrinfo],
339
[NO_IPV6=],
340
[NO_IPV6=YesPlease])
341
],[NO_IPV6=YesPlease],[
@@ -419,43 +429,43 @@ AC_SUBST(SNPRINTF_RETURNS_BOGUS)
429
AC_MSG_NOTICE([CHECKS for library functions])
430
#
431
# Define NO_STRCASESTR if you don't have strcasestr.
422
-AC_CHECK_FUNC(strcasestr,
432
+GIT_CHECK_FUNC(strcasestr,
433
[NO_STRCASESTR=],
434
[NO_STRCASESTR=YesPlease])
435
AC_SUBST(NO_STRCASESTR)
436
#
437
# Define NO_MEMMEM if you don't have memmem.
428
-AC_CHECK_FUNC(memmem,
438
+GIT_CHECK_FUNC(memmem,
439
[NO_MEMMEM=],
440
[NO_MEMMEM=YesPlease])
441
AC_SUBST(NO_MEMMEM)
442
#
443
# Define NO_STRLCPY if you don't have strlcpy.
434
-AC_CHECK_FUNC(strlcpy,
444
+GIT_CHECK_FUNC(strlcpy,
445
[NO_STRLCPY=],
446
[NO_STRLCPY=YesPlease])
447
AC_SUBST(NO_STRLCPY)
448
#
449
# Define NO_STRTOUMAX if you don't have strtoumax in the C library.
440
-AC_CHECK_FUNC(strtoumax,
450
+GIT_CHECK_FUNC(strtoumax,
451
[NO_STRTOUMAX=],
452
[NO_STRTOUMAX=YesPlease])
453
AC_SUBST(NO_STRTOUMAX)
454
#
455
# Define NO_SETENV if you don't have setenv in the C library.
446
-AC_CHECK_FUNC(setenv,
456
+GIT_CHECK_FUNC(setenv,
457
[NO_SETENV=],
458
[NO_SETENV=YesPlease])
459
AC_SUBST(NO_SETENV)
460
#
461
# Define NO_UNSETENV if you don't have unsetenv in the C library.
452
-AC_CHECK_FUNC(unsetenv,
462
+GIT_CHECK_FUNC(unsetenv,
463
[NO_UNSETENV=],
464
[NO_UNSETENV=YesPlease])
465
AC_SUBST(NO_UNSETENV)
466
#
467
# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
458
-AC_CHECK_FUNC(mkdtemp,
468
+GIT_CHECK_FUNC(mkdtemp,
469
[NO_MKDTEMP=],
470
[NO_MKDTEMP=YesPlease])
471
AC_SUBST(NO_MKDTEMP)