Skip to content

Commit 436f66b

Browse files
committed
Merge branch 'bc/solaris'
* bc/solaris: configure: test whether -lresolv is needed Makefile: insert SANE_TOOL_PATH to PATH before /bin or /usr/bin git-compat-util.h: avoid using c99 flex array feature with Sun compiler 5.8 Makefile: add section for SunOS 5.7 Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Makefile: define __sun__ on SunOS git-compat-util.h: tweak the way _XOPEN_SOURCE is set on Solaris On Solaris choose the OLD_ICONV iconv() declaration based on the UNIX spec Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments Makefile: use /usr/ucb/install on SunOS platforms rather than ginstall Conflicts: Makefile
2 parents 57c57a9 + 8fccb00 commit 436f66b

File tree

6 files changed

+90
-8
lines changed

6 files changed

+90
-8
lines changed

Makefile

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ all::
33

44
# Define V=1 to have a more verbose compile.
55
#
6+
# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
7+
#
8+
# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
9+
# to PATH if your tools in /usr/bin are broken.
10+
#
611
# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
712
# or vsnprintf() return -1 instead of number of characters which would
813
# have been written to the final string if enough space had been available.
@@ -95,6 +100,10 @@ all::
95100
# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
96101
# Patrick Mauritz).
97102
#
103+
# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
104+
# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
105+
# inet_ntop and inet_pton additionally reside there.
106+
#
98107
# Define NO_MMAP if you want to avoid mmap.
99108
#
100109
# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
@@ -706,13 +715,20 @@ ifeq ($(uname_S),SunOS)
706715
NEEDS_SOCKET = YesPlease
707716
NEEDS_NSL = YesPlease
708717
SHELL_PATH = /bin/bash
718+
SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
709719
NO_STRCASESTR = YesPlease
710720
NO_MEMMEM = YesPlease
711-
NO_HSTRERROR = YesPlease
712721
NO_MKDTEMP = YesPlease
713722
NO_MKSTEMPS = YesPlease
714-
ifneq ($(uname_R),5.11)
715-
OLD_ICONV = UnfortunatelyYes
723+
ifeq ($(uname_R),5.7)
724+
NEEDS_RESOLV = YesPlease
725+
NO_IPV6 = YesPlease
726+
NO_SOCKADDR_STORAGE = YesPlease
727+
NO_UNSETENV = YesPlease
728+
NO_SETENV = YesPlease
729+
NO_STRLCPY = YesPlease
730+
NO_C99_FORMAT = YesPlease
731+
NO_STRTOUMAX = YesPlease
716732
endif
717733
ifeq ($(uname_R),5.8)
718734
NO_UNSETENV = YesPlease
@@ -726,9 +742,12 @@ ifeq ($(uname_S),SunOS)
726742
NO_C99_FORMAT = YesPlease
727743
NO_STRTOUMAX = YesPlease
728744
endif
729-
INSTALL = ginstall
745+
ifdef NO_IPV6
746+
NEEDS_RESOLV = YesPlease
747+
endif
748+
INSTALL = /usr/ucb/install
730749
TAR = gtar
731-
BASIC_CFLAGS += -D__EXTENSIONS__
750+
BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
732751
endif
733752
ifeq ($(uname_O),Cygwin)
734753
NO_D_TYPE_IN_DIRENT = YesPlease
@@ -878,6 +897,14 @@ endif
878897
-include config.mak.autogen
879898
-include config.mak
880899

900+
ifdef SANE_TOOL_PATH
901+
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
902+
BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
903+
PATH := $(SANE_TOOL_PATH):${PATH}
904+
else
905+
BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
906+
endif
907+
881908
ifeq ($(uname_S),Darwin)
882909
ifndef NO_FINK
883910
ifeq ($(shell test -d /sw/lib && echo y),y)
@@ -981,6 +1008,9 @@ endif
9811008
ifdef NEEDS_NSL
9821009
EXTLIBS += -lnsl
9831010
endif
1011+
ifdef NEEDS_RESOLV
1012+
EXTLIBS += -lresolv
1013+
endif
9841014
ifdef NO_D_TYPE_IN_DIRENT
9851015
BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
9861016
endif
@@ -1285,6 +1315,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
12851315
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
12861316
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
12871317
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
1318+
-e $(BROKEN_PATH_FIX) \
12881319
$@.sh >$@+ && \
12891320
chmod +x $@+ && \
12901321
mv $@+ $@

config.mak.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ NO_EXPAT=@NO_EXPAT@
3333
NO_LIBGEN_H=@NO_LIBGEN_H@
3434
NEEDS_LIBICONV=@NEEDS_LIBICONV@
3535
NEEDS_SOCKET=@NEEDS_SOCKET@
36+
NEEDS_RESOLV=@NEEDS_RESOLV@
3637
NO_SYS_SELECT_H=@NO_SYS_SELECT_H@
3738
NO_D_INO_IN_DIRENT=@NO_D_INO_IN_DIRENT@
3839
NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@

configure.ac

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,15 @@ AC_CHECK_LIB([c], [socket],
467467
AC_SUBST(NEEDS_SOCKET)
468468
test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
469469

470+
#
471+
# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
472+
# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
473+
# inet_ntop and inet_pton additionally reside there.
474+
AC_CHECK_LIB([resolv], [hstrerror],
475+
[NEEDS_RESOLV=],
476+
[NEEDS_RESOLV=YesPlease])
477+
AC_SUBST(NEEDS_RESOLV)
478+
test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
470479

471480
## Checks for header files.
472481
AC_MSG_NOTICE([CHECKS for header files])

git-compat-util.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/*
88
* See if our compiler is known to support flexible array members.
99
*/
10-
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
10+
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && (!defined(__SUNPRO_C) || (__SUNPRO_C > 0x580))
1111
# define FLEX_ARRAY /* empty */
1212
#elif defined(__GNUC__)
1313
# if (__GNUC__ >= 3)
@@ -39,7 +39,20 @@
3939
/* Approximation of the length of the decimal representation of this type. */
4040
#define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1)
4141

42-
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && !defined(_M_UNIX)
42+
#if defined(__sun__)
43+
/*
44+
* On Solaris, when _XOPEN_EXTENDED is set, its header file
45+
* forces the programs to be XPG4v2, defeating any _XOPEN_SOURCE
46+
* setting to say we are XPG5 or XPG6. Also on Solaris,
47+
* XPG6 programs must be compiled with a c99 compiler, while
48+
* non XPG6 programs must be compiled with a pre-c99 compiler.
49+
*/
50+
# if __STDC_VERSION__ - 0 >= 199901L
51+
# define _XOPEN_SOURCE 600
52+
# else
53+
# define _XOPEN_SOURCE 500
54+
# endif
55+
#elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && !defined(_M_UNIX)
4356
#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
4457
#ifndef __sun__
4558
#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */

git-sh-setup.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,34 @@
1111
# exporting it.
1212
unset CDPATH
1313

14+
git_broken_path_fix () {
15+
case ":$PATH:" in
16+
*:$1:*) : ok ;;
17+
*)
18+
PATH=$(
19+
SANE_TOOL_PATH="$1"
20+
IFS=: path= sep=
21+
set x $PATH
22+
shift
23+
for elem
24+
do
25+
case "$SANE_TOOL_PATH:$elem" in
26+
(?*:/bin | ?*:/usr/bin)
27+
path="$path$sep$SANE_TOOL_PATH"
28+
sep=:
29+
SANE_TOOL_PATH=
30+
esac
31+
path="$path$sep$elem"
32+
sep=:
33+
done
34+
echo "$path"
35+
)
36+
;;
37+
esac
38+
}
39+
40+
# @@BROKEN_PATH_FIX@@
41+
1442
die() {
1543
echo >&2 "$@"
1644
exit 1

utf8.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ int is_encoding_utf8(const char *name)
354354
* with iconv. If the conversion fails, returns NULL.
355355
*/
356356
#ifndef NO_ICONV
357-
#ifdef OLD_ICONV
357+
#if defined(OLD_ICONV) || (defined(__sun__) && !defined(_XPG6))
358358
typedef const char * iconv_ibp;
359359
#else
360360
typedef char * iconv_ibp;

0 commit comments

Comments
 (0)