From: Junio C Hamano Date: Thu, 13 Nov 2008 06:27:33 +0000 (-0800) Subject: Merge branch 'ds/uintmax-config' (early part) X-Git-Tag: v1.6.1-rc1~53 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3e9f158c804776f6a7a42bef582a38909d3e920d?hp=-c Merge branch 'ds/uintmax-config' (early part) * 'ds/uintmax-config' (early part): Add autoconf tests for pthreads Make Pthread link flags configurable Add Makefile check for FreeBSD 4.9-SECURITY Build: add NO_UINTMAX_T to support ancient systems Conflicts: Makefile --- 3e9f158c804776f6a7a42bef582a38909d3e920d diff --combined Makefile index 920cb42078,02f68e05f5..35adafa011 --- a/Makefile +++ b/Makefile @@@ -229,6 -229,7 +229,7 @@@ INSTALL = instal RPMBUILD = rpmbuild TCL_PATH = tclsh TCLTK_PATH = wish + PTHREAD_LIBS = -lpthread export TCL_PATH TCLTK_PATH @@@ -640,6 -641,8 +641,6 @@@ ifeq ($(uname_S),Darwin endif NO_STRLCPY = YesPlease NO_MEMMEM = YesPlease - COMPAT_CFLAGS += -Icompat/regex - COMPAT_OBJS += compat/regex/regex.o endif ifeq ($(uname_S),SunOS) NEEDS_SOCKET = YesPlease @@@ -690,6 -693,13 +691,11 @@@ ifeq ($(uname_S),FreeBSD BASIC_LDFLAGS += -L/usr/local/lib DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease THREADED_DELTA_SEARCH = YesPlease - COMPAT_CFLAGS += -Icompat/regex - COMPAT_OBJS += compat/regex/regex.o + ifeq ($(shell expr "$(uname_R)" : '4\.'),2) + PTHREAD_LIBS = -pthread + NO_UINTMAX_T = YesPlease + NO_STRTOUMAX = YesPlease + endif endif ifeq ($(uname_S),OpenBSD) NO_STRCASESTR = YesPlease @@@ -716,6 -726,8 +722,6 @@@ ifeq ($(uname_S),AIX INTERNAL_QSORT = UnfortunatelyYes NEEDS_LIBICONV=YesPlease BASIC_CFLAGS += -D_LARGE_FILES - COMPAT_CFLAGS += -Icompat/regex - COMPAT_OBJS += compat/regex/regex.o endif ifeq ($(uname_S),GNU) # GNU/Hurd @@@ -949,6 -961,9 +955,9 @@@ endi ifdef NO_IPV6 BASIC_CFLAGS += -DNO_IPV6 endif + ifdef NO_UINTMAX_T + BASIC_CFLAGS += -Duintmax_t=uint32_t + endif ifdef NO_SOCKADDR_STORAGE ifdef NO_IPV6 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in @@@ -1010,7 -1025,7 +1019,7 @@@ endi ifdef THREADED_DELTA_SEARCH BASIC_CFLAGS += -DTHREADED_DELTA_SEARCH - EXTLIBS += -lpthread + EXTLIBS += $(PTHREAD_LIBS) LIB_OBJS += thread-utils.o endif ifdef DIR_HAS_BSD_GROUP_SEMANTICS @@@ -1355,16 -1370,7 +1364,16 @@@ check-sha1:: test-sha1$ ./test-sha1.sh check: common-cmds.h - for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done + if sparse; \ + then \ + for i in *.c; \ + do \ + sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \ + done; \ + else \ + echo 2>&1 "Did you mean 'make test'?"; \ + exit 1; \ + fi remove-dashes: ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS) @@@ -1414,9 -1420,6 +1423,9 @@@ endi install-doc: $(MAKE) -C Documentation install +install-man: + $(MAKE) -C Documentation install-man + install-html: $(MAKE) -C Documentation install-html @@@ -1426,9 -1429,6 +1435,9 @@@ install-info quick-install-doc: $(MAKE) -C Documentation quick-install +quick-install-man: + $(MAKE) -C Documentation quick-install-man + quick-install-html: $(MAKE) -C Documentation quick-install-html diff --combined configure.ac index ef544e8778,3f058a087b..42567420e0 --- a/configure.ac +++ b/configure.ac @@@ -65,17 -65,7 +65,17 @@@ else fi \ ])# GIT_PARSE_WITH - +dnl +dnl GIT_CHECK_FUNC(FUNCTION, IFTRUE, IFFALSE) +dnl ----------------------------------------- +dnl Similar to AC_CHECK_FUNC, but on systems that do not generate +dnl warnings for missing prototypes (e.g. FreeBSD when compiling without +dnl -Wall), it does not work. By looking for function definition in +dnl libraries, this problem can be worked around. +AC_DEFUN([GIT_CHECK_FUNC],[AC_CHECK_FUNC([$1],[ + AC_SEARCH_LIBS([$1],, + [$2],[$3]) +],[$3])]) ## Site configuration related to programs (before tests) ## --with-PACKAGE[=ARG] and --without-PACKAGE # @@@ -335,7 -325,7 +335,7 @@@ AC_SUBST(NO_SOCKADDR_STORAGE # # Define NO_IPV6 if you lack IPv6 support and getaddrinfo(). AC_CHECK_TYPE([struct addrinfo],[ - AC_CHECK_FUNC([getaddrinfo], + GIT_CHECK_FUNC([getaddrinfo], [NO_IPV6=], [NO_IPV6=YesPlease]) ],[NO_IPV6=YesPlease],[ @@@ -429,43 -419,51 +429,51 @@@ AC_SUBST(SNPRINTF_RETURNS_BOGUS AC_MSG_NOTICE([CHECKS for library functions]) # # Define NO_STRCASESTR if you don't have strcasestr. -AC_CHECK_FUNC(strcasestr, +GIT_CHECK_FUNC(strcasestr, [NO_STRCASESTR=], [NO_STRCASESTR=YesPlease]) AC_SUBST(NO_STRCASESTR) # # Define NO_MEMMEM if you don't have memmem. -AC_CHECK_FUNC(memmem, +GIT_CHECK_FUNC(memmem, [NO_MEMMEM=], [NO_MEMMEM=YesPlease]) AC_SUBST(NO_MEMMEM) # # Define NO_STRLCPY if you don't have strlcpy. -AC_CHECK_FUNC(strlcpy, +GIT_CHECK_FUNC(strlcpy, [NO_STRLCPY=], [NO_STRLCPY=YesPlease]) AC_SUBST(NO_STRLCPY) # + # Define NO_UINTMAX_T if your platform does not have uintmax_t + AC_CHECK_TYPE(uintmax_t, + [NO_UINTMAX_T=], + [NO_UINTMAX_T=YesPlease],[ + #include + ]) + AC_SUBST(NO_UINTMAX_T) + # # Define NO_STRTOUMAX if you don't have strtoumax in the C library. -AC_CHECK_FUNC(strtoumax, +GIT_CHECK_FUNC(strtoumax, [NO_STRTOUMAX=], [NO_STRTOUMAX=YesPlease]) AC_SUBST(NO_STRTOUMAX) # # Define NO_SETENV if you don't have setenv in the C library. -AC_CHECK_FUNC(setenv, +GIT_CHECK_FUNC(setenv, [NO_SETENV=], [NO_SETENV=YesPlease]) AC_SUBST(NO_SETENV) # # Define NO_UNSETENV if you don't have unsetenv in the C library. -AC_CHECK_FUNC(unsetenv, +GIT_CHECK_FUNC(unsetenv, [NO_UNSETENV=], [NO_UNSETENV=YesPlease]) AC_SUBST(NO_UNSETENV) # # Define NO_MKDTEMP if you don't have mkdtemp in the C library. -AC_CHECK_FUNC(mkdtemp, +GIT_CHECK_FUNC(mkdtemp, [NO_MKDTEMP=], [NO_MKDTEMP=YesPlease]) AC_SUBST(NO_MKDTEMP) @@@ -481,6 -479,22 +489,22 @@@ # # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link. # Enable it on Windows. By default, symrefs are still used. + # + # Define PTHREAD_LIBS to the linker flag used for Pthread support. + AC_LANG_CONFTEST([AC_LANG_PROGRAM( + [[#include ]], + [[pthread_mutex_t test_mutex;]] + )]) + ${CC} -pthread conftest.c -o conftest.o > /dev/null 2>&1 + if test $? -eq 0;then + PTHREAD_LIBS="-pthread" + else + ${CC} -lpthread conftest.c -o conftest.o > /dev/null 2>&1 + if test $? -eq 0;then + PTHREAD_LIBS="-lpthread" + fi + fi + AC_SUBST(PTHREAD_LIBS) ## Site configuration (override autodetection) ## --with-PACKAGE[=ARG] and --without-PACKAGE