Re: Monthly report A-A-P, July 2003
joerg <j.beyer-S0/[email protected]>
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
joerg wrote:
>
>
> Bram Moolenaar wrote:
>
>> - Add an autoconf-like configuration feature. SCons also has a similar
>> feature, it would be a good idea to attempt working on this together.
>> Joerg Beyer also has done some work on this, but has not shown
>> progress the last two months. Closely related to this is
>> automatically finding tools installed on the system (including
>> compilers) and using them for building. I intend to work about two
>> weeks on this.
>
>
> well, it's not that bad :-)
>
> I have code working to detect which header files are available. you
I noticed that the discussion about an autotools replacements gets
going again. So I want to take the chance and post the current
version of what I implemented in this area.
I attach three parts: for one a patch against aap's cvs HEAD
(it took a while to convince the sf-cvs to let me update and diff,
hopefully I did it correct - it is very hot today: 9pm and still
more then 30 degress celsius).
the second part is the conftest module as a tarball (only two
files, just unpack it in the Exec directory of aap).
the third is the example receipe. Just do
aap -f configure.app configure
this runs for one or two seconds and exits without any
message, at least if everything works OK (no news is
good news). But three files are generated:
config.h
config.aap
confdefs.h
If you have questions or suggestions, just post to the list,
I am subsribed.
Joerg
conftest.tgz
(application/x-gtar, 2.6 KB) - not displayed
diffs
(text/plain, 4.6 KB)
Index: Commands.py
===================================================================
RCS file: /cvsroot/a-a-p/Exec/Commands.py,v
retrieving revision 1.88
diff -r1.88 Commands.py
51c51
<
---
> from conftest import featuretest
2939a2940,3031
>
> def parse_modus(varlist):
> """parses the options "oneof", "required" and "optional"
> returns how many entries or varlist have been used (0 or 1)
> and the modus.
> """
> pos = 0
> mod_string = varlist[pos]["name"]
> modus = 'require_all'
> if mod_string == 'oneof}':
> pos = pos + 1
> modus = 'require_one'
> elif mod_string == 'optional}':
> pos = pos + 1
> modus = 'not_required'
> elif mod_string == 'require}':
> pos = pos + 1
> modus = 'require_all'
> return modus, pos
>
> def aap_conf(line_nr, recdict, arg):
> """:conf command *** experimantal *** """
> rpstack = getrpstack(recdict, line_nr)
> varlist = str2dictlist(rpstack,
> expand(line_nr, recdict, arg, Expand(1, Expand.quote_aap)))
>
> # Question: is it a bug or a feature, that an attribute has it
> # it's opening brace cut off?
>
> modus, pos = parse_modus(varlist)
> command = varlist[pos]["name"]
> pos = pos + 1
> #print "pos %d, command: '%s' arg: '%s' varlist: '%s' modus: '%s'" % (pos, command, arg, varlist,modus,)
> ft = recdict["_conf"]
> if command == "headers":
> # :conf headers h1 [h2 [h3 ...] ]
> # h1, h2, h3 are header files.
> hits = 0
> for i in range(pos,len(varlist)):
> header = varlist[i]["name"]
> check = ft.check_header(header)
> if not check and (modus == 'require_all'):
> recipe_error(rpstack, _(":conf %s '%s' failed. need all." % (command, header)))
> if check:
> hits = hits + 1
> if (modus == 'require_one') and (hits>0):
> break
> if (hits == 0) and (modus == 'require_one'):
> recipe_error(rpstack, _(":conf %s '%s' failed. need at least one." % (command, header)))
>
>
> elif command == "libs":
> # :conf libs l1 [l2 [l3 ...] ]
> # l1, l2, l3 are libraries
> hits = 0
> for i in range(pos,len(varlist),2):
> lib = varlist[i]["name"]
> symbol = varlist[i+1]["name"]
> #print "check lib", lib
> check = ft.check_lib(lib, symbol)
> if (not check) and (modus == 'require_all'):
> recipe_error(rpstack, _(":conf %s '%s' failed. need all." % (command, lib)))
> if check:
> hits = hits + 1
> if (modus == 'require_one') and (hits>0):
> break
> if (hits == 0) and (modus == 'require_one'):
> recipe_error(rpstack, _(":conf %s '%s' failed. need at least one." % (command, lib)))
>
> #if not ft.check_lib(lib, symbol):
> # recipe_error(rpstack, _(":conf %s '%s' '%s' failed" %
> # (command, lib, symbol)))
>
> elif command == "compiler":
> # :conf compiler SYMBOL compilername
> # SYMBOL = CC|CXX
> # compilername = gcc|cc|g++|c++|...
> l = len(varlist)-pos
> symbol = "CC"
> name ="gcc cc"
> if l>1:
> symbol = varlist[pos]["name"]
> if symbol == "CXX":
> name = "g++ c++"
> if l>2:
> name = varlist[pos+1]["name"]
> if not ft.check_compiler(symbol, name):
> recipe_error(rpstack, _(":conf %s failed" % (command, )))
> else:
> recipe_error(rpstack, _(":conf %s failed" % arg))
> ft.dump()
>
Index: Scope.py
===================================================================
RCS file: /cvsroot/a-a-p/Exec/Scope.py,v
retrieving revision 1.8
diff -r1.8 Scope.py
10a11
> from conftest import featuretest
326a328,331
> # The "_conf" entry is used for collecting of
> # configuration results
> recdict["_conf"] = featuretest.FeatureTester()
>
431a437,438
> new_recdict["_conf"] = recdict["_conf"]
>
519c526
< "_caller" ] + recdict["_top"].user_scope_names
---
> "_caller", "_conf" ] + recdict["_top"].user_scope_names
*** Process.py_orig 2003-08-07 21:48:52.000000000 +0200
--- Process.py 2003-08-07 21:46:05.000000000 +0200
***************
*** 53,58 ****
--- 53,59 ----
"chmod",
"commit",
"commitall",
+ "conf",
"copy",
"del",
"deldir",
configure.aap
(text/plain, 711 B)
configure:
# find a C compiler, assign it's name to the aap variable CC
:conf compiler CC gcc cc
#
# find a C++ compiler, assign it's name to the aap variable CXX
:conf compiler CXX g++ c++ gcc
#
:conf headers dirent.h fcntl.h fnmatch.h stdlib.h string.h unistd.h sys/dir.h sys/stat.h sys/types.h
:conf {oneof} headers time.h sys/times.h
# the next header does not exist
:conf {optional} headers was_willst_du.h huhu.h
# find the lib-z and check if it contains the symbol compress
:conf libs z compress
# the next lib does not exist
:conf {optional} libs strange ups
:conf {optional} libs ssl ssl_new
# :conf headers fcntl.h errno.h ups.h