From 2998cff567e2bddb6050a664ad85f5ad7275d65c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 14 Nov 2006 19:40:47 +0000 Subject: [PATCH] Configuration files for FreeBSD, from Artem Kazakov --- config/CONFIG.Host.freebsd | 42 ++++++++++ config/CONFIG_COMPAT | 1 + config/CONFIG_HOST_ARCH.freebsd-x86_64 | 11 +++ configure/CONFIG_SITE | 27 +++--- configure/os/CONFIG.Common.freebsd-x86_64 | 34 ++++++++ configure/os/CONFIG.Common.freebsdCommon | 31 +++++++ configure/os/CONFIG.freebsd-x86_64.Common | 11 +++ .../os/CONFIG.freebsd-x86_64.freebsd-x86_64 | 20 +++++ configure/os/CONFIG_COMPAT | 1 + src/libCom/osi/os/freebsd/osdSock.h | 83 +++++++++++++++++++ src/libCom/osi/os/freebsd/osdTime.h | 33 ++++++++ src/libCom/osi/os/freebsd/osiFileName.h | 20 +++++ src/libCom/osi/os/freebsd/osiUnistd.h | 32 +++++++ 13 files changed, 329 insertions(+), 17 deletions(-) create mode 100644 config/CONFIG.Host.freebsd create mode 100644 config/CONFIG_HOST_ARCH.freebsd-x86_64 create mode 100644 configure/os/CONFIG.Common.freebsd-x86_64 create mode 100644 configure/os/CONFIG.Common.freebsdCommon create mode 100644 configure/os/CONFIG.freebsd-x86_64.Common create mode 100644 configure/os/CONFIG.freebsd-x86_64.freebsd-x86_64 create mode 100644 src/libCom/osi/os/freebsd/osdSock.h create mode 100644 src/libCom/osi/os/freebsd/osdTime.h create mode 100644 src/libCom/osi/os/freebsd/osiFileName.h create mode 100644 src/libCom/osi/os/freebsd/osiUnistd.h diff --git a/config/CONFIG.Host.freebsd b/config/CONFIG.Host.freebsd new file mode 100644 index 000000000..90480983b --- /dev/null +++ b/config/CONFIG.Host.freebsd @@ -0,0 +1,42 @@ +#************************************************************************* +# Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# Copyright (c) 2002 The Regents of the University of California, as +# Operator of Los Alamos National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* +# $Id$ +# +# This file is maintained by the EPICS community. +# Sites may override these definitions in CONFIG_SITE.Host.freebsd + +ARCH_CLASS = freebsd + +# Include definitions common to all Unix archs +include $(EPICS_BASE)/config/CONFIG.Host.UnixCommon + +AR = ar -rc +ARCMD = $(AR) $@ +RANLIB = ranlib -t + +ANSI=GCC +CPLUSPLUS=G++ + +GCC_SHRLIB_LDFLAGS_YES += -Wl,-soname,$@ +G++_SHRLIB_LDFLAGS_YES += -Wl,-soname,$@ + +OP_SYS_CFLAGS += -D_BSD_SOURCE + +ARCH_DEP_CFLAGS = -D_X86_ -Dfreebsd +ARCH_DEP_LDLIBS += -lpthread -lreadline -lcurses -lrt + +#Allows R3.13 built extensions to load R3.14 shared libs +SYS_DLL_LIBS_freebsd += pthread readline curses rt + +# Runtime ldflags +RUNTIME_LIBS =$(EPICS_BASE)/lib/$(EPICS_HOST_ARCH)\ + $(EPICS_EXTENSIONS)/lib/$(EPICS_HOST_ARCH) +RUNTIME_LDFLAGS = $(RUNTIME_LIBS:%=-Wl,-rpath,%) + + diff --git a/config/CONFIG_COMPAT b/config/CONFIG_COMPAT index bf25f69c9..3663f7872 100644 --- a/config/CONFIG_COMPAT +++ b/config/CONFIG_COMPAT @@ -21,6 +21,7 @@ ARCH_solarisNonshared = solaris-sparc-nonshared ARCH_solaris = solaris-sparc ARCH_sun4 = sun4-sparc ARCH_Linux = linux-x86 +ARCH_freebsd = freebsd-x86 ARCH_WIN32 = win32-x86 ARCH_hp700 = hpux-m68k ARCH_alpha = osf-alpha diff --git a/config/CONFIG_HOST_ARCH.freebsd-x86_64 b/config/CONFIG_HOST_ARCH.freebsd-x86_64 new file mode 100644 index 000000000..371de74f1 --- /dev/null +++ b/config/CONFIG_HOST_ARCH.freebsd-x86_64 @@ -0,0 +1,11 @@ +#************************************************************************* +# Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# Copyright (c) 2002 The Regents of the University of California, as +# Operator of Los Alamos National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* +# $Id$ + +-include $(EPICS_BASE)/config/CONFIG_HOST_ARCH.freebsd diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index 1abbf5b8c..8a9de52bf 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -1,37 +1,30 @@ #************************************************************************* -# Copyright (c) 2002 The University of Chicago, as Operator of Argonne +# Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne # National Laboratory. # Copyright (c) 2002 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. -# EPICS BASE Versions 3.13.7 -# and higher are distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# EPICS BASE is distributed subject to a Software License Agreement found +# in the file LICENSE that is included with this distribution. #************************************************************************* # # $Id$ # -# CONFIG_SITE - config file -# by Matthew Needes and Mike Bordua +# CONFIG_SITE - Global site configuration file # -# This file is to be modified by the build system manager -# only. -# - # The host architecture performing the build, in the form -# -[-] +# -[-] # # Currently Supporting: -# aix-ppc (HP compiler used for host builds) +# aix-ppc (IBM compiler used for host builds) # aix-ppc-gnu (GNU compiler used for host builds) # cygwin-x86 (cygwin compiler used for host builds) -# darwin-ppc -# darwin-x86 +# darwin-ppc (PowerPC based Apple running OSX) +# darwin-x86 (Intel based Apple running OSX) # darwin-ppcx86 (Universal binaries for both CPUs) # hpux-parisc (HP compiler used for host builds) # hpux-parisc-gnu (GNU compiler used for host builds) # linux-ppc (GNU compiler used for host builds) -# linux-ppc-bgl # linux-x86 (GNU compiler used for host builds) # linux-x86_64 (GNU compiler used for host builds) # linux-x86-borland (Borland C++ compiler used for host builds) @@ -42,7 +35,7 @@ # solaris-x86 (sun compiler used for host builds) # solaris-x86-gnu (GNU compiler used for host builds) # win32-x86 (MS Visual C++ compiler used for host builds) -# win32-x86_mingw (MinGW compiler used for host builds) +# win32-x86-mingw (MinGW compiler used for host builds) # win32-x86-borland (Borland C++ compiler used for host builds) # win32-x86-cygwin (WIN32 API with cygwin GNU compiler used for host builds) @@ -56,7 +49,7 @@ # EPICS_HOST_ARCH is a required environment variable # Do not set EPICS_HOST_ARCH in this file. # Use base/startup files to set EPICS_HOST_ARCH or -# set EPICS_HOST_ARCH on the GNU make command line. +# provide EPICS_HOST_ARCH on the GNU make command line. # The cross-compiler architectures to build EPICS for # diff --git a/configure/os/CONFIG.Common.freebsd-x86_64 b/configure/os/CONFIG.Common.freebsd-x86_64 new file mode 100644 index 000000000..e492569fe --- /dev/null +++ b/configure/os/CONFIG.Common.freebsd-x86_64 @@ -0,0 +1,34 @@ +# $Id$ +# +# This file is maintained by the build community. +# +# Definitions for freebsd-x86_64 target builds +# Sites may override these definitions in CONFIG_SITE.Common.freebsd-x86_64 +#------------------------------------------------------- + +# Include definitions common to all freebsd targets +include $(CONFIG)/os/CONFIG.Common.freebsdCommon + +ARCH_CLASS = x86_64 + +ARCH_DEP_CPPFLAGS += -D_X86_64_ + +ifeq ($(BUILD_CLASS),CROSS) +ifeq ($(EPICS_HOST_ARCH),freebsd-x86_64) + # Added for 386,486,... cross builds + CMPLR_PREFIX= + CROSS_INCLUDES= + CROSS_LDFLAGS= + # Use -w not -Wall + #WARN_CFLAGS_YES = -w + #WARN_CXXFLAGS_YES = -w +-include $(CONFIG)/os/CONFIG_SITE.Common.freebsd-x86_64 +-include $(CONFIG)/os/CONFIG.freebsd-x86_64.freebsd-x86_64 +-include $(CONFIG)/os/CONFIG_SITE.freebsd-x86_64.freebsd-x86_64 +else + GNU_TARGET=i586-pc-freebsd-gnu + CMPLR_SUFFIX= + CMPLR_PREFIX=$(addsuffix -,$(GNU_TARGET)) +endif +endif + diff --git a/configure/os/CONFIG.Common.freebsdCommon b/configure/os/CONFIG.Common.freebsdCommon new file mode 100644 index 000000000..5a920eb65 --- /dev/null +++ b/configure/os/CONFIG.Common.freebsdCommon @@ -0,0 +1,31 @@ +# $Id$ +# +# This file is maintained by the build community. +# +# Definitions for freebsd target builds +# Sites may override these definitions in CONFIG_SITE.Common.freebsdCommon +#------------------------------------------------------- + +# Include definitions common to all Unix targets +include $(CONFIG)/os/CONFIG.Common.UnixCommon + +OS_CLASS = freebsd + +CODE_CPPFLAGS = -D_REENTRANT + +#POSIX_CPPFLAGS = -D_POSIX_C_SOURCE=199506L -D_POSIX_THREADS -D_XOPEN_SOURCE=500 +POSIX_CPPFLAGS = -D_POSIX_THREADS +POSIX_LDLIBS = -lpthread + +# -D_BSD_SOURCE for gethostname() in unistd.h as needed by cacChannelIO.cpp. +OP_SYS_CPPFLAGS += -D_BSD_SOURCE +OP_SYS_CPPFLAGS += -Dfreebsd +#OP_SYS_LDLIBS += -lrt + +# Set runtime path for shared libraries +RUNTIME_LDFLAGS = $(SHRLIB_SEARCH_FULLPATHDIRS:%=-Wl,-rpath,%) + +# Definitions used when COMMANDLINE_LIBRARY is READLINE +LDLIBS_READLINE = -lreadline -lcurses + +GNU_LDLIBS_YES = -lgcc_pic diff --git a/configure/os/CONFIG.freebsd-x86_64.Common b/configure/os/CONFIG.freebsd-x86_64.Common new file mode 100644 index 000000000..7b9307501 --- /dev/null +++ b/configure/os/CONFIG.freebsd-x86_64.Common @@ -0,0 +1,11 @@ +# $Id$ +# +# This file is maintained by the build community. +# +# Definitions for freebsd host builds +# Sites may override these definitions in CONFIG_SITE.freebsd.Common +#------------------------------------------------------- + +# Include definitions common to unix hosts +include $(CONFIG)/os/CONFIG.UnixCommon.Common + diff --git a/configure/os/CONFIG.freebsd-x86_64.freebsd-x86_64 b/configure/os/CONFIG.freebsd-x86_64.freebsd-x86_64 new file mode 100644 index 000000000..9fca74b78 --- /dev/null +++ b/configure/os/CONFIG.freebsd-x86_64.freebsd-x86_64 @@ -0,0 +1,20 @@ +# $Id$ +# +# Definitions for freebsd-x86_64 host - freebsd-x86_64 target builds +# Sites may override these definitions in CONFIG_SITE.freebsd-x86_64.freebsd-x86_64 +#------------------------------------------------------- + +# Include common gnu compiler definitions +include $(CONFIG)/CONFIG.gnuCommon + +GNU_DIR = /usr +GNU_LDLIBS_YES = + +STATIC_LDFLAGS_YES= -Wl,-Bstatic +STATIC_LDFLAGS_NO= +STATIC_LDLIBS_YES= -Wl,-Bdynamic +STATIC_LDLIBS_NO= + +SHRLIB_LDFLAGS += -shared -fPIC +LOADABLE_SHRLIB_LDFLAGS = -shared -fPIC + diff --git a/configure/os/CONFIG_COMPAT b/configure/os/CONFIG_COMPAT index 1b8469430..c72049b61 100644 --- a/configure/os/CONFIG_COMPAT +++ b/configure/os/CONFIG_COMPAT @@ -18,6 +18,7 @@ ARCH_hp700 = hpux-parisc ARCH_alpha = osf-alpha ARCH_cygwin32 = cygwin-x86 ARCH_Borland = win32-x86-borland +ARCH_freebsd = freebsd-x86 ifndef EPICS_HOST_ARCH ifdef HOST_ARCH diff --git a/src/libCom/osi/os/freebsd/osdSock.h b/src/libCom/osi/os/freebsd/osdSock.h new file mode 100644 index 000000000..0b9e51508 --- /dev/null +++ b/src/libCom/osi/os/freebsd/osdSock.h @@ -0,0 +1,83 @@ +/*************************************************************************\ +* Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne +* National Laboratory. +* Copyright (c) 2002 The Regents of the University of California, as +* Operator of Los Alamos National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#ifndef osdSockH +#define osdSockH + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include +#include /* for MAXHOSTNAMELEN */ +#include +#include +#include +#include +#include +#include +#include +#include +#include /* close() and others */ + + +#ifdef __cplusplus +} +#endif + +#ifndef IPPORT_USERRESERVED +#define IPPORT_USERRESERVED 5000 +#endif + + +typedef int SOCKET; +#define INVALID_SOCKET (-1) +#define SOCKERRNO errno +#define socket_ioctl(A,B,C) ioctl(A,B,C) +typedef int osiSockIoctl_t; +typedef socklen_t osiSocklen_t; + +#define FD_IN_FDSET(FD) ((FD)ifr_name)) + +#endif /*osdSockH*/ + diff --git a/src/libCom/osi/os/freebsd/osdTime.h b/src/libCom/osi/os/freebsd/osdTime.h new file mode 100644 index 000000000..792d25762 --- /dev/null +++ b/src/libCom/osi/os/freebsd/osdTime.h @@ -0,0 +1,33 @@ +/*************************************************************************\ +* Copyright (c) 2002 The University of Saskatchewan +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +/* + * $Id$ + * + * Author: Eric Norum + */ + +#ifndef osdTimeh +#define osdTimeh + +/* + * We need this include file since the POSIX version + * causes `struct timespec' to be defined in more than one place. + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +epicsShareFunc void epicsShareAPI + convertDoubleToWakeTime(double timeout,struct timespec *wakeTime); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ifndef osdTimeh */ + diff --git a/src/libCom/osi/os/freebsd/osiFileName.h b/src/libCom/osi/os/freebsd/osiFileName.h new file mode 100644 index 000000000..a64c19ad8 --- /dev/null +++ b/src/libCom/osi/os/freebsd/osiFileName.h @@ -0,0 +1,20 @@ +/*************************************************************************\ +* Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne +* National Laboratory. +* Copyright (c) 2002 The Regents of the University of California, as +* Operator of Los Alamos National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ +/* + * osiFileName.h + * Author: Jeff Hill + * + * + */ +#ifndef osiFileNameH +#define osiFileNameH + +#include "unixFileName.h" + +#endif /* osiFileNameH */ diff --git a/src/libCom/osi/os/freebsd/osiUnistd.h b/src/libCom/osi/os/freebsd/osiUnistd.h new file mode 100644 index 000000000..79a07c0e8 --- /dev/null +++ b/src/libCom/osi/os/freebsd/osiUnistd.h @@ -0,0 +1,32 @@ +/*************************************************************************\ +* Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne +* National Laboratory. +* Copyright (c) 2002 The Regents of the University of California, as +* Operator of Los Alamos National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ +/* + * $Id$ + * + * + * L O S A L A M O S + * Los Alamos National Laboratory + * Los Alamos, New Mexico 87545 + * + * Copyright, 1986, The Regents of the University of California. + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 + */ + +#include + +/* + * Some systems fail to provide prototypes of these functions. + * Others provide different prototypes. + * There seems to be no way to handle this automatically, so + * if you get compile errors, just make the appropriate changes here. + */