TritonDataCenter / pkgsrc-wip

Conversion of the pkgsrc-wip CVS project
23 stars 34 forks source link

coturn has hardcoded Sun Studio flags for Solaris #99

Open mrferda opened 6 years ago

mrferda commented 6 years ago

remove_sun_studio_dep.patch.txt

Not sure if pkgsrc is intended to be built with the Studio compiler aswell, in that case the compiler version should be checked in the configure script.

jclulow commented 6 years ago

Looking at the patch you've attached, it's not clear that these are related to the Studio compiler at all:

--- configure.bac       2018-09-02 10:07:33.856657900 +0200
+++ configure   2018-09-02 10:11:48.560635900 +0200
@@ -610,19 +610,6 @@
     fi
 fi

-#############################
-# Adjustments for Solaris
-#############################
-
-SYSTEM=`uname`
-
-if [ "${SYSTEM}" = "SunOS" ] ; then
-# Solaris ? is this you ?!
-    OSCFLAGS="${OSCFLAGS} -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -DTURN_NO_GETDOMAINNAME"
-    OSLIBS="${OSLIBS} -lnsl"
-    TURN_NO_SCTP=1
-fi
-
 #########################
 # Temporary DIR location:
 #########################

Looking at standards(5), we see:

...
   X/Open CAE
       To build or compile an application that conforms to one of the X/Open CAE
       specifications, use the following guidelines. Applications need not set
       the POSIX feature test macros if they require both CAE and POSIX
       functionality.
...
       SUSv2
                       The application must define _XOPEN_SOURCE=500.

This suggests the application is expecting to use C functions as available in Single UNIX Specification, Version 2 (SUSv2). In addition, it's probably using functions that aren't strictly in that specification, thus:

   Feature Test Macros
...
       If an application uses only those interfaces and headers
       defined by a particular standard (such as POSIX or X/Open CAE),  then
       it need only define the appropriate feature test macro specified by
       that standard. If the application is using interfaces and headers not
       defined by that standard, then in addition to defining the appropriate
       standard feature test macro, it must also define __EXTENSIONS__.
       Defining __EXTENSIONS__ provides the application with access to all
       interfaces and headers not in conflict with the specified standard. The
       application must define __EXTENSIONS__ either on the compile command
       line or within the application source files.

Finally, there are probably some needed routines that are in libnsl(3LIB), hence the -lnsl. Some of the routines in the illumos libnsl have been provided directly by libc on other platforms.

I'm not sure what TURN_NO_SCTP does, or TURN_NO_GETDOMAINNAME, but those seem more application-specific rather than Studio-specific.

jperkin commented 6 years ago

We will need something along these lines. Nowadays with compilers that default to C99 you cannot explicitly use -D_XOPEN_SOURCE=500.

mrferda commented 6 years ago

Would it be reasonable to assume it safe to leave out -D_XOPEN_SOURCE=500 with current gcc? I didn’t see any ifdef-ed SunOS code and the other OSs don’t specify additional flags.