From 0bc3e781deb543ac2042cbd862c035403404c93d Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Sun, 26 Oct 2008 03:52:37 -0800 Subject: Build: add NO_UINTMAX_T to support ancient systems This adds NO_UINTMAX_T for ancient systems, such as FreeBSD 4.9-SECURITY. If NO_UINTMAX_T is defined, then uintmax_t is defined as uint32_t. Signed-off-by: David M. Syzdek Signed-off-by: Junio C Hamano diff --git a/Makefile b/Makefile index d6f3695..0698365 100644 --- a/Makefile +++ b/Makefile @@ -955,6 +955,9 @@ endif 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 diff --git a/config.mak.in b/config.mak.in index 17e9861..7170729 100644 --- a/config.mak.in +++ b/config.mak.in @@ -41,6 +41,7 @@ NO_C99_FORMAT=@NO_C99_FORMAT@ NO_STRCASESTR=@NO_STRCASESTR@ NO_MEMMEM=@NO_MEMMEM@ NO_STRLCPY=@NO_STRLCPY@ +NO_UINTMAX_T=@NO_UINTMAX_T@ NO_STRTOUMAX=@NO_STRTOUMAX@ NO_SETENV=@NO_SETENV@ NO_UNSETENV=@NO_UNSETENV@ diff --git a/configure.ac b/configure.ac index 27bab00..a0d53f3 100644 --- a/configure.ac +++ b/configure.ac @@ -436,6 +436,14 @@ AC_CHECK_FUNC(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, [NO_STRTOUMAX=], -- cgit v0.10.2-6-g49f6 From 069bb5765c04645313d79a1eb345a4fb8fe7f06c Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Sun, 26 Oct 2008 03:52:47 -0800 Subject: Add Makefile check for FreeBSD 4.9-SECURITY If the system is FreeBSD 4.9, then NO_UINTMAX_T and NO_STRTOUMAX is defined. Signed-off-by: David M. Syzdek Signed-off-by: Junio C Hamano diff --git a/Makefile b/Makefile index 0698365..426e1a6 100644 --- a/Makefile +++ b/Makefile @@ -694,6 +694,10 @@ ifeq ($(uname_S),FreeBSD) THREADED_DELTA_SEARCH = YesPlease COMPAT_CFLAGS += -Icompat/regex COMPAT_OBJS += compat/regex/regex.o + ifeq ($(shell expr "$(uname_R)" : '4\.'),2) + NO_UINTMAX_T = YesPlease + NO_STRTOUMAX = YesPlease + endif endif ifeq ($(uname_S),OpenBSD) NO_STRCASESTR = YesPlease -- cgit v0.10.2-6-g49f6 From 158629b2c9baffd0352306bd8dfa0784c981955d Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Sun, 2 Nov 2008 14:43:20 -0900 Subject: Make Pthread link flags configurable FreeBSD 4.x systems use the linker flags `-pthread' instead of the linker flags `-lpthread' when linking against the pthread library. Signed-off-by: David M. Syzdek Signed-off-by: Junio C Hamano diff --git a/Makefile b/Makefile index 426e1a6..02f68e0 100644 --- a/Makefile +++ b/Makefile @@ -229,6 +229,7 @@ INSTALL = install RPMBUILD = rpmbuild TCL_PATH = tclsh TCLTK_PATH = wish +PTHREAD_LIBS = -lpthread export TCL_PATH TCLTK_PATH @@ -695,6 +696,7 @@ ifeq ($(uname_S),FreeBSD) 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 @@ -1023,7 +1025,7 @@ endif 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 -- cgit v0.10.2-6-g49f6 From 20f7a39825e30891056ab00ea620eaffda6aa451 Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Mon, 3 Nov 2008 09:14:28 -0900 Subject: Add autoconf tests for pthreads Set the value of PTHREAD_LIBS to the correct flags for linking pthreads on the current environment. Signed-off-by: David M. Syzdek Signed-off-by: Junio C Hamano diff --git a/config.mak.in b/config.mak.in index 7170729..ea7705c 100644 --- a/config.mak.in +++ b/config.mak.in @@ -51,3 +51,4 @@ OLD_ICONV=@OLD_ICONV@ NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@ FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@ SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@ +PTHREAD_LIBS=@PTHREAD_LIBS@ diff --git a/configure.ac b/configure.ac index a0d53f3..3f058a0 100644 --- a/configure.ac +++ b/configure.ac @@ -479,6 +479,22 @@ AC_SUBST(NO_MKDTEMP) # # 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 -- cgit v0.10.2-6-g49f6