Commit 07e941d3 authored by Phil Blundell's avatar Phil Blundell

Portability/cross-compile fixes from Chris G. Demetriou

parent 9c98affb
...@@ -86,7 +86,9 @@ endif ...@@ -86,7 +86,9 @@ endif
# Compiler and Linker Options # Compiler and Linker Options
# You may need to uncomment and edit these if you are using libc5 and IPv6. # You may need to uncomment and edit these if you are using libc5 and IPv6.
COPTS = -D_GNU_SOURCE -O2 -Wall -g # -I/usr/inet6/include COPTS = -D_GNU_SOURCE -O2 -Wall -g # -I/usr/inet6/include
ifeq ($(origin LOPTS), undefined)
LOPTS = LOPTS =
endif
RESLIB = # -L/usr/inet6/lib -linet6 RESLIB = # -L/usr/inet6/lib -linet6
ifeq ($(HAVE_AFDECnet),1) ifeq ($(HAVE_AFDECnet),1)
...@@ -113,8 +115,10 @@ LDFLAGS = $(LOPTS) -L$(NET_LIB_PATH) ...@@ -113,8 +115,10 @@ LDFLAGS = $(LOPTS) -L$(NET_LIB_PATH)
SUBDIRS = man/ $(NET_LIB_PATH)/ SUBDIRS = man/ $(NET_LIB_PATH)/
ifeq ($(origin CC), undefined)
CC = gcc CC = gcc
LD = gcc endif
LD = $(CC)
NLIB = -l$(NET_LIB_NAME) NLIB = -l$(NET_LIB_NAME)
...@@ -136,15 +140,15 @@ mostlyclean: ...@@ -136,15 +140,15 @@ mostlyclean:
clean: mostlyclean clean: mostlyclean
rm -f $(PROGS) rm -f $(PROGS)
@for i in $(SUBDIRS); do (cd $$i && make clean) ; done @for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) ; done
@cd po && make clean @cd po && $(MAKE) clean
cleanconfig: cleanconfig:
rm -f config.h rm -f config.h
clobber: clean clobber: clean
rm -f $(PROGS) config.h version.h config.status rm -f $(PROGS) config.h version.h config.status
@for i in $(SUBDIRS); do (cd $$i && make clobber) ; done @for i in $(SUBDIRS); do (cd $$i && $(MAKE) clobber) ; done
dist: clobber dist: clobber
...@@ -155,8 +159,8 @@ dist: clobber ...@@ -155,8 +159,8 @@ dist: clobber
config.h: config.in Makefile config.h: config.in Makefile
@echo "Configuring the Linux net-tools (NET-3 Base Utilities)..." ; echo @echo "Configuring the Linux net-tools (NET-3 Base Utilities)..." ; echo
@if [ config.status -nt config.in ]; \ @if [ config.status -nt config.in ]; \
then ./configure.sh <config.status; \ then ./configure.sh config.status; \
else ./configure.sh <config.in; \ else ./configure.sh config.in; \
fi fi
......
#!/bin/bash #!/usr/bin/env bash
# #
# Configure.sh Generates interactively a config.h from config.in # Configure.sh Generates interactively a config.h from config.in
# #
...@@ -43,6 +43,14 @@ MAKECONFIG=config.make ...@@ -43,6 +43,14 @@ MAKECONFIG=config.make
# Enable function cacheing. # Enable function cacheing.
set -f -h set -f -h
# set up reading of config file
if [ "$#" != "1" ] || [ ! -f "$1" ]; then
echo "usage: $0 configfile" 1>&2
exit 1
fi
exec 7<$1
config_fd_redir='<&7'
# #
# readln reads a line into $ans. # readln reads a line into $ans.
# #
...@@ -51,7 +59,7 @@ set -f -h ...@@ -51,7 +59,7 @@ set -f -h
function readln() function readln()
{ {
echo -n "$1" echo -n "$1"
IFS='@' read ans </dev/tty || exit 1 IFS='@' read ans || exit 1
[ -z "$ans" ] && ans=$2 [ -z "$ans" ] && ans=$2
} }
...@@ -107,7 +115,7 @@ function int() ...@@ -107,7 +115,7 @@ function int()
stack='' stack=''
branch='t' branch='t'
while IFS='@' read raw_input_line while IFS='@' eval read raw_input_line ${config_fd_redir}
do do
# Slimy hack to get bash to rescan a line. # Slimy hack to get bash to rescan a line.
read cmd rest <<-END_OF_COMMAND read cmd rest <<-END_OF_COMMAND
......
...@@ -39,7 +39,7 @@ all: lib$(NET_LIB_NAME).a # lib$(NET_LIB_NAME).so ...@@ -39,7 +39,7 @@ all: lib$(NET_LIB_NAME).a # lib$(NET_LIB_NAME).so
lib$(NET_LIB_NAME).a: Makefile $(TOPDIR)/config.h $(OBJS) lib$(NET_LIB_NAME).a: Makefile $(TOPDIR)/config.h $(OBJS)
@echo Building $@ @echo Building $@
@rm -f $@ @rm -f $@
@ar rcs $@ $(OBJS) @$(AR) rcs $@ $(OBJS)
.a.so:; .a.so:;
$(CC) -o $@ -shared -Wl,--whole-archive -Wl,--soname -Wl,$(SONAME) -nostdlib -nostartfiles $< $(CC) -o $@ -shared -Wl,--whole-archive -Wl,--soname -Wl,$(SONAME) -nostdlib -nostartfiles $<
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
* Foundation; either version 2 of the License, or (at * Foundation; either version 2 of the License, or (at
* your option) any later version. * your option) any later version.
*/ */
#include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment