pkgsrc-WIP-discuss archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Checking for SSE/MMX support




> >>> You shouldn't let the package detect such things
> on
> >>> the build host,
> >>> because resulting binary packages (e.g. from
> bulk
> >>> builds) may be used
> >>> on incompatible machines.  The preferred way is
> to
> >>> make them options.
> >>
> >> That's what I'm trying to do, to make SCons
> figure out
> >> weather or not each machine has SSE/MMX support
> by
> >> using the output of some variable (hopefully with
> >> sysctl).
> >
> > What Geert tried to tell you was that this is not
> desired.
> > Please use the option framework and e.g.
> --enable-sse or whatever it is
> > and don't force any *compile time* detection. For
> example I'm building
> > packages on a P4-Xeon, they should also run on a
> Pentium MMX.
>=20
>       Maybe the question was how to use sysctl(3) to
> detect it at
>       runtime?
>=20

ok, I'm getting a little confused here. What I'm
trying to do is to
figure out if any given machine where this package
compiles on has or hasn't SSE/MMX support or not; I'm
using the SCons config file to do so:

# Part of the SConstruct file
#

elif (sys.platform =3D=3D 'freebsd5') or (sys.platform =3D=3D
'freebsd6') or (sys.platform =3D=3D 'freebsd7'):
        print "Compiling for FreeBSD Environment"
        env =3D Environment(ENV =3D os.environ)
        LOCALBASE =3D os.environ['LOCALBASE']
        X11BASE =3D os.environ['X11BASE']
        SDL_CONFIG =3D os.environ['SDL_CONFIG']
        env.Replace(CC =3D os.environ['CC'])
        env.Replace(CXX =3D os.environ['CXX'])
        env.Append(CPPPATH =3D [LOCALBASE + '/include',
LOCALBASE + '/include/SDL11', X11BASE + '/include',
X11BASE + '/include/GL'])
        libpath =3D [LOCALBASE + '/lib', X11BASE + '/lib']=20
        gllibs =3D ['GL', 'GLU']
        sdllibs =3D ['SDL_image']
# The line below it's what I'm talking about
#
        cpuinfof =3D os.popen('sysctl -n hw.instruction_sse')
#
#=09
        cpuinfol =3D cpuinfof.readlines()
        mmxsupported =3D False
        ssesupported =3D False
        for i in cpuinfol:
                if i =3D=3D '1\n':
                        mmxsupported =3D True
                        ssesupported =3D True
                if (usex86sse =3D=3D 0) and (mmxsupported and
ssesupported):
                        usex86sse =3D 1
                if usex86sse >=3D 1:
                        env.Append(CPPDEFINES =3D ['USE_SSE'])
                        osspecificsrc +=3D ['water_sse.cpp']
                        print 'Using x86 SSE/MMX
optimizations.'

        env.Replace(CCFLAGS =3D os.environ['CFLAGS'])
        if (debug =3D=3D 1):
                env.Append(CCFLAGS =3D '-g')
                env.Append(CPPDEFINES =3D ['DEBUG'])
        env.Replace(CXXFLAGS =3D os.environ['CXXFLAGS']
+ ' `' + SDL_CONFIG + ' --cflags`')
        env.Append(LINKFLAGS =3D '`' + SDL_CONFIG + '
--libs`')
        datadir =3D installdatadir
        build_dir =3D 'freebsd'
=09
        if (os.system('grep glBindProgram ' + X11BASE
+ '/include/GL/gl*.h > /dev/null') =3D=3D 0):
                gllibdirs =3D [X11BASE + '/lib/',
'/usr/lib/', LOCALBASE + '/lib/']
                gllibdir =3D ''
                for i in gllibdirs:
                        if (os.system('test -f
'+i+'libGL.so') =3D=3D 0):
                                gllibdir =3D i
                                break
                if (gllibdir =3D=3D ''):
                        print 'ERROR: no libGL.so
detected!'
                else:
                        print 'Found GL library "'+gllibdir+'libGL.so"'
                if (os.system('grep glBindProgram
'+gllibdir+'libGL.so > /dev/null') !=3D 0):
                        print 'GL headers declare
glBindProgram, but libGL.so has no such symbol!
Ignoring all undefined symbols...'
                        # I'm not sure which option
will hopefully fix the problem... so i use both...
                        env.Append(LINKFLAGS =3D
'--unresolved-symbols=3Dignore-all')
                        env.Append(LINKFLAGS =3D
'-Xlinker --unresolved-symbols -Xlinker ignore-all')



That's the freebsd part that came by default in the
SConstruct file, I was trying to create a similar
section for netbsd, so, what am I doing wrong?


Hugo

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam =A1gratis!=20
Reg=EDstrate ya - http://correo.espanol.yahoo.com/=20


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job ea=
sier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim=
o
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D=
121642
_______________________________________________
pkgsrc-wip-discuss mailing list
pkgsrc-wip-discuss%lists.sourceforge.net@localhost
https://lists.sourceforge.net/lists/listinfo/pkgsrc-wip-discuss



Home | Main Index | Thread Index | Old Index