{"thread":{"id":"4783","subject":"[PATCH 1/3] configure: Add test for Perl","startedAt":"2006-07-06T12:40:25Z","lastAt":"2006-07-07T11:23:09Z","messageCount":14,"participants":["Dennis Stosberg","Randal L. Schwartz","Timo Hirvonen","Matthias Lederhofer","Gerrit Pape","Alex Riesen","Petr Baudis","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"23311","messageId":"20060706124025.G325584e9@leonov.stosberg.net","threadId":"4783","inReplyTo":null,"subject":"[PATCH 1/3] configure: Add test for Perl","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-07-06T12:40:25Z","receivedAt":"2006-07-06T12:40:25Z","isPatch":true,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"This patch adds two tests to the configuration script. The first\none tries to find a perl binary in the path.  The second one checks\nwhether the found perl is of a sufficient version.\n\nIt also adds a --perl=/path parameter to override the autodetection\nof the perl binary.\n\nSigned-off-by: Dennis Stosberg <dennis@stosberg.net>\n---\n config-lib.sh |   19 ++++++++++++++++++-\n 1 files changed, 18 insertions(+), 1 deletions(-)\n\ndiff --git a/config-lib.sh b/config-lib.sh\nindex 68fecc5..69999a8 100755\n--- a/config-lib.sh\n+++ b/config-lib.sh\n@@ -262,6 +262,7 @@ Installation directories:\n \n Miscellaneous options:\n   --cc=COMPILER          use this C compiler to build MPlayer [gcc]\n+  --perl=PATH            path to perl binary [autodetect]\n   --target=PLATFORM      target platform (i386-linux, arm-linux, etc)\n   --with-install=PATH    use a custom install program (useful if your OS uses\n                          a GNU-incompatible install utility by default and\n@@ -296,6 +297,8 @@ EOF\n \n \t\t--cc=*)\n \t\t\t_cc=`echo $ac_option | cut -d '=' -f 2` ;;\n+\t\t--perl=*)\n+\t\t\t_perl=`echo $ac_option | cut -d '=' -f 2` ;;\n \t\t--target=*)\n \t\t\t_target=`echo $ac_option | cut -d '=' -f 2` ;;\n \t\t--with-install=*)\n@@ -409,8 +412,21 @@ int main(void) { return 0; }\n EOF\n \t{ cc_check && tmp_run; } || die \"unusable compiler or produced binary\"\n \techores yes\n-}\n \n+\techocheck \"for perl\"\n+\tif test -z \"$_perl\" ; then\n+\t\t_perl=`which perl`\n+\t\ttest \"$_perl\" || die \"cannot find path to perl\"\n+\tfi\n+\techores \"$_perl\"\n+\n+\techocheck \"perl version\"\n+\t_perl_version=`\"$_perl\" -e 'require 5.6.0;printf \"%vd\", $^V'`\n+\tif test -z \"$_perl_version\" ; then\n+\t\tdie \"your perl version is too old\"\n+\tfi\n+\techores \"$_perl_version\"\n+}\n \n write_config() {\n \techo \"Creating config.mak.autogen\"\n@@ -420,6 +436,7 @@ write_config() {\n # -------- Generated by configure -----------\n \n CC = $_cc\n+PERL_PATH = $_perl\n INSTALL = $_install\n \n EOF\n-- \n1.4.1\n"},{"id":"23315","messageId":"868xn67umr.fsf@blue.stonehenge.com","threadId":"4783","inReplyTo":"20060706124025.G325584e9@leonov.stosberg.net","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2006-07-06T13:03:40Z","receivedAt":"2006-07-06T13:03:40Z","isPatch":true,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Dennis\" == Dennis Stosberg <dennis@stosberg.net> writes:\n\nDennis> +\t_perl_version=`\"$_perl\" -e 'require 5.6.0;printf \"%vd\", $^V'`\n\nperl -V:version gives you the version like:\n\n        version='5.8.6';\n\nnice and eval-able. :)  But you can just rely on the exit status from\n\n        perl -e 'eval { require 5.006; 1 } or exit 1'\n\nwhich will be good (0) if the perl is new enough, and bad (1) if the perl is\ntoo old.  (Perl4 will really barf and give an error as well, but still\nbe an exit 1.)\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"23316","messageId":"20060706161011.ccc2ea1c.tihirvon@gmail.com","threadId":"4783","inReplyTo":"20060706124025.G325584e9@leonov.stosberg.net","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Timo Hirvonen","fromEmail":"tihirvon@gmail.com","sentAt":"2006-07-06T13:10:11Z","receivedAt":"2006-07-06T13:10:11Z","isPatch":true,"sender":{"key":"tihirvon@gmail.com","avatar":null},"body":"Dennis Stosberg <dennis@stosberg.net> wrote:\n\n> +\techocheck \"for perl\"\n> +\tif test -z \"$_perl\" ; then\n> +\t\t_perl=`which perl`\n> +\t\ttest \"$_perl\" || die \"cannot find path to perl\"\n> +\tfi\n> +\techores \"$_perl\"\n\n\"which\" isn't portable. On SunOS 5.9 \"which foo\" prints error message to\nstdout and returns 0.  I use this in my own configure scripts:\n\npath_find()\n{\n        if test -x \"$1\"\n        then\n                echo \"$1\"\n                return 0\n        fi\n        for i in `echo $PATH | sed 's/:/ /g'`\n        do\n                if test -x \"$i/$1\"\n                then\n                        echo \"$i/$1\"\n                        return 0\n                fi\n        done\n        return 1\n}\n\n-- \nhttp://onion.dynserv.net/~timo/\n"},{"id":"23317","messageId":"20060706132951.G5731ccca@leonov.stosberg.net","threadId":"4783","inReplyTo":"20060706161011.ccc2ea1c.tihirvon@gmail.com","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-07-06T13:29:52Z","receivedAt":"2006-07-06T13:29:52Z","isPatch":true,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"Timo Hirvonen wrote:\n\n> \"which\" isn't portable. On SunOS 5.9 \"which foo\" prints error message to\n> stdout and returns 0.  I use this in my own configure scripts:\n\nYes, you're right and that function looks fine.  I will resend the\npatches later, but I'll wait a few hours for further comments.\n\nRegards,\nDennis\n"},{"id":"23318","messageId":"E1FyUNT-0007Ko-JR@moooo.ath.cx","threadId":"4783","inReplyTo":"20060706161011.ccc2ea1c.tihirvon@gmail.com","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-07-06T13:58:47Z","receivedAt":"2006-07-06T13:58:47Z","isPatch":true,"sender":{"key":"matled@gmx.net","avatar":null},"body":"> \"which\" isn't portable. On SunOS 5.9 \"which foo\" prints error message to\n> stdout and returns 0.  I use this in my own configure scripts:\n> \n> path_find()\n> {\n>         if test -x \"$1\"\n>         then\n>                 echo \"$1\"\n>                 return 0\n>         fi\n>         for i in `echo $PATH | sed 's/:/ /g'`\n>         do\n>                 if test -x \"$i/$1\"\n>                 then\n>                         echo \"$i/$1\"\n>                         return 0\n>                 fi\n>         done\n>         return 1\n> }\n\nThis will not work with spaces in $PATH. I'd do something like this if\ncut is portable (I have only freebsd and linux to test):\n\npath_find()\n{\n    path=\"$PATH\"\n    while [ \"$path\" != \"\" ]; do\n        p=\"`echo $path | cut -d : -f 1`\"\n        if [ \"$p\" = \"$path\" ]; then\n            path=\"\"\n        else\n            path=\"`echo $path | cut -d : -f 2-`\"\n        fi\n        if [ -x \"$p/$1\" ]; then\n            echo \"$p/$1\"\n            return 0\n        fi\n    done\n    return 1\n}\n\nIs there any reason to check the current directory first? \"which\"\ndoesn't do it for me and without ./ in the front it does not work\n(without . is not in $PATH).\n"},{"id":"23319","messageId":"20060706141725.28115.qmail@775c2aaf180a85.315fe32.mid.smarden.org","threadId":"4783","inReplyTo":"E1FyUNT-0007Ko-JR@moooo.ath.cx","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2006-07-06T14:17:25Z","receivedAt":"2006-07-06T14:17:25Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"On Thu, Jul 06, 2006 at 03:58:47PM +0200, Matthias Lederhofer wrote:\n> This will not work with spaces in $PATH. I'd do something like this if\n> cut is portable (I have only freebsd and linux to test):\n\nThis should work with shell/builtins only, no sed/cut:\n\n path=${PATH}:\n while test -n \"$path\"; do\n   p=${path%%:*}/$1\n   test ! -x \"$p\" || { echo \"$p\"; return 0; }\n   path=${path#*:}\n done\n test ! -x \"$1\" || { echo \"$1\" && return 0; }\n return 1\n\nRegards, Gerrit.\n"},{"id":"23320","messageId":"20060706142532.G37e44125@leonov.stosberg.net","threadId":"4783","inReplyTo":"20060706141725.28115.qmail@775c2aaf180a85.315fe32.mid.smarden.org","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-07-06T14:25:33Z","receivedAt":"2006-07-06T14:25:33Z","isPatch":true,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"Gerrit Pape wrote:\n\n> This should work with shell/builtins only, no sed/cut:\n>\n>  path=${PATH}:\n>  while test -n \"$path\"; do\n>    p=${path%%:*}/$1\n>    test ! -x \"$p\" || { echo \"$p\"; return 0; }\n>    path=${path#*:}\n\n$ exec /bin/sh\n$ uname -a\nSunOS hostname 5.9 Generic_118558-25 sun4u sparc SUNW,Ultra-5_10 Solaris\n$ echo ${PATH%%:*}\nbad substitution\n$ echo ${PATH#*:}\nbad substitution\n\nRegards,\nDennis\n"},{"id":"23321","messageId":"20060706172756.a42f1627.tihirvon@gmail.com","threadId":"4783","inReplyTo":"E1FyUNT-0007Ko-JR@moooo.ath.cx","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Timo Hirvonen","fromEmail":"tihirvon@gmail.com","sentAt":"2006-07-06T14:27:56Z","receivedAt":"2006-07-06T14:27:56Z","isPatch":true,"sender":{"key":"tihirvon@gmail.com","avatar":null},"body":"Matthias Lederhofer <matled@gmx.net> wrote:\n\n> This will not work with spaces in $PATH. I'd do something like this if\n> cut is portable (I have only freebsd and linux to test):\n\nThis works at least with SunOS /bin/sh, dash, posh and bash.\n\npath_find()\n{\n        if test -x \"$1\"\n        then\n                echo \"$1\"\n                return 0\n        fi\n\t_ifs=\"$IFS\"\n\tIFS=:\n        for i in $PATH\n        do\n                if test -x \"$i/$1\"\n                then\n\t\t\tIFS=\"$_ifs\"\n                        echo \"$i/$1\"\n                        return 0\n                fi\n        done\n\tIFS=\"$_ifs\"\n        return 1\n}\n\n> Is there any reason to check the current directory first? \"which\"\n> doesn't do it for me and without ./ in the front it does not work\n> (without . is not in $PATH).\n\nIt is not needed but might be useful if PERL is user configurable\nvariable and can contain either full path or basename. For example this\ncode\n\n    test \"$PROG\" || PROG=prog\n    PROG=`path_find \"$PROG\"`\n\nworks with these cases\n\n    $ PROG=/usr/bin/program ./configure\n    $ PROG=program-1.2 ./configure\n\n-- \nhttp://onion.dynserv.net/~timo/\n"},{"id":"23323","messageId":"20060706153445.G424b7ea1@leonov.stosberg.net","threadId":"4783","inReplyTo":"20060706172756.a42f1627.tihirvon@gmail.com","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-07-06T15:34:45Z","receivedAt":"2006-07-06T15:34:45Z","isPatch":true,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"Timo Hirvonen wrote:\n\n>         if test -x \"$1\"\n>         then\n>                 echo \"$1\"\n>                 return 0\n>         fi\n\nWhen run in the Git source directory, this will find the perl/\nsubdir.  If the user gives an absolute path to the perl binary,\nthere will be no auto-detection anyway, so I think we don't need it.\n\n> It is not needed but might be useful if PERL is user configurable\n> variable and can contain either full path or basename. For example this\n> code\n> \n>     test \"$PROG\" || PROG=prog\n>     PROG=`path_find \"$PROG\"`\n> \n> works with these cases\n> \n>     $ PROG=/usr/bin/program ./configure\n>     $ PROG=program-1.2 ./configure\n\nI will add that.  For the compiler, the script already checks $CC.\nI wonder whether\n\n  --with-perl=...\n  --with-python=... \n\nis more common (more similar to autoconf) than\n\n  --perl=\n  --python=\n\nRegards,\nDennis\n"},{"id":"23324","messageId":"81b0412b0607060840g4df16edbm7df69d6c8edcc071@mail.gmail.com","threadId":"4783","inReplyTo":"20060706124025.G325584e9@leonov.stosberg.net","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2006-07-06T15:40:35Z","receivedAt":"2006-07-06T15:40:35Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 7/6/06, Dennis Stosberg <dennis@stosberg.net> wrote:\n>  Miscellaneous options:\n>    --cc=COMPILER          use this C compiler to build MPlayer [gcc]\n\nIs it still MPlayer's?\n"},{"id":"23325","messageId":"20060706154447.G7e29c5fa@leonov.stosberg.net","threadId":"4783","inReplyTo":"81b0412b0607060840g4df16edbm7df69d6c8edcc071@mail.gmail.com","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-07-06T15:44:47Z","receivedAt":"2006-07-06T15:44:47Z","isPatch":true,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"Alex Riesen wrote:\n\n> Is it still MPlayer's?\n\nThat is being fixed in the third patch.\n\nRegards,\nDennis\n"},{"id":"23356","messageId":"20060707110655.GR29115@pasky.or.cz","threadId":"4783","inReplyTo":"20060706161011.ccc2ea1c.tihirvon@gmail.com","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-07-07T11:06:55Z","receivedAt":"2006-07-07T11:06:55Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Jul 06, 2006 at 03:10:11PM CEST, I got a letter\nwhere Timo Hirvonen <tihirvon@gmail.com> said that...\n> Dennis Stosberg <dennis@stosberg.net> wrote:\n> \n> > +\techocheck \"for perl\"\n> > +\tif test -z \"$_perl\" ; then\n> > +\t\t_perl=`which perl`\n> > +\t\ttest \"$_perl\" || die \"cannot find path to perl\"\n> > +\tfi\n> > +\techores \"$_perl\"\n> \n> \"which\" isn't portable. On SunOS 5.9 \"which foo\" prints error message to\n> stdout and returns 0.\n\nWait, Git runs on SunOS 5.9?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nSnow falling on Perl. White noise covering line noise.\nHides all the bugs too. -- J. Putnam\n"},{"id":"23359","messageId":"7vlkr5zmny.fsf@assigned-by-dhcp.cox.net","threadId":"4783","inReplyTo":"20060707110655.GR29115@pasky.or.cz","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-07T11:20:33Z","receivedAt":"2006-07-07T11:20:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n>> \"which\" isn't portable. On SunOS 5.9 \"which foo\" prints error message to\n>> stdout and returns 0.\n>\n> Wait, Git runs on SunOS 5.9?\n\nI thought so.  In any case, the traditionalist way is to split $PATH\nby hand with \"IFS=:\" -- somebody already posted that on this\nthread.\n"},{"id":"23360","messageId":"20060707142309.4d9601dd.tihirvon@gmail.com","threadId":"4783","inReplyTo":"20060707110655.GR29115@pasky.or.cz","subject":"Re: [PATCH 1/3] configure: Add test for Perl","fromName":"Timo Hirvonen","fromEmail":"tihirvon@gmail.com","sentAt":"2006-07-07T11:23:09Z","receivedAt":"2006-07-07T11:23:09Z","isPatch":true,"sender":{"key":"tihirvon@gmail.com","avatar":null},"body":"Petr Baudis <pasky@suse.cz> wrote:\n\n> Dear diary, on Thu, Jul 06, 2006 at 03:10:11PM CEST, I got a letter\n> where Timo Hirvonen <tihirvon@gmail.com> said that...\n> > \"which\" isn't portable. On SunOS 5.9 \"which foo\" prints error message to\n> > stdout and returns 0.\n> \n> Wait, Git runs on SunOS 5.9?\n\nI have no idea.  I noticed the problem with \"which\" when I ported my\ncmus configure scripts to SunOS.\n\nIn the git Makefile there are:\n\nifeq ($(uname_S),SunOS)\n...\n    ifeq ($(uname_R),5.8)\n...\n    ifeq ($(uname_R),5.9)\n\n\nso it at least tries to work ;)  Oh and that 5.9 is apparently kernel\nversion, not OS version.  Sorry for the confusion.\n\n-- \nhttp://onion.dynserv.net/~timo/\n"}]}