#464 OpenBSD support

puredata (385)

FIrst round of patches to add support for OpenBSD.


1 2 > >> (Page 1 of 2)
  • Federico Schwindt

  • Hans-Christoph Steiner

    The best thing to do would be to make a single patch that includes everything needed for OpenBSD support.

  • Federico Schwindt

    That'd be ideal but since I'm not sure about the other changes (using config headers, etc.) I'm submitting what I know for certain that won't change depending on the approach.

    For example what should I do if alloca.h doesn't exist? In my git repo I have #ifdef HAVE_ALLOCA_H where the define is driven from autotools header check but I'm still unclear whether you want to use the headers or not (and the reason you might not want to do it since you're already using autotools).

    Happy to submit everything in one go if you can suggest what the best course of action is.

  • Federico Schwindt

    Comments please? I'd really to move forward with this.

  • IOhannes m zmölnig

    this patch is simple enough (almost trivial) as it only adds "#ifdef __OpenBSD__" to the clauses that are already handled by "__FreeBSD__".
    i don't see a reason to not include it (but of course this all depends on miller).

    small note on patches:
    - the patch doesn't apply here (`patch` thinks the diff is garbage)
    - Pd is developped in git; it would be great if you could generate your patches using git as well; see [1]
    - as for atomicity of patches: personally i think creating a (few) smaller patches is not a real problem; make sure that those patches are logical units rather than reflecting your iterative trial-and-error history to fix a problem. then attach all patch files to this ticket (rather than creating a new patchtracker-ticket for each file)

    [1] http://puredata.info/docs/developer/GitWorkflows/

  • Federico Schwindt


    The patch comes from git. My main concern is how to proceed with the other changes that require more changes than just extending an existing ifdef. For example the exclusion of alloca.h, etc.
    In my git clone I've modified configure to use config headers and so I can do ifdef HAVE_ALLOCA_H, etc. but I'm not sure if such patches will be accepted.
    The reason I've break them down is so they can be committed while I understand what your preference is.

  • IOhannes m zmölnig

    if the patch comes from git, then please create a branch, commit to that and then create a patch-set using "git format-patch master".

    as for the HAVE_ALLOCA_H: if you don't instruct configure to write defines into config.h, it will add them to the CFLAGS, so that the compilation will still work. thus, no need to change the build-system.
    bear in mind though, that currently Pd uses to separate build-systems: .../configure.ac and .../src/configure.in (and .../src/makefile.nt); you might need to modify all 3 in order to get accepted (yes, it's a PITA)

  • Nobody/Anonymous

    I might be missing something but unless you add it manually I don't see where configures adds the HAVE_XXX to CFLAGS unless you do it manually.

    And src/makefile.in is processed by src/configure(.in) so only ../configure.ac and ../src/configure.in need to be modified.

    You have a pretty messed up build system.

  • IOhannes m zmölnig

    #1 yes, the build-system is messed up (or rather, it is in a state of transition)

    #2 .../src/configure adds HAVE_foo to CPPFLAGS (and .../configure adds it to DEFS), which get expanded in the resp. makefiles (so technically you are right, they don't get added to CFLAGS)

    #3 i said "makefile.nt" and not "makefile.in", which is the 3rd(!) build-system that is there and which is used to build on w32 using MSVC.

  • Hans-Christoph Steiner

    I think you'll be safe only touching the ./configure.ac and Makefile.ams. Miller seems to want to hold only to the old, crufty src/configure.in build, but he doesn't use OpenBSD.

  • IOhannes m zmölnig

    no not really. afaiu the plan is to add a check for "alloca.h" to configure, which willl define HAVE_ALLOCA_H if the file is found. if HAVE_ALLOCA_H is defined alloca.h will get included.

    now the current behaviour is to include alloca.h in any case.
    but if the include is protected, then the build-system has to actively define HAVE_ALLOCA_H in order keep the old behaviour.
    simply ignoring the other build-systems might break them.

  • Miller Puckette

    Miller Puckette - 2012-11-17

    I went ahead and applied the patch by hand. I could be wrong, but isn't there now an alloca()
    function and an alloca.h on all unix-likes? and an alloca() defined in Windows? If so we can blow
    off all the configuration stuff and just conditionall include alloca or malloc.h depending on whether
    we're Windows.

  • Federico Schwindt

    unfortunately you're wrong. alloca is not posix so i wouldn't expect any agreement here.
    as i said openbsd doesn't have alloca.h. i would not be surprised if other bsd are the same. malloc.h is also incorrect. here alloca's prototype is in stdlib.h.

    i will prepare a diff to add the maze of defines in all the configures and what not but I really fail to see why you can simply use AC_CONFIG_HEADERS() since you're already depending on configure.

  • Miller Puckette

    Miller Puckette - 2012-11-19

    I'm preparing to throw out the old "configure" stuff (which, by the way, I didn't originate
    and which I've tried and failed to understand; for some reason I never got AC_CONFIG_HEADERS()
    to work). But I'd still like to know what a good way to declare alloca(0 in a C file is. The autoconf
    web site suggests that I cut and past a 16-line #ifdef mess into every c file using alloca() .. perhaps under
    the "new" (autogen) system something shorter would work, but I'd want to have some confidence I'm
    doing something reasonable.

  • Hans-Christoph Steiner

    AC_CONFIG_HEADERS works fine if your code is only built by the single autotools build system. In Pd's case, there are multiple build systems because of all of the platforms it runs on. There is configure.ac for UNIX and MinGW, src/makefile.nt for Microsoft Visual Studio, libpd for Android, iOS and more. Pd is also included in Rockbox.

    So using some auto-tools things makes it harder on the other platforms.

  • Federico Schwindt

    Not necessarily. You can supply pre-generated config.h for some platforms (that are obviously not going to change) and generate one for the rest.
    So basically if you're using autoconf you could use AC_CONFIG_HEADERS, if not just supply a config.h with all the defines for that platform.

  • Hans-Christoph Steiner

    if you really think its worth your time, then go ahead and prepare a patch that you've tested on OpenBSD, GNU/Linux, Windows, Mac OS X, iOS, Android, Rockbox, and Microsoft Visual Studio. IMHO, things are working well as they are.

  • IOhannes m zmölnig

    or don't use config.h at all, add /D=HAVE_ALLOCA_H to makefile.nt (for those compiling on w32 using msvc) and use AC_CONFIG_HEADERS(alloca.h) for the systems that use autoconf.

    i doubt whether anybody involved in writing configure.ac has done the testing on all platforms known to compile Pd before submitting changes.

  • Miller Puckette

    Miller Puckette - 2012-11-20

    I think HAVE_ALLOCA_H is traditionally used to indicate the existence of a file, "alloca.h" which apparently
    doesn't exist in MSVC. I'm no longer worried about how we can get teh makefiles set up but rather what should go
    in the C code... at teh moment I believe it

    #ifdef HAVE_ALLOCA_H
    # include <alloca.h> /* linux, mac, mingw, cygwin */
    #elif defined _MSC_VER
    # include <malloc.h> /* MSVC */
    # include <stddef.h> /* BSDs for example */

    ... and that I can put that in, clean out the "old" autoconf stuff and voila. Do we all think that that work OK?

  • Hans-Christoph Steiner

    that looks good to me, Miller, but I don't know the BSD stuff.

  • Miller Puckette

    Miller Puckette - 2012-11-26

    OK, added the ifdefs, tested on linux (makefile.gnu) and MSVC (makefile.msvc) , and pushed to git - please report
    back if there are problems on other platforms.

  • Miller Puckette

    Miller Puckette - 2012-12-15
    • status: open --> pending-fixed
  • Federico Schwindt

    Apologies for the silence, I just returned from holidays.

    The changes have helped to some extent but more work is required at least for OpenBSD.
    I will add the patch here once I get everything sorted.

    btw, why you have used stddef.h for alloca? This is not correct but I'm curious where you get the idea from.

  • Federico Schwindt

    • status: pending-fixed --> open-fixed
  • Federico Schwindt

    • status: open-fixed --> pending-fixed
1 2 > >> (Page 1 of 2)


Cancel  Add attachments