The generated-configure.sh script is dead - autoconf seems to write into the sources in the build process

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Tue Feb 6 18:34:44 UTC 2018


On 2018-02-06 19:01, Volker Simonis wrote:
> On Tue, Feb 6, 2018 at 6:28 PM, Magnus Ihse Bursie
> <magnus.ihse.bursie at oracle.com> wrote:
>>
>> On 2018-02-06 15:53, Volker Simonis wrote:
>>> Hi,
>>>
>>> as Matthias wrote, we're usually running configure from a newly
>>> created build directory which is outside the source tree. Also, the
>>> build user who calls configure may differ from the user owning the
>>> source tree. I'd therefor like to propose the following small change
>>> which checks from where 'configure' was called. If configure was
>>> called from within the source tree, nothing changes, otherwise we will
>>> create the '.build' helper directory which contains
>>> 'generated-configure.sh' right in the current build directory:
>>>
>>> diff -r fd40b0b3d849 make/autoconf/configure
>>> --- a/make/autoconf/configure   Tue Feb 06 23:49:10 2018 +0530
>>> +++ b/make/autoconf/configure   Tue Feb 06 15:46:48 2018 +0100
>>> @@ -52,7 +52,16 @@
>>>      fi
>>>      build_support_dir="$CUSTOM_ROOT/.build"
>>>    else
>>> -  build_support_dir="$TOPDIR/.build"
>>> +  # Test from where we are running configure, in or outside of src root.
>>> +  if test "x$TOPDIR" = `pwd`; then
>>> +    # We are running configure from the src root.
>>> +    # Create 'build_support_dir' under $TOPDIR
>>> +    build_support_dir="$TOPDIR/.build"
>>> +  else
>>> +    # We are running configure from outside of the src dir.
>>> +    # Create 'build_support_dir' in the current directory.
>>> +    build_support_dir=".build"
>>> +  fi
>>>    fi
>>>
>>>    conf_script_dir="$TOPDIR/make/autoconf"
>>>
>>> Would you be OK with this change? If nobody complains, I will open a
>>> JBS issue and submit a webrev for formal review.
>> Hi Volker and Matthias,
>>
>> I'm sorry I missed this usecase. :-(
> No problem - we're here to fix it :)
>
>> I think the patch is OK. I'm just thinking about the "make reconfigure"
>> case. I guess it works as long as you call "make reconfigure" from the same
>> directory, but then again, that's probably the likely way to work in this
>> case. It will *not* work in the case that you do e.g.:
>> mkdir -p build/mybuild && cd build/mybuild
>> bash ../../configure
>> cd ../..
>> make CONF=mybuild
>>
>> but then again, mixing "methods" like that is perhaps not so common, and the
>> only penalty is that we get two .build directories.
>>
>> Maybe we should even use "configure-support" instead of ".build" as
>> build_support_dir for the "outside of src dir" case? It would certainly fit
>> in better with already existing structure in the build output directory.
>>
> This was my first idea as well. Unfortunately,
> "$OUTPUTDIR/configure-support" is only created from
> generated-configure.sh (from basics.m4) so we have a chicken/egg
> problem here.
>
> Do you propose to already create "$OUTPUTDIR/configure-support" in the
> configure script before creating generated-configure.sh ?

Yes.

If we run configure from TOPDIR then we to not know the name of 
$OUTPUTDIR until a bit into the configure script. But if we start 
configure from a non-TOPDIR directory, then it will be used as 
$OUTPUTDIR so we can (and should!) use that fact. Just as .build is 
created if it does not exist, so configure-support should be created if 
it does not exist.

Something like this:

diff --git a/make/autoconf/basics.m4 b/make/autoconf/basics.m4
--- a/make/autoconf/basics.m4
+++ b/make/autoconf/basics.m4
@@ -814,6 +814,7 @@
            | $SED -e 's/config.log//g' \
                -e 's/configure.log//g' \
                -e 's/confdefs.h//g' \
+              -e 's/configure-support//g' \
                -e 's/ //g' \
            | $TR -d '\n'`
        if test "x$filtered_files" != x; then
diff --git a/make/autoconf/configure b/make/autoconf/configure
--- a/make/autoconf/configure
+++ b/make/autoconf/configure
@@ -52,7 +52,16 @@
    fi
    build_support_dir="$CUSTOM_ROOT/.build"
  else
-  build_support_dir="$TOPDIR/.build"
+  # Test from where we are running configure, in or outside of src root.
+  if test "x$TOPDIR" = `pwd`; then
+    # We are running configure from the src root.
+    # Create 'build_support_dir' under $TOPDIR
+    build_support_dir="$TOPDIR/.build"
+  else
+    # We are running configure from outside of the src dir.
+    # Create 'build_support_dir' in the current directory.
+    build_support_dir="configure-support"
+  fi
  fi

  conf_script_dir="$TOPDIR/make/autoconf"


(It turned out we also need to accept that "configure-support" exists in 
the "empty" directory)

/Magnus

>
>> /Magnus
>>
>>
>>
>>> Regards,
>>> Volker
>>>
>>>
>>> On Tue, Feb 6, 2018 at 2:27 PM, Baesken, Matthias
>>> <matthias.baesken at sap.com> wrote:
>>>> Hello I noticed  that   after replacing   generated-configure.sh   and
>>>> using autoconf ,    the  build process  writes into the sources .
>>>> Error  looks like this   :
>>>>
>>>> Runnable configure script is not present
>>>> Generating runnable configure script
>>>> mkdir: cannot create directory `/openjdk/linuxppc64/jdk/.build':
>>>> Permission denied
>>>>
>>>>
>>>> ( I run  configure  from  a separate  generation directory  )
>>>>
>>>> Is there a way around this  currently  (e.g.   placing the .build folder
>>>> where configure is started and not into the sources ?) ?
>>>>
>>>>
>>>> Thanks ,Matthias
>>




More information about the build-dev mailing list