mod_log_sql-1.100/ 0000755 0001750 0001750 00000000000 10171050565 013754 5 ustar zigo zigo 0000000 0000000 mod_log_sql-1.100/docs/ 0000755 0001750 0001750 00000000000 10171050565 014704 5 ustar zigo zigo 0000000 0000000 mod_log_sql-1.100/docs/Makefile.in 0000644 0001750 0001750 00000003321 10171046100 016736 0 ustar zigo zigo 0000000 0000000 # @configure_input@
# Modify these top variables.
SUBDIRS =
EXTRA_DIST = README \
manual.xml \
manual.html
#Don't modify anything below here
srcdir = @abs_srcdir@
builddir = @abs_builddir@
STD_DIST = Makefile.in
DISTFILES = $(STD_DIST) $(EXTRA_DIST)
all: all-subdirs
%.html: %.xml
@xmlto html-nochunks $<
%.pdf: %.xml
@xmlto pdf $<
all-subdirs install-subdirs update-subdirs clean-subdirs distclean-subdirs:
@otarget=`echo $@|sed s/-subdirs//`; \
list=' $(SUBDIRS)'; \
for i in $$list; do \
if test -d "$$i"; then \
target="$$otarget"; \
echo "Making $$target in $$i"; \
if test "$$i" = "."; then \
made_local=yes; \
target="local-$$target"; \
fi; \
(cd $$i && $(MAKE) $$target) || exit 1; \
fi; \
done; \
include:
rm -rf include
ln -s @APACHE_INCDIR@ include
install: install-subdirs
update: update-subdirs
clean: clean-subdirs
distclean: clean distclean-subdirs
$(RM) Makefile
DESTDIR = @PACKAGE_NAME@-@PACKAGE_VERSION@
DESTTGZ = $(DESTDIR).tar.gz
dist:
@rm -rf $(DESTDIR); \
list=' $(SUBDIRS)'; \
for i in $$list; do \
if test -d "$$i"; then \
target=local-dist; \
echo "Making $$target in $$i"; \
if test "$$i" = "."; then \
made_local=yes; \
target="local-dist"; \
fi; \
NEWDESTDIR=$(builddir)/$(DESTDIR)/$$i; \
echo $(NEWDESTDIR); \
(cd $$i && $(MAKE) DESTDIR=$(builddir)/$(DESTDIR)/$$i $$target) || exit 1; \
fi; \
done;
if test "$$made_local" != "yes"; then \
$(MAKE) "local-dist" || exit 1; \
fi
tar -zcf $(DESTTGZ) $(DESTDIR)
rm -rf $(DESTDIR)
local-dist: $(DISTFILES)
mkdir -p $(DESTDIR)
cp -dp --parents $(DISTFILES) $(DESTDIR)
.PHONY: include all-subdirs update-subdirs install-subdirs \
clean-subdirs distclean-subdirs dist
mod_log_sql-1.100/docs/README 0000644 0001750 0001750 00000000434 10171046101 015554 0 ustar zigo zigo 0000000 0000000 The "original" document is the Docbook file "manual.xml" -- all other
files here are derived from it.
To read the HTML docs, open manual.html in your browser.
To generate other formats of the documentation use xmlto or your favorite
xslt docbook converter to convert the xml file.
mod_log_sql-1.100/docs/manual.xml 0000644 0001750 0001750 00000411026 10171050342 016700 0 ustar zigo zigo 0000000 0000000
urkle <at> outoforder <dot> cc">
]>
mod_log_sql Manual
Edward
Rudd
Conversion from Lyx to DocBook
Current Maintainer
&EmailContact;
Christopher
B.
Powell
Original documentation author.
chris <at> grubbybaby <dot> com
2001
2002
2003
Christopher B. Powell
2004
2005
Edward Rudd
1.3
2005-01-11
Updated for mod_log_sql v1.100
1.2
2004-04-08
Updated for mod_log_sql v1.97
1.1
2004-03-02
Updated for mod_log_sql v1.96
1.0
2004-01-22
Initial Conversion from Lyx to Docbook
Introduction
Summary
This Apache module will permit you to log to a SQL database; it can log each access request as well as data associated with each request: cookies, notes, and inbound/outbound headers. Unlike logging to a flat text file -- which is standard in Apache -- a SQL-based log exhibits tremendous flexibility and power of data extraction. (See FAQ entry for further discussion and examples of the advantages to SQL.)
This module can either replace or happily coexist with mod_log_config, Apache's text file logging facility. In addition to being more configurable than the standard module, mod_log_sql is much more flexible.
Approach
This project was formerly known as "mod_log_mysql." It was renamed "mod_log_sql" in order to reflect the project goal of database in-specificity. The module currently supports MySQL, but support for other database back-ends is underway.
In order to save speed and overhead, links are kept alive in between queries. This module uses one dedicated SQL link per httpd child, opened by each child process when it is born. Among other things, this means that this module supports logging into only one MySQL server, and for now, also, only one SQL database. But that's a small tradeoff compared to the blinding speed of this module. Error reporting is robust throughout the module and will inform the administrator of database issues in the Apache ErrorLog for the server/virtual server.
Virtual hosts are supported in the same manner they are in the regular logging modules. The administrator defines some basic 'global' directives in the main server config, then defines more specific 'local' directives inside each VirtualHost stanza.
A robust "preserve" capability has now been implemented. This permits the module to preserve any failed INSERT commands to a local file on its machine. In any situation that the database is unavailable -- e.g. the network fails or the database host is rebooted -- mod_log_sql will note this in the error log and begin appending its log entries to the preserve file (which is created with the user and group ID of the running Apache process, e.g. "nobody/nobody" on many Linux installations). When database availability returns, mod_log_sql seamlessly resumes logging to it. When convenient for the sysadmin, he/she can easily import the preserve file into the database because it is simply a series of SQL insert statements.
What gets logged by default?
All the data that would be contained in the "Combined Log Format" is logged by default, plus a little extra. Your best bet is to begin by accepting this default, then later customize the log configuration based on your needs. The documentation of the run-time directives includes a full explanation of what you can log, including examples -- see section .
Miscellaneous Notes
Note which directives go in the 'main server config' and which directives apply to the 'virtual host config'. This is made clear in the directive documentation.
The 'time_stamp' field is stored in an UNSIGNED INTEGER format, in the standard unix "seconds since the epoch" format. This is superior to storing the access time as a string due to size requirements: an UNSIGNED INT requires 4 bytes, whereas an Apache date string (e.g. "18/Nov/2001:13:59:52 -0800") requires 26 bytes: those extra 22 bytes become significant when multiplied by thousands of accesses on a busy server. Besides, an INT type is far more flexible for comparisons, etc.
In MySQL 3.21 and above you can easily convert this to a human readable format using from_unixtime(), e.g.:
select remote_host,request_uri,from_unixtime(time_stamp) from access_log;
The enclosed perl program "make_combined_log.pl" extracts your access log in a format that is completely compatible with the Combined Log Format. You can then feed this to your favorite web log analysis tool.
The table's string values can be CHAR or VARCHAR, at a length of your choice. VARCHAR is superior because it truncates long strings; CHAR types are fixed-length and will be padded with spaces, resulting in waste. Just like the time_stamp issue described above, that kind of space waste multiplies over thousands of records.
Be careful not to go overboard setting fields to NOT NULL. If a field is marked NOT NULL then it must contain data in the INSERT statement, or the INSERT will fail. These mysterious failures can be quite frustrating and difficult to debug.
When Apache logs a numeric field, it uses a '-' character to mean "not applicable," e.g. the number of bytes returned on a 304 (unchanged) request. Since '-' is an illegal character in an SQL numeric field, such fields are assigned the value 0 instead of '-' which, of course, makes perfect sense anyway.
Author / Maintainer
The actual logging code was taken from the already existing flat file text modules, so all that credit goes to the Apache Software Foundation.
The MySQL routines and directives were added by Zeev Suraski <bourbon@netvision.net.il>.
All changes from 1.06+ and the new documentation were added by Chris Powell chris <at> grubbybaby <dot> com. It seems that the module had fallen into the "un-maintained" category -- it had not been updated since 1998 -- so Chris adopted it as the new maintainer.
In December of 2003, Edward Rudd &EmailContact; porting the module to Apache 2.0, cleaning up the code, converting the documentation to DocBook, optimizing the main logging loop, and added the much anticipated database abstraction layer.
As of February 2004, Chris Powell handed over maintenance of the module over to Edward Rudd. So you should contact Edward Rudd about the module from now on.
Mailing Lists
A general discussion and support mailing list is provided for mod_log_sq at lists.outoforder.cc. To subscribe to the mailing list send a blank e-mail to mod_log_sql-subscribe@lists.outoforder.cc. The list archives can be accessed via Gmane.org's mailng list gateway via any new reader news://news.gmane.org/gmane.comp.apache.mod-log-sql, or via a web browser at http://news.gmane.org/gmane.comp.apache.mod-log-sql.
Installation
Requirements
A compatible system. mod_log_sql was authored and tested on systems based on Red Hat Linux (Red Hat, Mandrake), but the module should easily adapt to any modern distribution. mod_log_sql has also been ported successfully to Solaris and FreeBSD.
Apache 1.3 or 2.0, 1.2 is no longer supported, but may still compile. Ideally you should already have successfully compiled Apache and understand the process, but this document tries to make it simple for beginners.
The MySQL development headers. This package is called different things on different distributions. For example, Red Hat 6.x calls this RPM "MySQL-devel" whereas Mandrake calls it "libmysql10-devel." Both MySQL 3.23.x and 4.x are supported.
MySQL >= 3.23.15 configured, installed and running on either localhost or an accessible networked machine. You should already have a basic understanding of MySQL and how it functions.
Optionally, if you want to be able to log SSL information such as keysize or cipher, you need OpenSSL and mod_ssl installed.
Compiling and Installing
Unpack the archive into a working directory.
$ tar -xzf mod_log_sql-1.94.tar.gz
$ cd mod_log_sql-1.9
run configure to configure the source directory.
$ ./configure
The configure script should automatically detect all the required libraries and program if the are installed in standard locations.. If it returns an error, here is a description of the arguments you can specify when you run configure.
--with-apxs=/usr/sbin/apxs
This is the full path to the apxs binary, or the directory which contains the program. This program is part of the Apache 1.3 and 2.0 installation.
The default is to search /usr/bin/apxs and /usr/sbin/apxs.
Specifying a directory here will search $directory/apxs, $directory/bin/apxs, and $directory/sbin/apxs
If you have more than one version of Apache installed, you need to specify the correct apxs binary for the one you wish to compile for.
--with-mysql=/path/to/mysql
This is the directory to search for the libmysqlclient library and the MySQL headers.
The default is to search /usr/include, /usr/include/mysql, /usr/local/include, and /usr/local/include/mysql for MySQL headers.. And /usr/lib. /usr/lib/mysql, /usr/local/lib, and /usr/local/lin/mysql for the MySQL libraries.
Specifying this testargument will search $directory/include and $directory/mysql for MySQL headers. And $directory/lib and $directory/lib/mysql for MySQL libraries.
--enable-ssl
Specifying this argument will enable the search for mod_ssl and SSL headers, and if found will enable compilation of SSL support into mod_log_sql. SSL support is compiled into a separate module that can be loaded after the main mod_log_sql.
--with-ssl-inc=/usr/include/openssl
This is the path to the SSL toolkit header files that were used to compile mod_ssl. If you want SSL support you most likely need to specify this.
The default is to search /usr/include and /usr/include/openssl.
Specifying this argument will search that directory for the SSL headers.
--with-db-inc=/usr/include/db1
This argument is only needed when compiling SSL support for Apache 1.3, and needs to be the directory which contains the ndbm.h header file. You can find this by using
$ locate ndbm.h
/usr/include/db1/ndbm.h
/usr/include/gdbm/ndbm.h
As far as I can tell, there is no difference as to which you specify, but it should be the one that you compiled mod_ssl with.
The default is /usr/include/db1, which should work on most systems.
--disable-apachetest
This will disable the apache version test. However there is a side affect if you specify this where I will not be able to determine which version of Apache you are compiling for. So don't specify this.. If you are having troubles with the script detecting your Apache version, then send a bug report along with your system OS version and versions of related packages.
--disable-mysqltest
This will disable the MySQL compile test. Specify this if for some reason the test fail but you know you have specified the correct directories. If mod_los_sql also fails to compile report a bug along with your system OS version and versions of related packages.
Now compile the module with GNU make. You may have to specify gmake on some systems like FreeBSD.
$ gmake
If there were no errors, you can now install the module(s). If you compiled as a non-root user you may need to switch users with su or sudo.
$ su -c "gmake install"
Password:
Now edit your Apache configuration and load the modules.
If you are loading the SSL logging module, you need to make sure it is loaded after mod_ssl and mod_log_sql.
If you have previously used mod_log_sql version 1.18, the name of the module has changed from sql_log_module to log_sql_module (the first parameter to LoadModule)
If you are upgrading from any release earlier than 1.97 you need to add an extra LoadModule directive to load the database driver (ie mysql).
Insert these lines to either the main httpd.conf or a file included via an include directive.
LoadModule log_sql_module modules/mod_log_sql.so
LoadModule log_sql_mysql_module modules/mod_log_sql_mysql.so
<IfModule mod_ssl.c>
LoadModule log_sql_ssl_module moduels/mod_log_sql_ssl.so
</IfModule>
If you did not compile SSL support in mod_log_sql, do not include the lines between the <IfModule> directives.
If you are using Apache 1.3 you may need add these lines later in the configuration.
AddModule mod_log_sql.c
AddModule mod_log_sql_mysql.c
<IfModule mod_ssl.c>
AddModule mod_log_sql_ssl.c
</IfModule>
If you did not compile SSL support in mod_log_sql, do not include the lines between the <IfModule> directives.
Configuration
Preparing MySQL for logging
You have to prepare the database to receive data from mod_log_sql, and set up run-time directives in httpd.conf to control how and what mod_log_sql logs.
This section will discuss how to get started with a basic configuration. Full documentation of all available run-time directives is available in section .
mod_log_sql can make its own tables on-the-fly, or you can pre-make the tables by hand. The advantage of letting the module make the tables is ease-of-use, but for raw performance you will want to pre-make the tables in order to save some overhead. In this basic setup we'll just let the module create tables for us.
We still need to have a logging database created and ready, so run the MySQL command line client and create a database:
# mysql -uadmin -pmypassword
Enter password:
mysql> create database apachelogs;
If you want to hand-create the tables, run the enclosed 'create-tables' SQL script as follows ("create_tables.sql" needs to be in your current working directory).
mysql> use apachelogs
Database changed
mysql> source create_tables.sql
Create a specific MySQL userid that httpd will use to authenticate and enter data. This userid need not be an actual Unix user. It is a userid internal to MySQL with specific privileges. In the following example command, "apachelogs" is the database, "loguser" is the userid to create, "my.apachemachine.com" is the name of the Apache machine, and "l0gger" is the password to assign. Choose values that are different from these examples.
mysql> grant insert,create on apachelogs.* to loguser@my.apachemachine.com identified by 'l0gger';
You may be especially security-paranoid and want "loguser" to not have "create" capability within the "apachelogs" database. You can disable that privilege, but the cost is that you will not be able to use the module's on-the-fly table creation feature. If that cost is acceptable, hand-create the tables as described in step and use the following GRANT statement instead of the one above:
mysql> grant insert on apachelogs.* to loguser@my.apachemachine.com identified by 'l0gger';
Enable full logging of your MySQL daemon (at least temporarily for debugging purposes) if you don't do this already. Edit /etc/my.cnf and add the following line to your [mysqld] section:
log=/var/log/mysql-messages
Then restart MySQL
# /etc/rc.d/init.d/mysql restart
A very basic logging setup in Apache
Tell the module what database to use and the appropriate authentication information.
So, edit httpd.conf and insert the following lines somewhere after any LoadModule / AddModule statements. Make sure these statements are "global," i.e. not inside any VirtualHost stanza. You will also note that you are embedding a password in the file. Therefore you are advised to "chmod 660 httpd.conf" to prevent unauthorized regular users from viewing your database user and password.
Use the MySQL database called "apachelogs" running on "dbmachine.foo.com". Use username "loguser" and password "l0gg3r" to authenticate to the database. Permit the module create tables for us.
Basic Example
LogSQLLoginInfo mysql://loguser:l0gg3r@dbmachine.foo.com/apachelogs
LogSQLCreateTables on
If your database resides on localhost instead of another host, specify the MySQL server's socket file as follows:
LogSQLDBParam socketfile /your/path/to/mysql.sock
If your database is listening on a port other than 3306, specify the correct TCP port as follows:
LogSQLDBParam port 1234
The actual logging is set up on a virtual-host-by-host basis. So, skip down to the virtual host you want to set up. Instruct this virtual host to log entries to the table "access_log" by inserting a LogSQLTransferLogTable directive. (The LogSQLTransferLogTable directive is the minimum required to log -- other directives that you will learn about later simply tune the module's behavior.)
<VirtualHost 1.2.3.4>
[snip]
LogSQLTransferLogTable access_log
[snip]
</VirtualHost>
Restart apache.
# /etc/rc.d/init.d/httpd stop
# /etc/rc.d/init.d/httpd start
Testing the basic setup
Visit your web site in a browser to trigger some hits, then confirm that the entries are being successfully logged:
# mysql -hdbmachine.foo.com -umysqladmin -p -e "select * from access_log" apachelogs
Enter password:
Several lines of output should follow, corresponding to your hits on the site. You now have basic functionality. Don't disable your regular Apache logs until you feel comfortable that the database is behaving as you'd like and that things are going well. If you do not see any entries in the access_log, please consult section of the FAQ on how to debug and fix the situation.
You can now activate the advanced features of mod_log_sql, which are described in the next section.
How to tune logging with run-time directives
Instructing the module what to log
The most basic directive for the module is LogSQLTransferLogFormat, which tells the module which information to send to the database; logging to the database will not take place without it. Place a LogSQLTransferLogFormat directive in the VirtualHost stanza of each virtual host that you want to activate.
After LogSQLTransferLogFormat you supply a string of characters that tell the module what information to log. In the configuration directive reference (section ) there is a table which clearly defines all the possible things to log. Let's say you want to log only the "request time," the "remote host," and the "request"; you'd use:
LogSQLTransferLogFormat hUS
But a more appropriate string to use is
LogSQLTransferLogFormat AbHhmRSsTUuv
which logs all the information required to be compatible with the Combined Log Format (CLF).
If you don't choose to log everything that is available, that's fine. Fields in the unused columns in your table will simply contain NULL.
Some of the LogSQLTransferLogFormat characters require a little extra configuration:
If you specify 'c' to indicate that you want to log the cookie value, you must also tell the module which cookie you mean by using LogSQLWhichCookie -- after all, there could be many cookies associated with a given request. Fail to specify LogSQLWhichCookie, and no cookie information at all will be logged.
If you specify 'M' to indicate that you want to log the machine ID, you must also tell the module this machine's identity using the LogSQLMachineID directive. Fail to specify LogSQLMachineID, and a simple '-' character will be logged in the machine_id column.
Instructing the module what NOT to log using filtering directives
One "accept" and two "ignore" directives allow you to fine-tune what the module should not log. These are very handy for keeping your database as uncluttered as possible and keeping your statistics free of unneeded numbers. Think of each one as a gatekeeper.
It is important to remember that each of these three directives is purely optional. mod_log_sql's default is to log everything.
When a request comes in, the contents of LogSQLRequestAccept are evaluated first. This optional, "blanket" directive lets you specify that only certain things are to be accepted for logging, and everything else discarded. Because it is evaluated before LogSQLRequestIgnore and LogSQLRemhostIgnore it can halt logging before those two filtering directives "get their chance."
Once a request makes it past LogSQLRequestAccept, it still can be excluded based on LogSQLRemhostIgnore and LogSQLRequestIgnore. A good way to use LogSQLRemhostIgnore is to prevent the module from logging the traffic that your internal hosts generate. LogSQLRequestIgnore is great for preventing things like requests for "favicon.ico" from cluttering up your database, as well as excluding the various requests that worms make, etc.
You can specify a series of strings after each directive. Do not use any type of globbing or regular-expression syntax -- each string is considered a match if it is a substring of the larger request or remote-host; the comarison is case-sensitive. This means that "LogSQLRemhostIgnore micro" will ignore requests from "microsoft.com," "microworld.net," "mymicroscope.org," etc. "LogSQLRequestIgnore gif" will instruct the module to ignore requests for "leftbar.gif," "bluedot.gif" and even "giftwrap.jpg" -- but "RED.GIF" and "Tree.Gif" would still get logged because of case sensitivity.
A summary of the decision flow:
If LogSQLRequestAccept exists and a request does not match anything in that list, it is discarded.
If a request matches anything in the LogSQLRequestIgnore list, it is discarded.
If a reqiest matches anything in the LogSQLRemhostIgnore list, it is discarded.
Otherwise the request is logged.
This means that you can have a series of directives similar to the following:
LogSQLRequestAccept .html .gif .jpg
LogSQLRequestIgnore statistics.html bluedot.jpg
So the first line instructs the module to only log files with html, gif and jpg suffixes; requests for "formail.cgi" and "shopping-cart.pl" will never be considered for logging. ("LeftArrow.JPG" will also never be considered for logging -- remember, the comparison is case sensitive.) The second line prunes the list further -- you never want to log requests for those two objects.
If you want to match all the hosts in your domain such as "host1.corp.foo.com" and "server.dmz.foo.com", simply specify:
LogSQLRemhostIgnore foo.com
A great way to catch the vast majority of worm-attack requests and prevent them from being logged is to specify:
LogSQLRequestIgnore root.exe cmd.exe default.ida
To prevent the logging of requests for common graphic types, make sure to put a '.' before the suffix to avoid matches that you didn't intend:
LogSQLRequestIgnore .gif .jpg
Advanced logging scenarios
Using the module in an ISP environment
mod_log_sql has three basic tiers of operation:
The administrator creates all necessary tables by hand and configures each Apache VirtualHost by hand. (LogSQLCreateTables Off)
The module is permitted to create necessary tables on-the-fly, but the administrator configures each Apache VirtualHost by hand. (LogSQLCreateTables On)
The module is permitted to create all necessary tables and to make intelligent, on-the-fly configuration of each VirtualHost. (LogSQLMassVirtualHosting On)
Many users are happy to use the module in its most minimal form: they hand-create any necessary tables (using "create_tables.sql"), and they configure each VirtualHost by hand to suit their needs. However, some administrators need extra features due to a large and growing number of VirtualHosts. The LogSQLMassVirtualHosting directive activates module capabilities that make it far easier to manage an ISP environment, or any situation characterized by a large and varying number of virtual servers.
the on-the-fly table creation feature is activated automatically
the transfer log table name is dynamically set from the virtual host's name (example: a virtual host "www.grubbybaby.com" gets logged to table "access_www_grubbybaby_com")
There are numerous benefits. The admin will not need to create new tables for every new VirtualHost. (Although the admin will still need to drop the tables of virtual hosts that are removed.) The admin will not need to set LogSQLTransferLogTable for each virtual host -- it will be configured automatically based on the host's name. Because each virtual host will log to its own segregated table, data about one virtual server will segregate from others; an admin can grant users access to the tables they need, and they will be unable to view data about another user's virtual host.
In an ISP scenario the admin is likely to have a cluster of many front-end webservers logging to a back-end database. mod_log_sql has a feature that permits analysis of how well the web servers are loadbalancing: the LogSQLMachineID directive. The administrator uses this directive to assign a unique identifier to each machine in the web cluster, e.g. "LogSQLMachineID web01," "LogSQLMachineID web02," etc. Used in conjunction with the 'M' character in LogSQLTransferLogFormat, each entry in the SQL log will include the machine ID of the machine that created the entry. This permits the administrator to count the entries made by each particular machine and thereby analyze the front-end loadbalancing algorithm.
Logging many-to-one data in separate tables
A given HTTP request can have a one-to-many relationship with certain kinds of data. For example, a single HTTP request can have 4 cookies, 3 headers and 5 "mod_gzip" notes associated with it. mod_log_sql is capable of logging these relationships due to the elegance of SQL relational data.
You already have a single table containing access requests. One of the columns in that table is 'id' which is intended to contain the unique request ID supplied by the standard Apache module mod_unique_id -- all you need to do is compile in that module and employ the LogSQLTransferLogFormat character 'I'. Thereafter, each request gets a unique ID that can be thought of as a primary key within the database, useful for joining multiple tables. So let's envision several new tables: a notes table, a cookies table, and a table for inbound and outbound headers.
<tblAcc>access_log
id
remote_host
request_uri
time_stamp
status
bytes_sent
PPIDskBRH30AAGPtAsg
zerberus.aiacs.net
/mod_log_sql/index.html
1022493617
200
2215
<tblNotes>notes_log
id
item
val
PPIDskBRH30AAGPtAsg
mod_gzip_result
OK
PPIDskBRH30AAGPtAsg
mod_gzip_compression_ratio
69
<tblHdr>headers_log
id
item
val
PPIDskBRH30AAGPtAsg
Content-Type
text/html
PPIDskBRH30AAGPtAsg
Accept-Encoding
gzip, deflate
PPIDskBRH30AAGPtAsg
Expires
Tue, 28 May 2002 10:00:18 GMT
PPIDskBRH30AAGPtAsg
Cache-Control
max-age=86400
We have a certain request, and its unique ID is "PPIDskBRH30AAGPtAsg". Within each separate table will be multiple entries with that request ID: several cookie entries, several header entries, etc. As you can see in tables [tblAcc], [tblNotes] and [tblHdr], you have a one-to-many relationship for request PPIDskBRH30AAGPtAsg: that one access has two associated notes and four associated headers. You can extract this data easily using the power of SQL's "select" statement and table joins. To see the notes associated with a particular request:
select a.remote_host, a.request_uri, n.item, n.val from access_log a, notes_log n
where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';
access_log joined to notes_log
remote_host
request_uri
item
val
zerberus.aiacs.net
/mod_log_sql/index.html
mod_gzip_result
OK
zerberus.aiacs.net
/mod_log_sql/index.html
mod_gzip_compression_ratio
69
Naturally you can craft similar statements for the outboud headers, inbound headers and cookies, all of which can live in separate tables. Your statements are limited in power only by your skill with SQL.
In order to use this capability of mod_log_sql, you must do several things.
Compile mod_unique_id into Apache (statically or as a DSO). mod_log_sql employs the unique request ID that mod_unique_id provides in order to key between the separate tables. You can still log the data without mod_unqiue_id, but it will be completely uncorrelated and you will have no way to discern any meaning.
Create the appropriate tables. This will be done for you if you permit mod_log_sql to create its own tables using LogSQLCreateTables On, or if you use the enclosed "create_tables.sql" script.
Create a SQL index on the "id" column. Without this index, table joins will be deathly slow. I recommend you consult the MySQL documentation on the proper way to create a column index if you are not familiar with this operation.
Within each appropriate VirtualHost stanza, use the LogSQLWhich* and LogSQL*LogTable directives to tell the module what and where to log the data. In the following example, I have overridden the name for the notes table whereas I have left the other table names at their defaults. I have then specified the cookies, headers and notes that interest me. (And as you can see, these directives do not require me to add any characters to LogSQLTransferLogTable.)
<VirtualHost 216.231.36.128>
(snip)
LogSQLNotesLogTable notestable
LogSQLWhichCookies bluecookie redcookie greencookie
LogSQLWhichNotes mod_gzip_result mod_gzip_compression_ratio
LogSQLWhichHeadersOut Expires Content-Type Cache-Control
LogSQLWhichHeadersIn UserAgent Accept-Encoding Host
(snip)
</VirtualHost>
Using the same database for production and test
Although sub-optimal, it is not uncommon to use the same back-end database for the "production" webservers as well as the "test" webservers (budgetary constraints, rack-space limits, etc.). Furthermore, an administrator in this situation may be unable to use LogSQLRemhostIgnore to exclude requests from the test servers -- perhaps the generated entries are genuinely useful for analytical or QA purposes, but their value after analysis is minimal.
It is wasteful and potentially confusing to permit this internal test data to clutter the database, and a solution to the problem is the proper use of the LogSQLMachineID directive. Assume a scenario where the production webservers have IDs like "web01," "web02," and so on -- and the test webservers have IDs like "test01," "test02," etc. Because entries in the log database are distinguished by their source machine, an administrator may purge unneeded test data from the access log as follows:
delete from access_log where machine_id like 'test%';
Optimizing for a busy database
A busy MySQL database will have SELECT statements running concurrently with INSERT and UPDATE statements. A long-running SELECT can in certain circumstances block INSERTs and therefore block mod_log_sql. A workaround is to enable mod_log_sql for "delayed inserts," which are described as follows in the MySQL documentation.
The DELAYED option for the INSERT statement is a MySQL-specific option that is very useful if you have clients that can't wait for the INSERT to complete. This is a common problem when you use MySQL for logging and you also periodically run SELECT and UPDATE statements that take a long time to complete. DELAYED was introduced in MySQL Version 3.22.15. It is a MySQL extension to ANSI SQL92.
INSERT DELAYED only works with ISAM and MyISAM tables. Note that as MyISAM tables supports concurrent SELECT and INSERT, if there is no free blocks in the middle of the data file, you very seldom need to use INSERT DELAYED with MyISAM.
When you use INSERT DELAYED, the client will get an OK at once and the row will be inserted when the table is not in use by any other thread.
Another major benefit of using INSERT DELAYED is that inserts from many clients are bundled together and written in one block. This is much faster than doing many separate inserts.
The general disadvantages of delayed inserts are
The queued rows are only stored in memory until they are inserted into the table. If mysqld dies unexpectedly, any queued rows that were not written to disk are lost.
There is additional overhead for the server to handle a separate thread for each table on which you use INSERT DELAYED.
The MySQL documentation concludes, "This means that you should only use INSERT DELAYED when you are really sure you need it!" Furthermore, the current state of error return from a failed INSERT DELAYED seems to be in flux, and may behave in unpredictable ways between different MySQL versions. See FAQ entry -- you have been warned.
If you are experiencing issues which could be solved by delayed inserts, then set LogSqlDelayedInserts On in the httpd.conf. All regular INSERT statements are now INSERT DELAYED, and you should see no more blocking of the module.
Configuration Directive Reference
It is imperative that you understand which directives are used only once in the main server config, and which are used inside VirtualHost stanzas and therefore multiple times within httpd.conf. The "context" listed with each entry informs you of this.
DataBase Configuration
LogSQLLoginInfo
LogSQLLoginInfo
connection URI
Example: LogSQLLoginInfo mysql://logwriter:passw0rd@foobar.baz.com/Apache_log
Context: main server config
Defines the basic connection URI to connect to the database with. The format of the connection URI is
driver://username[:password]@hostname[:port]/database
driver
The database driver to use (mysql, pgsql, etc..)
username
The database username to login with INSERT privileges on the logging table defined in LogSQLtransferLogTable.
password
The password to use for username, and can be omitted if there is no password.
hostname
The hostname or Ip address of the Database machine, ans is simple "localhost" if the database lives on the same machine as Apache.
port
Port on hostname to connect to the Database, if not specified use the default port for the database.
database
The database to connect to on the server.
This is defined only once in the httpd.conf file.
This directive Must be defined for logging to be enabled.
LogSQLDBParam
LogSQLDBParam
parameter-name
value
Example: LogSQLDBParam socketfile /var/lib/mysql/mysql.socket
Context: main server config
This is the new method of specifying Database connection credentials and settings. This is used to define database driver specific options. For a list of options read the documentation for each specific database driver.
Each parameter-name may only be defined once.
LogSQLCreateTables
LogSQLCreateTables
flag
Example: LogSQLCreateTables On
Default: Off
Context: main server config
mod_log_sql has the ability to create its tables on-the-fly. The advantage to this is convenience: you don't have to execute any SQL by hand to prepare the table. This is especially helpful for people with lots of virtual hosts (who should also see the LogSQLMassVirtualHosting directive).
There is a slight disadvantage: if you wish to activate this feature, then the userid specified in LogSQLLoginInfo must have CREATE privileges on the database. In an absolutely paranoid, locked-down situation you may only want to grant your mod_log_sql user INSERT privileges on the database; in that situation you are unable to take advantage of LogSQLCreateTables. But most people -- even the very security-conscious -- will find that granting CREATE on the logging database is reasonable.
This is defined only once in the httpd.conf file.
LogSQLForcePreserve
LogSQLForcePreserve
flag
Example: LogForcePreserve On
Default: Off
Context: main server config
You may need to perform debugging on your database and specifically want mod_log_sql to make no attempts to log to it. This directive instructs the module to send all its log entries directly to the preserve file and to make no database INSERT attempts.
This is presumably a directive for temporary use only; it could be dangerous if you set it and forget it, as all your entries will simply pile up in the preserve file.
This is defined only once in the httpd.conf file.
LogSQLDisablePreserve
LogSQLDisablePreserve
flag
Example: LogDisablePreserve On
Default: Off
Context; main server config
This option can be enabled to completely disable the preserve file fail back. This may be useful for servers where the file-system is read-only.
If the database is not available those log entries will be lost.
This is defined only once in the httpd.conf file.
LogSQLMachineID
LogSQLMachineID
machineID
Example: LogSQLMachineID web01
Context: main server config
If you have a farm of webservers then you may wish to know which particular machine made each entry; this is useful for analyzing your load-balancing methodology. LogSQLMachineID permits you to distinguish each machine's entries if you assign each machine its own LogSQLMachineID: for example, the first webserver gets ``LogSQLMachineID web01,'' the second gets ``LogSQLMachineID web02,'' etc.
This is defined only once in the httpd.conf file.
LogSQlPreserveFile
LogSQLPreserveFile
filename
Example: LogSQLPreserveFile offline-preserve
Default: /tmp/sql-preserve
Context: virtual host
mod_log_sql writes queries to this local preserve file in the event that it cannot reach the database, and thus ensures that your high-availability web frontend does not lose logs during a temporary database outage. This could happen for a number of reasons: the database goes offline, the network breaks, etc. You will not lose entries since the module has this backup. The file consists of a series of SQL statements that can be imported into your database at your convenience; furthermore, because the SQL queries contain the access timestamps you do not need to worry about out-of-order data after the import, which is done in a simple manner:
# mysql -uadminuser -p mydbname < /tmp/sql-preserve
If you do not define LogSQLPreserveFile then all virtual servers will log to the same default preserve file (/tmp/sql-preserve). You can redefine this on a virtual-host basis in order to segregate your preserve files if you desire. Note that segregation is not usually necessary, as the SQL statements that are written to the preserve file already distinguish between different virtual hosts if you include the 'v' character in your LogSQLTransferLogFormat directive. It is only necessary to segregate preserve-files by virualhost if you also segregate access logs by virtualhost.
The module will log to Apache's ErrorLog when it notices a database outage, and upon database return. You will therefore know when the preserve file is being used, although it is your responsibility to import the file.
The file does not need to be created in advance. It is safe to remove or rename the file without interrupting Apache, as the module closes the filehandle immediately after completing the write. The file is created with the user & group ID of the running Apache process (e.g. 'nobody' on many Linux distributions).
Table Names
LogSQLTransferLogTable
LogSQLTransferLogTable
table-name
Example: LogSQLTransferLogTable access_log_table
Context: virtual host
Defines which table is used for logging of Apache's transfers; this is analogous to Apache's TransferLog directive. table-name must be a valid table within the database defined in the LogSQLLoginInfo connection URI.
This directive is not necessary if you declare LogSQLMassVirtualHosting On, since that directive activates dynamically-named tables. If you attempt to use LogSqlTransferlogTable at the same time a warning will be logged and it will be ignored, since LogSQLMassVirtualHosting takes priority.
Requires unless LogSQLMassVirtualHosting is set to On
LogSQLCookieLogTable
LogSQLCookieLogTable
table-name
Example: LogSQLCookieLogTable cookie_log
Default: cookies
Context: virtual host
Defines which table is used for logging of cookies. Working in conjunction with LogSQLWhichCookies, you can log many of each request's associated cookies to a separate table. For meaningful data retrieval the cookie table is keyed to the access table by the unique request ID supplied by the standard Apache module mod_unique_id.
You must create the table (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to "on".
LogSQLHeadersInLogTable
LogSQLHeadersInLogTable
table-name
Example: LogSQLHeadersInLogTable headers
Default: headers_in
Context: virtual host
Defines which table is used for logging of inbound headers. Working in conjunction with LogSQLWhichHeadersIn, you can log many of each request's associated headers to a separate table. For meaningful data retrieval the headers table is keyed to the access table by the unique request ID supplied by the standard Apache module mod_unique_id.
Note that you must create the table (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to "on".
LogSQLHeadersOutLogTable
LogSQLHeadersOutLogTable
table-name
Example: LogSQLHeadersOutLogTable headers
Default: headers_out
Context: virtual host
Defines which table is used for logging of outbound headers. Working in conjunction with LogSQLWhichHeadersOut, you can log many of each request's associated headers to a separate table. For meaningful data retrieval the headers table is keyed to the access table by the unique request ID supplied by the standard Apache module mod_unique_id.
Note that you must create the table (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to "on".
LogSQLNotesLogTable
LogSQLNotesLogTable
table-name
Example: LogSQLNotesLogTable notes-log
Default: notes
Context: virtual_host
Defines which table is used for logging of notes. Working in conjunction with LogSQLWhichNotes, you can log many of each request's associated notes to a separate table. For meaningful data retrieval the notes table is keyed to the access table by the unique request ID supplied by the standard Apache module mod_unique_id.
This table must be created (see create-tables.sql included in the package), or LogSQLCreateTables must be set to 'On'.
LogSQLMassVirtualHosting
LogSQLMassVirtualHosting
flag
Example: LogSQLMassVirtualHosting On
Default: Off
Context: main server config
If you administer a site hosting many, many virtual hosts then this option will appeal to you. If you turn on LogSQLMassVirtualHosting then several things happen:
the on-the-fly table creation feature is activated automatically
the transfer log table name is dynamically set from the virtual host's name after stripping out SQL-unfriendly characters (example: a virtual host www.grubbybaby.com gets logged to table access_www_grubbybaby_com)
which, in turn, means that each virtual host logs to its own segregated table. Because there is no data shared between virtual servers you can grant your users access to the tables they need; they will be unable to view others' data.
This is a huge boost in convenience for sites with many virtual servers. Activating LogSQLMassVirtualHosting obviates the need to create every virtual server's table and provides more granular security possibilities.
This is defined only once in the httpd.conf file.
Configuring What Is logged
LogSQLTransferLogFormat
LogSQLTransferLogFormat
format-string
Example: LogSQLTransferLogFormat huSUTv
Default: AbHhmRSsTUuv
Context: virtual host
Each character in the format-string defines an attribute of the request that you wish to log. The default logs the information required to create Combined Log Format logs, plus several extras. Here is the full list of allowable keys, which sometimes resemble their Apache counterparts, but do not always:
Core LogFormat parameters
Symbol
Meaning
DB Field
Data Type
Example
A
User Agent
agent
varchar(255)
Mozilla/4.0 (compat; MSIE 6.0; Windows)
a
CGi request arguments
request_args
varchar(255)
user=Smith&cart=1231&item=532
b
Bytes transfered
bytes_sent
int unsigned
32561
c
Text of cookie
cookie
varchar(255)
Apache=sdyn.fooonline.net 1300102700823
f
Local filename requested
request_file
varchar(255)
/var/www/html/books-cycroad.html
H
HTTP request_protocol
request_protocol
varchar(10)
HTTP/1.1
h
Name of remote host
remote_host
varchar(50)
blah.foobar.com
I
Request ID (from modd_unique_id)
id
char(19)
POlFcUBRH30AAALdBG8
l
Ident user info
remote_logname
varcgar(50)
bobby
M
Machine ID
machine_id
varchar(25)
web01
m
HTTP request method
request_method
varchar(10)
GET
P
httpd cchild PID
child_pid
smallint unsigned
3215
p
http port
server_port
smallint unsigned
80
R
Referer
referer
varchar(255)
http://www.biglinks4u.com/linkpage.html
r
Request in full form
request_line
varchar(255)
GET /books-cycroad.html HTTP/1.1
S
Time of request in UNIX time_t format
time_stamp
int unsigned
1005598029
T
Seconds to service request
request_duration
smallint unsigned
2
t
Time of request in human format
request_time
char(28)
[02/Dec/2001:15:01:26 -0800]
U
Request in simple form
request_uri
varchar(255)
/books-cycroad.html
u
User info from HTTP auth
remote_user
varchar(50)
bobby
v
Virtual host servicing the request
virtual_host
varchar(255)
www.foobar.com
V
requested Virtual host name (mass virtualhosting)
virtual_host
varchar(255)
www.foobar.org
SSL LogFormat Parameters
Symbol
Meaning
DB Field
Data Type
Example
z
SSL cipher used
ssl_cipher
varchar(25)
RC4-MD5
q
Keysize of the SSL connection
ssl_keysize
smallint unsigned
56
Q
maximum keysize supported
ssl_maxkeysize
smallint unsigned
128
LogSQLRemhostIgnore
LogSQLRemhostIgnore
hostname
Example: LogSQLRemhostIgnore localnet.com
Context: virtual host
Lists a series of smortrings that, if present in the REMOTE_HOST, will cause that request to not be logged. This directive is useful for cutting down on log clutter when you are certain that you want to ignore requests from certain hosts, such as your own internal network machines. See section for some tips for using this directive.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
Each string is separated by a space, and no regular expressions or globbing are allowed. Each string is evaluated as a substring of the REMOTE_HOST using strstr(). The comparison is case sensitive.
LogSQLRequestAccept
LogSQLRequestAccept
substring
Example: LogSQLRequestAccept .html .php .jpg
Default: if not specified, all requests are 'accepted'
Context: virtual host
Lists a series of strings that, if present in the URI, will permit that request to be considered for logging (depending on additional filtering by the "ignore" directives). Any request that fails to match one of the LogSQLRequestAccept entries will be discarded.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
This directive is useful for cutting down on log clutter when you are certain that you only want to log certain kinds of requests, and just blanket-ignore everything else. See section for some tips for using this directive.
Each string is separated by a space, and no regular expressions or globbing are allowed. Each string is evaluated as a substring of the URI using strstr(). The comparison is case sensitive.
This directive is completely optional. It is more general than LogSQLRequestIgnore and is evaluated before LogSQLRequestIgnore . If this directive is not used, all requests are accepted and passed on to the other filtering directives. Therefore, only use this directive if you have a specific reason to do so.
LogSQLRequestIgnore
LogSQLRequestIgnore
substring
Example: LogSQLRequestIgnore root.exe cmd.exe default.ida favicon.ico
Context: virtual host
Lists a series of strings that, if present in the URI, will cause that request to NOT be logged. This directive is useful for cutting down on log clutter when you are certain that you want to ignore requests for certain objects. See section for some tips for using this directive.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
Each string is separated by a space, and no regular expressions or globbing are allowed. Each string is evaluated as a substring of the URI using strstr(). The comparison is case sensitive.
LogSQLWhichCookie
LogSQLWhichCookie
cookiename
Example; LogSQLWhichCookie Clicks
Context: virtual host
In HTTP, cookies have names to distinguish them from each other. Using mod_usertrack, for example, you can give your user-tracking cookies a name with the CookieName directive.
mod_log_sql allows you to log cookie information. LogSQL_WhichCookie tells mod_log_sql which cookie to log. This is necessary because you will usually be setting and receiving more than one cookie from a client.
You must include a 'c' character in LogSQLTransferLogFormat for this directive to take effect.
although this was origintally intended for people using mod_usertrack to create user-tracking cookies, you are not restricted in any way. You can choose which cookie you wish to log to the database - any cookie at all - and it does not necessarily have to have anything to do with mod_usertrack.
LogSQLWhichCookies
LogSQLWhichCookies
cookie-name
Example: logSQLWhichCookies userlogin cookie1 cookie2
Context: virtual host
Defines the list of cookies you would like logged. This works in conjunction with LogSQLCookieLogTable. This directive does not require any additional characters to be added to the LogSQLTransferLogFormat string. The feature is activated simply by including this directive, upon which you will begin populating the separate cookie table with data.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
The table must be created (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to 'On'.
LogSQLWhichHeadersIn
LogSQLWhichHeadersIn
header-name
Example: LogSQLWhichHeadersIn UserAgent Accept-Encodeing Host
Context: virtual host
Defines the list of inbound headers you would like logged. This works in conjunction with LogSQLHeadersInLogTable. This directive does not require any additional characters to be added to the LogSQLTransferLogFormat string. The feature is activated simply by including this directive, upon which you will begin populating the separate inbound-headers table with data.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
The table must be created (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to 'On'.
LogSQLWhichHeadersOut
LogSQLWhichHeadersOut
header-name
Example: LogSQLWhichHeadersOut Expires Content-Type Cache-Control
Context: virtual host
Defines the list of outbound headers you would like logged. This works in conjunction with LogSQLHeadersOutLogTable. This directive does not require any additional characters to be added to the LogSQLTransferLogFormat string. The feature is activated simply by including this directive, upon which you will begin populating the separate outbound-headers table with data.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
The table must be created (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to 'On'.
LogSQLWhichNotes
LogSQLWhichNotes
note-name
Example: LogSQLWhichNotes mod_gzip_result mod_gzip_ompression_ratio
Context: virtual host
Defines the list of notes you would like logged. This works in conjunction with LogSQLNotesLogTable. This directive does not require any additional characters to be added to the LogSQLTransferLogFormat string. The feature is activated simply by including this directive, upon which you will begin populating the separate notes table with data.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
The table must be created (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to 'On'.
Deprecated Commands
LogSQLSocketFile [Deprecated]
LogSQLSocketFile
filename
Example: LogSQLSocketFile /tmp/mysql.sock
Default: (database specific)
Default (MySQL): /var/lib/mysql/mysql.sock
Context: main server config
At Apache runtime you can specify the MySQL socket file to use. Set this once in your main server config to override the default value. This value is irrelevant if your database resides on a separate machine.
mod_log_sql will automatically employ the socket for db communications if the database resides on the local host. If the db resides on a separate host the module will automatically use TCP/IP. This is a function of the MySQL API and is not user-configurable.
This directive is deprecated in favor of LogSQLDBParam socketfile [socketfilename]
This is defined only once in the httpd.conf file.
LogSQLTCPPort [Deprecated]
LogSQLTCPPort
port-number
Example: LogSQLTCPPort 3309
Default: (database specific)
Default (MySQL): 3306
Context: main server config
Your database may listen on a different port than the default. If so, use this directive to instruct the module which port to use. This directive only applies if the database is on a different machine connected via TCP/IP.
This directive is deprecated in favor of LogSQLDBParam tcpport [port-number]
This is defined only once in the httpd.conf file.
LogSQLDatabase [Deprecated]
LogSQLDatabase
database
Example: LogSQLDatabase loggingdb
Context: main server config
Defines the database that is used for logging. "database" must be a valid db on the MySQL host defined in LogSQLLoginInfo
This directive is deprecated in favor of the URI form of LogSQLLoginInfo.
This is defined only once in the httpd.conf file.
FAQ
General module questions
Why log to an SQL database?
To begin with, let's get it out of the way: logging to a database is not a panacea. But while there are complexities with this solution, the benefit can be substantial for certain classes of administrator or people with advanced requirements:
Chores like log rotation go away, as you can DELETE records from the SQL database once they are no longer useful. For example, the excellent and popular log-analysis tool Webalizer (http://www.webalizer.com) does not need historic logs after it has processed them, enabling you to delete older logs.
People with clusters of web servers (for high availability) will benefit the most - all their webservers can log to a single SQL database. This obviates the need to collate/interleave the many separate logfiles, which can be / highly/ problematic.
People acquainted with the power of SQL SELECT statements will know the flexibility of the extraction possibilities at their fingertips.
For example, do you want to see all your 404's? Do this:
select remote_host,status,request_uri,bytes_sent,from_unixtime(time_stamp) from acc_log_tbl where status=404 order by time_stamp;
remote_host
status
request_uri
bytes_sent
from_unixtime(time_stamp)
marge.mmm.co.uk
404
/favicon.ico
321
2001-11-20 02:30:56
62.180.239.251
404
/favicon.ico
333
2001-11-20 02:45:25
212.234.12.66
404
/favicon.ico
321
2001-11-20 03:01:00
212.210.78.254
404
/favicon.ico
333
2001-11-20 03:26:05
Or do you want to see how many bytes you've sent within a certain directory or site? Do this:
select request_uri,sum(bytes_sent) as bytes,count(request_uri) as howmany from acc_log_tbl where request_uri like '%mod_log_sql%' group by request_uri order by howmany desc;
request_uri
bytes
howmany
/mod_log_sql/style_1.css
157396
1288
/mod_log_sql/
2514337
801
/mod_log_sql/mod_log_sql.tar.gz
9769312
456
/mod_log_sql/faq.html
5038728
436
Or maybe you want to see who's linking to you? Do this:
select count(referer) as num,referer from acc_log_tbl where request_uri='/mod_log_sql/' group by referer order by num desc;
num
referer
271
http://freshmeat.net/projects/mod_log_sql/
96
http://modules.apache.org/search?id=339
48
http://freshmeat.net/
8
http://freshmeat.net
As you can see, there are myriad possibilities that can be constructed with the wonderful SQL SELECT statement. Logging to an SQL database can be really quite useful!
Why use MySQL? Are there alternatives?
MySQL is a robust, free, and very powerful production-quality database engine. It is well supported and comes with detailed documentation. Many 3rd-party software pacakges (e.g. Slashcode, the engine that powers Slashdot) run exclusively with MySQL. In other words, you will belong to a very robust and well-supported community by choosing MySQL.
That being said, there are alternatives. PostgreSQL is probably MySQL's leading "competitor" in the free database world. There is also an excellent module available for Apache to permit logging to a PostgreSQL database, called pgLOGd
Currently a database abstraction system is in the works to allow any database to be used with mod_log_sql.
Is this code production-ready?
By all accounts it is. It is known to work without a problem on many-thousands-of-hits-per-day webservers. Does that mean it is 100% bug free? Well, no software is, but it is well-tested and believed to be fully compatible with production environments. (The usual disclaimers apply. This software is provided without warranty of any kind.)
Who's using mod_log_sql?
Good question! It would be great to find out! If you are a production-level mod_log_sql user, please contact eddie at &EmailContact; so that you can be mentioned here.
Why doesn't the module also replace the Apache ErrorLog?
There are circumstances when that would be quite unwise -- for example, if Apache could not reach the MySQL server for some reason and needed to log that fact. Without a text-based error log you'd never know anything was wrong, because Apache would be trying to log a database connection error to the database... you get the point.
Error logs are usually not very high-traffic and are really best left as text files on a web server machine.
The Error log is free format text.. (no specified formatting what, so ever) which is rather difficult to nicely format for storing in a database.
Does mod_log_sql work with Apache 2.x?
Yes. A port of mod_log_sql is available for Apache 2.x as of mod_log_sql 1.90
Does mod_log_sql connect to MySQL via TCP/IP or a socket?
Quick answer, Yes.
It depends! This is not determined by mod_log_sql. mod_log_sql relies on a connection command that is supplied in the MySQL API, and that command is somewhat intelligent. How it works:
if the specified MySQL database is on the same machine, the connection command uses a socket to communicate with MySQL
if the specified MySQL database is on a different machine, mod_log_sql connects using TCP/IP.
You don't have any control of which methodology is used. You can fine-tune some of the configuration, however. The LogSQLSocketFile runtime configuration directive overrides the default of "/var/lib/mysql/mysql.sock" for socket-based connections, whereas the LogSQLTCPPort command allows to you override the default TCP port of 3306 for TCP/IP connections.
I have discovered a bug. Who can I contact?
Please contact Edward Rudd at &EmailContact;, or post a message to the mod_log_sql . Your comments, suggestions, bugfixes, bug catches, and usage testimonials are always welcome. As free software, mod_log_sql is intended to be a community effort -- any code contributions or other ideas will be fully and openly credited, of course.
Problems
Apache segfaults or has other problems when using PHP and mod_log_sql
This occurs if you compiled PHP with MySQL database support. PHP utilizes its internal, bundled MySQL libraries by default. These conflict with the "real" MySQL libraries linked by mod_log_sql, causing the segmentation fault.
PHP and mod_log_sql can be configured to happily coexist. The solution is to configure PHP to link against the real MySQL libraries: recompile PHP using --with-mysql=/your/path. Apache will run properly once the modules are all using the same version of the MySQL libraries.
Apache appears to start up fine, but nothing is getting logged in the database
If you do not see any entries in the access_log, then something is preventing the inserts from happening. This could be caused by several things:
Improper privileges set up in the MySQL database
You are not hitting a VirtualHost that has a LogSQLTransferLogTable entry
You did not specify the right database host or login information
Another factor is preventing a connection to the database
It is improper to ask for help before you have followed these steps.
First examine the MySQL log that you established in step of section . Ensure that the INSERT statements are not being rejected because of a malformed table name or other typographical error. By enabling that log, you instructed MySQL to log every connection and command it receives -- if you see no INSERT attempts in the log, the module isn't successfully connecting to the database. If you see nothing at all in the log -- not even a record of your administrative connection attempts, then you did not enable the log correctly. If you do see INSERT attempts but they are failing, the log should tell you why.
Second, confirm that your LogSQL* directives are all correct.
Third, examine the Apache error logs for messages from mod_log_sql; the module will offer hints as to why it cannot connect, etc.
The next thing to do is to change the LogLevel directive in the main server config as well as in each VirtualHost config:
LogLevel debug
ErrorLog /var/log/httpd/server-messages
Why do I get the message "insufficient configuration info to establish database link" in my Apache error log?
At a minimum, LogSQLLoginInfo in the URl form and either LogSQLTableName or LogSQLMassVirtualHosting must be defined in order for the module to be able to establish a database link. If these are not defined or are incomplete you will receive this error message.
My database cannot handle all the open connections from mod_log_sql, is there anything I can do?
The rule of thumb: if you have n webservers each configured to support y MaxClients, then your database must be able to handle n times y simultaneous connections in the worst case. Certainly you must use common sense, consider reasonable traffic expectations and structure things accordingly.
Tweaking my.cnf to scale to high connection loads is imperative. But if hardware limitations prevent your MySQL server from gracefully handling the number of incoming connections, it would be beneficial to upgrade the memory or CPU on that server in order to handle the load.
Jeremy Zawodny, a highly respected MySQL user and contributor to Linux Magazine, has this very helpful and highly appropriate article on tuning MySQL: MySQL, Linux, and Thread Caching
Please remember that mod_log_sql's overriding principle is performance -- that is what the target audience demands and expects. Other database logging solutions do not open and maintain many database connections, but their performance suffers drastically. For example, pgLOGd funnels all log connections through a separate daemon that connects to the database, but that bottlenecks the entire process. mod_log_sql achieves performance numbers an order of magnitude greater than the alternatives because it dispenses with the overhead associated with rapid connection cycling, and it does not attempt to shoehorn all the database traffic through a single extra daemon or proxy process.
Currently connection pooling is being implemented as part of the Database Abstraction layer to allow multiple httpd processes to share connections.
Why do I occasionally see a "lost connection to MySQL server" message in my Apache error log?
This message may appear every now and then in your Apache error log, especially on very lightly loaded servers. This does not mean that anything is necessarily wrong. Within each httpd child process, mod_log_sql will open (and keep open) a connection to the MySQL server. MySQL, however, will close connections that have not been used in a while; the default timeout is 8 hours. When this occurs, mod_log_sql will notice and re-open the connection. That event is what is being logged, and looks like this:
[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: first attempt failed,
API said: error 2013, Lost connection to MySQL server during query
[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: reconnect successful
[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: second attempt successful
Reference: MySQL documentation
Sometimes a single VirtualHost gets logged to two different tables (e.g. access_foo_com, access_www_foo_com). Or, accesses to an unqualified hostname (e.g. "http://intranet/index.html") get logged in separate tables.
Proper usage of the Apache runtime ServerName directive and the directive UseCanonicalName On (or DNS) are necessary to prevent this problem. "On" is the default for UseCanonicalName, and specifies that self-referential URLs are generated from the ServerName part of your VirtualHost:
With UseCanonicalName on (and in all versions prior to 1.3) Apache will use the ServerName and Port directives to construct the canonical name for the server. With UseCanonicalName off Apache will form self-referential URLs using the hostname and port supplied by the client if any are supplied (otherwise it will use the canonical name, as defined above). [From the Apache documentation]
The module inherits Apache's "knowledge" about the server name being accessed. As long as those two directives are properly configured, mod_log_sql will log to only one table per virtual host while using LogSQLMassVirtualHosting.
Performance and Tuning
How well does it perform?
mod_log_sql scales to very high loads. Apache 1.3.22 + mod_log_sql was benchmarked using the "ab" (Apache Bench) program that comes with the Apache distribution; here are the results.
Overall configuration
Machine A: Apache webserver
Machine B: MySQL server
Machines A and B connected with 100Mbps Ethernet
Webserver: Celeron 400, 128MB RAM, IDE storage
Apache configuration
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
StartServers 10
MaxSpareServers 15
MaxClients 256
MaxRequestsPerChild 5000
LogSQLTransferLogFormat AbHhmRSsTUuvc
LogSQLWhichCookie Clicks
CookieTracking on
CookieName Clicks
"ab" commandline
./ab -c 10 -t 20 -v 2 -C Clicks=ab_run
http://www.hostname.com/target
( 10 concurrent requests; 20 second test; setting a cookie "Clicks=ab_run"; target = the mod_log_sql homepage. )
Ten total ab runs were conducted: five with MySQL logging enabled, and five with all MySQL directives commented out of httpd.conf. Then each five were averaged. The results:
Average of five runs employing MySQL and standard text logging: 139.01 requests per second, zero errors.
Average of five runs employing only standard text logging: 139.96 requests per second, zero errors.
In other words, any rate-limiting effects on this particular hardware setup are not caused by MySQL. Note that although this very simple webserver setup is hardly cutting-edge -- it is, after all, a fairly small machine -- 139 requests per second equal over twelve million hits per day.
If you run this benchmark yourself, take note of three things:
Use a target URL that is on your own webserver :-).
Wait until all your connections are closed out between runs; after several thousand requests your TCP/IP stack will be filled with hundreds of connections in TIME_WAIT that need to close. Do a "netstat -t|wc -l" on the webserver to see. If you don't wait, you can expect to see a lot of messages like "ip_conntrack: table full, dropping packet" in your logs. (This has nothing to do with mod_log_sql, this is simply the nature of the TCP/IP stack in the Linux kernel.)
When done with your runs, clean these many thousands of requests out of your database:
mysql> delete from access_log where agent like 'ApacheBench%';
mysql> optimize table access_log;
Do I need to be worried about all the running MySQL children? Will holding open n Apache-to-MySQL connections consume a lot of memory?
Short answer: you shouldn't be worried.
Long answer: you might be evaluating at the output of "ps -aufxw" and becoming alarmed at all the 7MB httpd processes or 22MB mysqld children that you see. Don't be alarmed. It's true that mod_log_sql opens and holds open many MySQL connections: each httpd child maintains one open database connection (and holds it open for performance reasons). Four webservers, each running 20 Apache children, will hold open 80 MySQL connections, which means that your MySQL server needs to handle 80 simultaneous connections. In truth, your MySQL server needs to handle far more than that if traffic to your website spikes and the Apache webservers spawn off an additional 30 children each...
Fortunately the cost reported by 'ps -aufxw' is deceptive. This is due to an OS memory-management feature called "copy-on-write." When you have a number of identical child processes (e.g. Apache, MySQL), it would appear in "ps" as though each one occupies a great deal of RAM -- as much as 7MB per httpd child! In actuality each additional child only occupies a small bit of extra memory -- most of the memory pages are common to each child and therefore shared in a "read-only" fashion. The OS can get away with this because the majority of memory pages for one child are identical across all children. Instead of thinking of each child as a rubber stamp of the others, think of each child as a basket of links to a common memory area.
A memory page is only duplicated when it needs to be written to, hence "copy-on-write." The result is efficiency and decreased memory consumption. "ps" may report 7MB per child, but it might really only "cost" 900K of extra memory to add one more child. It is not correct to assume that 20 Apache children with a VSZ of 7MB each equals (2 x 7MB) of memory consumption -- the real answer is much, much lower. The same "copy-on-write" rules apply to all your MySQL children: 40 mysqld children @ 22MB each do not occupy 880MB of RAM.
The bottom line: although there is a cost to spawn extra httpd or mysqld children, that cost is not as great as "ps" would lead you to believe.
My webserver cannot handle all the traffic that my site receives, is there anything I can do?
If you have exhausted all the tuning possibilities on your existing server, it is probably time you evaluated the benefits of clustering two or more webservers together in a load-balanced fashion. In fact, users of such a setup are mod_log_sql's target audience!
What is the issue with activating delayed inserts?
INSERT DELAYED is a specific syntax to MySQL and is not supported by any other database. Ergo, why is it needed, and what MySQL deficiency is it working around? INSERT DELAYED is a kluge.
The MySQL documentation is unclear whether INSERT DELAYED is even necessary for an optimized database. It says, "The DELAYED option for the INSERT statement is a MySQL-specific option that is very useful if you have clients that can't wait for the INSERT to complete." But then it goes on to say, "Note that as MyISAM tables supports concurrent SELECT and INSERT, if there is no free blocks in the middle of the data file, you very seldom need to use INSERT DELAYED with MyISAM."
Because INSERT DELAYED returns without waiting for the data to be written, a hard kill of your MySQL database at the right (wrong?) moment could lose those logfile entries.
As of MySQL version 3.23.52, the error return functions disagree after a failed INSERT DELAYED: mysql_errno() always returns 0, even if mysql_error() returns a textual error. I have reported this bug to the MySQL folks. However, we have no way of knowing what solution they will adopt to fix this, and with the worst case solution mod_log_sql would not be able to tell if anything went wrong with a delayed insert.
Instead of delayed inserts, you may wish to utilize InnoDB tables (instead of the standard MyISAM tables). InnoDB tables suppot row-level locking and are recommended for high-volume databases.
If after understanding these problems you still wish to enable delayed inserts, section discusses how.
"How do I...?" -- accomplishing certain tasks
How do I extract the data in a format that my analysis tool can understand?
mod_log_sql would be virtually useless if there weren't a way for you to extract the data from your database in a somewhat meaningful fashion. To that end there's a Perl script enclosed with the distribution. That script (make_combined_log.pl) is designed to extract N-many days worth of access logs and provide them in a Combined Log Format output. You can use this very tool right in /etc/crontab to extract logs on a regular basis so that your favorite web analysis tool can read them. Or you can examine the Perl code to construct your own custom tool.
For example, let's say that you want your web statistics updated once per day in the wee hours of the morning. A good way to accomplish that could be the following entries in /etc/crontab:
# Generate the temporary apache logs from the MySQL database (for webalizer)
05 04 * * * root make_combined_log.pl 1 www.grubbybaby.com > /var/log/temp01
# Run webalizer on httpd log
30 04 * * * root webalizer -c /etc/webalizer.conf; rm -f /var/log/temp01
Or if you have a newer system that puts files in /etc/cron.daily etc., create a file called "webalizer" in the cron.daily subdirectory. Use the following as the contents of your file, and make sure to chmod 755 it when done.
#!/bin/sh
/usr/local/sbin/make_combined_log.pl 1 www.yourdomain.com > /var/log/httpd/templog
/usr/local/bin/webalizer -q -c /etc/webalizer.conf
rm -f /var/log/httpd/templog
See? Easy.
How can I log mod_usertrack cookies?
A number of people like to log mod_usertrack cookies in their Apache TransferLog to aid in understanding their visitors' clickstreams. This is accomplished, for example, with a statement as follows:
LogFormat "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\"" \"%{cookie}n\""
Naturally it would be nice for mod_log_sql to permit the admin to log the cookie data as well, so as of version 1.10 you can do this. You need to have already compiled mod_usertrack into httpd -- it's one of the standard Apache modules.
First make sure you have a column called "cookie" in the MySQL database to hold the cookies, which can be done as follows if you already have a working database:
mysql> alter table acc_log_tbl add column cookie varchar(255);
Next configure your server to set usertracking cookies as follows, and make sure you include the new 'c' directive in your LogSQLTransferLogFormat, which activates cookie logging. Here's an example:
<VirtualHost 1.2.3.4>
CookieTracking on
CookieStyle Cookie
CookieName Foobar
LogSQLTransferLogFormat huSUsbTvRAc
LogSQLWhichCookie Foobar
</VirtualHost>
The first three lines configure mod_usertrack to create a COOKIE (RFC 2109) format cookie called Foobar. The last two lines tell mod_log_sql to log cookies named Foobar. You have to choose which cookie to log because more than one cookie can/will be sent to the server by the client.
Recap: the 'c' character activates cookie logging, and the LogSQLWhichCookie directive chooses which cookie to log.
FYI, you are advised NOT to use CookieStyle Cookie2 -- it seems that even newer browsers (IE 5.5, etc.) have trouble with the new COOKIE2 (RFC 2965) format. Just stick with the standard COOKIE format and you'll be fine.
Perform some hits on your server and run a select
mysql> select request_uri,cookie from access_log where cookie is not null;
request_uri
cookie
/mod_log_sql/
ool-18e4.dyn.optonline.net.130051007102700823
/mod_log_sql/usa.gif
ool-18e4.dyn.optonline.net.130051007102700823
/mod_log_sql/style_1.css
ool-18e4.dyn.optonline.net.130051007102700823
What if I want to log more than one cookie? What is the difference between LogSQLWhichCookie and LogSQLWhichCookies?
As of version 1.17, you have a choice in how you want cookie logging handled.
If you are interested in logging only one cookie per request, follow the instructions in FAQ entry above. That cookie will be logged to a column in the regular access_log table, and the actual cookie you want to log is specified with LogSQLWhichCookie. Don't forget to specify the 'c' character in LogSQLTransferLogFormat.
If, however, you need to log multiple cookies per request, you must employ the LogSQLWhichCookies (note the plural) directive. The cookies you specify will be logged to a separate table (as discussed in section ), and entries in that table will be linked to the regular access_log entries via the unique ID that is supplied by mod_unique_id. Without mod_unique_id the information will still be logged but you will be unable to correlate which cookies go with which access-requests. Furthermore, with LogSQLWhichCookies, you do not need to include the 'c' character in LogSQLTransferLogFormat.
LogSQLWhichCookie and LogSQLWhichCookies can coexist without conflict because they operate on entireley different tables, but you're better off choosing the one you need.
What are the SSL logging features, and how do I activate them?
You do not need to compile SSL support into mod_log_sql in order to simply use it with a secure site. You only need to compile SSL support into mod_log_sql if you want to log SSL-specific data such as the cipher type used, or the keysize that was negotiated. If that information is unimportant to you, you can ignore this FAQ.
By adding certain characters to your LogSQLTransferLogFormat string you can tell mod_log_sql to log the SSL cipher, the SSL keysize of the connection, and the maximum keysize that was available. This would let you tell, for example, which clients were using only export-grade security to access your secure software area.
You can compile mod_log_sql with SSL logging support if you have the right packages installed. If you already have an SSL-enabled Apache then you by definition have the correct packages already installed: OpenSSL and mod_ssl.
You need to ensure that your database is set up to log the SSL data. Issue the following commands to MySQL if your access table does not already have them:
mysql> alter table access_log add column ssl_cipher varchar(25);
mysql> alter table access_log add column ssl_keysize smallint unsigned;
mysql> alter table access_log add column ssl_maxkeysize smallint unsigned;
Finally configure httpd.conf to activate the SSL fields. Note that this is only meaningful in a VirtualHost that is set up for SSL.
<VirtualHost 1.2.3.4:443>
LogSQLTransferLogFormat AbHhmRSsTUuvcQqz
</VirtualHost>
You also need to make sure you have the mod_log_sql_ssl module loaded as well.
The last three characters (Qqz) in the directive are the SSL ones; see section in the directives documentation for details of the LogSQLTransferLogFormat directive.
Restart Apache, then perform some hits on your server. Then run the following select statement:
mysql> select remote_host,request_uri,ssl_cipher,ssl_keysize,ssl_maxkeysize from access_log where ssl_cipher is not null;
remote_host
request_uri
ssl_cipher
ssl_keysize
ssl_maxkeysize
216.192.52.4
/dir/somefile.html
RC4-MD5
128
128
216.192.52.4
/dir/somefile.gif
RC4-MD5
128
128
216.192.52.4
/dir/somefile.jpg
RC4-MD5
128
128
mod_log_sql-1.100/docs/manual.html 0000644 0001750 0001750 00000342230 10171050565 017053 0 ustar zigo zigo 0000000 0000000
mod_log_sql ManualEdward Rudd
Conversion from Lyx to DocBookCurrent MaintainerChristopher B. Powell
Original documentation author.Copyright © 2001, 2002, 2003 Christopher B. Powell
Copyright © 2004, 2005 Edward Rudd
Revision History |
---|
Revision 1.3 | 2005-01-11 |
Updated for mod_log_sql v1.100 |
Revision 1.2 | 2004-04-08 |
Updated for mod_log_sql v1.97 |
Revision 1.1 | 2004-03-02 |
Updated for mod_log_sql v1.96 |
Revision 1.0 | 2004-01-22 |
Initial Conversion from Lyx to Docbook |
This Apache module will permit you to log to a SQL database; it can log each access request as well as data associated with each request: cookies, notes, and inbound/outbound headers. Unlike logging to a flat text file -- which is standard in Apache -- a SQL-based log exhibits tremendous flexibility and power of data extraction. (See FAQ entry Q: 1.1. for further discussion and examples of the advantages to SQL.)
This module can either replace or happily coexist with mod_log_config, Apache's text file logging facility. In addition to being more configurable than the standard module, mod_log_sql is much more flexible.
This project was formerly known as "mod_log_mysql." It was renamed "mod_log_sql" in order to reflect the project goal of database in-specificity. The module currently supports MySQL, but support for other database back-ends is underway.
In order to save speed and overhead, links are kept alive in between queries. This module uses one dedicated SQL link per httpd child, opened by each child process when it is born. Among other things, this means that this module supports logging into only one MySQL server, and for now, also, only one SQL database. But that's a small tradeoff compared to the blinding speed of this module. Error reporting is robust throughout the module and will inform the administrator of database issues in the Apache ErrorLog for the server/virtual server.
Virtual hosts are supported in the same manner they are in the regular logging modules. The administrator defines some basic 'global' directives in the main server config, then defines more specific 'local' directives inside each VirtualHost stanza.
A robust "preserve" capability has now been implemented. This permits the module to preserve any failed INSERT commands to a local file on its machine. In any situation that the database is unavailable -- e.g. the network fails or the database host is rebooted -- mod_log_sql will note this in the error log and begin appending its log entries to the preserve file (which is created with the user and group ID of the running Apache process, e.g. "nobody/nobody" on many Linux installations). When database availability returns, mod_log_sql seamlessly resumes logging to it. When convenient for the sysadmin, he/she can easily import the preserve file into the database because it is simply a series of SQL insert statements.
What gets logged by default?
All the data that would be contained in the "Combined Log Format" is logged by default, plus a little extra. Your best bet is to begin by accepting this default, then later customize the log configuration based on your needs. The documentation of the run-time directives includes a full explanation of what you can log, including examples -- see section Configuration Directive Reference.
Note which directives go in the 'main server config' and which directives apply to the 'virtual host config'. This is made clear in the directive documentation.
The 'time_stamp' field is stored in an UNSIGNED INTEGER format, in the standard unix "seconds since the epoch" format. This is superior to storing the access time as a string due to size requirements: an UNSIGNED INT requires 4 bytes, whereas an Apache date string (e.g. "18/Nov/2001:13:59:52 -0800") requires 26 bytes: those extra 22 bytes become significant when multiplied by thousands of accesses on a busy server. Besides, an INT type is far more flexible for comparisons, etc.
In MySQL 3.21 and above you can easily convert this to a human readable format using from_unixtime(), e.g.:
select remote_host,request_uri,from_unixtime(time_stamp) from access_log;
The enclosed perl program "make_combined_log.pl" extracts your access log in a format that is completely compatible with the Combined Log Format. You can then feed this to your favorite web log analysis tool.
The table's string values can be CHAR or VARCHAR, at a length of your choice. VARCHAR is superior because it truncates long strings; CHAR types are fixed-length and will be padded with spaces, resulting in waste. Just like the time_stamp issue described above, that kind of space waste multiplies over thousands of records.
Be careful not to go overboard setting fields to NOT NULL. If a field is marked NOT NULL then it must contain data in the INSERT statement, or the INSERT will fail. These mysterious failures can be quite frustrating and difficult to debug.
When Apache logs a numeric field, it uses a '-' character to mean "not applicable," e.g. the number of bytes returned on a 304 (unchanged) request. Since '-' is an illegal character in an SQL numeric field, such fields are assigned the value 0 instead of '-' which, of course, makes perfect sense anyway.
The actual logging code was taken from the already existing flat file text modules, so all that credit goes to the Apache Software Foundation.
The MySQL routines and directives were added by Zeev Suraski <bourbon@netvision.net.il>.
All changes from 1.06+ and the new documentation were added by Chris Powell <chris <at> grubbybaby <dot> com>. It seems that the module had fallen into the "un-maintained" category -- it had not been updated since 1998 -- so Chris adopted it as the new maintainer.
In December of 2003, Edward Rudd <urkle <at> outoforder <dot> cc> porting the module to Apache 2.0, cleaning up the code, converting the documentation to DocBook, optimizing the main logging loop, and added the much anticipated database abstraction layer.
As of February 2004, Chris Powell handed over maintenance of the module over to Edward Rudd. So you should contact Edward Rudd about the module from now on.
A compatible system. mod_log_sql was authored and tested on systems based on Red Hat Linux (Red Hat, Mandrake), but the module should easily adapt to any modern distribution. mod_log_sql has also been ported successfully to Solaris and FreeBSD.
Apache 1.3 or 2.0, 1.2 is no longer supported, but may still compile. Ideally you should already have successfully compiled Apache and understand the process, but this document tries to make it simple for beginners.
The MySQL development headers. This package is called different things on different distributions. For example, Red Hat 6.x calls this RPM "MySQL-devel" whereas Mandrake calls it "libmysql10-devel." Both MySQL 3.23.x and 4.x are supported.
MySQL >= 3.23.15 configured, installed and running on either localhost or an accessible networked machine. You should already have a basic understanding of MySQL and how it functions.
Optionally, if you want to be able to log SSL information such as keysize or cipher, you need OpenSSL and mod_ssl installed.
Unpack the archive into a working directory.
$ tar -xzf mod_log_sql-1.94.tar.gz
$ cd mod_log_sql-1.9
run configure to configure the source directory.
$ ./configure
The configure script should automatically detect all the required libraries and program if the are installed in standard locations.. If it returns an error, here is a description of the arguments you can specify when you run configure.
- --with-apxs=/usr/sbin/apxs
This is the full path to the apxs binary, or the directory which contains the program. This program is part of the Apache 1.3 and 2.0 installation.
The default is to search /usr/bin/apxs and /usr/sbin/apxs.
Specifying a directory here will search $directory/apxs, $directory/bin/apxs, and $directory/sbin/apxs
If you have more than one version of Apache installed, you need to specify the correct apxs binary for the one you wish to compile for.
- --with-mysql=/path/to/mysql
This is the directory to search for the libmysqlclient library and the MySQL headers.
The default is to search /usr/include, /usr/include/mysql, /usr/local/include, and /usr/local/include/mysql for MySQL headers.. And /usr/lib. /usr/lib/mysql, /usr/local/lib, and /usr/local/lin/mysql for the MySQL libraries.
Specifying this testargument will search $directory/include and $directory/mysql for MySQL headers. And $directory/lib and $directory/lib/mysql for MySQL libraries.
- --enable-ssl
Specifying this argument will enable the search for mod_ssl and SSL headers, and if found will enable compilation of SSL support into mod_log_sql. SSL support is compiled into a separate module that can be loaded after the main mod_log_sql.
- --with-ssl-inc=/usr/include/openssl
This is the path to the SSL toolkit header files that were used to compile mod_ssl. If you want SSL support you most likely need to specify this.
The default is to search /usr/include and /usr/include/openssl.
Specifying this argument will search that directory for the SSL headers.
- --with-db-inc=/usr/include/db1
This argument is only needed when compiling SSL support for Apache 1.3, and needs to be the directory which contains the ndbm.h header file. You can find this by using
$ locate ndbm.h
/usr/include/db1/ndbm.h
/usr/include/gdbm/ndbm.h
As far as I can tell, there is no difference as to which you specify, but it should be the one that you compiled mod_ssl with.
The default is /usr/include/db1, which should work on most systems.
- --disable-apachetest
This will disable the apache version test. However there is a side affect if you specify this where I will not be able to determine which version of Apache you are compiling for. So don't specify this.. If you are having troubles with the script detecting your Apache version, then send a bug report along with your system OS version and versions of related packages.
- --disable-mysqltest
This will disable the MySQL compile test. Specify this if for some reason the test fail but you know you have specified the correct directories. If mod_los_sql also fails to compile report a bug along with your system OS version and versions of related packages.
Now compile the module with GNU make. You may have to specify gmake on some systems like FreeBSD.
$ gmake
If there were no errors, you can now install the module(s). If you compiled as a non-root user you may need to switch users with su or sudo.
$ su -c "gmake install"
Password:
Now edit your Apache configuration and load the modules.
Note
If you are loading the SSL logging module, you need to make sure it is loaded after mod_ssl and mod_log_sql.
If you have previously used mod_log_sql version 1.18, the name of the module has changed from sql_log_module to log_sql_module (the first parameter to LoadModule)
If you are upgrading from any release earlier than 1.97 you need to add an extra LoadModule directive to load the database driver (ie mysql).
Insert these lines to either the main httpd.conf or a file included via an include directive.
LoadModule log_sql_module modules/mod_log_sql.so
LoadModule log_sql_mysql_module modules/mod_log_sql_mysql.so
<IfModule mod_ssl.c>
LoadModule log_sql_ssl_module moduels/mod_log_sql_ssl.so
</IfModule>
Note
If you did not compile SSL support in mod_log_sql, do not include the lines between the <IfModule> directives.
If you are using Apache 1.3 you may need add these lines later in the configuration.
AddModule mod_log_sql.c
AddModule mod_log_sql_mysql.c
<IfModule mod_ssl.c>
AddModule mod_log_sql_ssl.c
</IfModule>
Note
If you did not compile SSL support in mod_log_sql, do not include the lines between the <IfModule> directives.
Preparing MySQL for logging
You have to prepare the database to receive data from mod_log_sql, and set up run-time directives in httpd.conf to control how and what mod_log_sql logs.
This section will discuss how to get started with a basic configuration. Full documentation of all available run-time directives is available in section Configuration Directive Reference.
mod_log_sql can make its own tables on-the-fly, or you can pre-make the tables by hand. The advantage of letting the module make the tables is ease-of-use, but for raw performance you will want to pre-make the tables in order to save some overhead. In this basic setup we'll just let the module create tables for us.
We still need to have a logging database created and ready, so run the MySQL command line client and create a database:
# mysql -uadmin -pmypassword
Enter password:
mysql> create database apachelogs;
If you want to hand-create the tables, run the enclosed 'create-tables' SQL script as follows ("create_tables.sql" needs to be in your current working directory).
mysql> use apachelogs
Database changed
mysql> source create_tables.sql
Create a specific MySQL userid that httpd will use to authenticate and enter data. This userid need not be an actual Unix user. It is a userid internal to MySQL with specific privileges. In the following example command, "apachelogs" is the database, "loguser" is the userid to create, "my.apachemachine.com" is the name of the Apache machine, and "l0gger" is the password to assign. Choose values that are different from these examples.
mysql> grant insert,create on apachelogs.* to loguser@my.apachemachine.com identified by 'l0gger';
You may be especially security-paranoid and want "loguser" to not have "create" capability within the "apachelogs" database. You can disable that privilege, but the cost is that you will not be able to use the module's on-the-fly table creation feature. If that cost is acceptable, hand-create the tables as described in step 3 and use the following GRANT statement instead of the one above:
mysql> grant insert on apachelogs.* to loguser@my.apachemachine.com identified by 'l0gger';
Enable full logging of your MySQL daemon (at least temporarily for debugging purposes) if you don't do this already. Edit /etc/my.cnf and add the following line to your [mysqld] section:
log=/var/log/mysql-messages
Then restart MySQL
# /etc/rc.d/init.d/mysql restart
A very basic logging setup in Apache
Tell the module what database to use and the appropriate authentication information.
So, edit httpd.conf and insert the following lines somewhere after any LoadModule / AddModule statements. Make sure these statements are "global," i.e. not inside any VirtualHost stanza. You will also note that you are embedding a password in the file. Therefore you are advised to "chmod 660 httpd.conf" to prevent unauthorized regular users from viewing your database user and password.
Use the MySQL database called "apachelogs" running on "dbmachine.foo.com". Use username "loguser" and password "l0gg3r" to authenticate to the database. Permit the module create tables for us.
Example 1. Basic Example
LogSQLLoginInfo mysql://loguser:l0gg3r@dbmachine.foo.com/apachelogs
LogSQLCreateTables on
If your database resides on localhost instead of another host, specify the MySQL server's socket file as follows:
LogSQLDBParam socketfile /your/path/to/mysql.sock
If your database is listening on a port other than 3306, specify the correct TCP port as follows:
LogSQLDBParam port 1234
The actual logging is set up on a virtual-host-by-host basis. So, skip down to the virtual host you want to set up. Instruct this virtual host to log entries to the table "access_log" by inserting a LogSQLTransferLogTable directive. (The LogSQLTransferLogTable directive is the minimum required to log -- other directives that you will learn about later simply tune the module's behavior.)
<VirtualHost 1.2.3.4>
[snip]
LogSQLTransferLogTable access_log
[snip]
</VirtualHost>
Restart apache.
# /etc/rc.d/init.d/httpd stop
# /etc/rc.d/init.d/httpd start
Visit your web site in a browser to trigger some hits, then confirm that the entries are being successfully logged:
# mysql -hdbmachine.foo.com -umysqladmin -p -e "select * from access_log" apachelogs
Enter password:
Several lines of output should follow, corresponding to your hits on the site. You now have basic functionality. Don't disable your regular Apache logs until you feel comfortable that the database is behaving as you'd like and that things are going well. If you do not see any entries in the access_log, please consult section Q: 2.2. of the FAQ on how to debug and fix the situation.
You can now activate the advanced features of mod_log_sql, which are described in the next section.
How to tune logging with run-time directives
Instructing the module what to log
The most basic directive for the module is LogSQLTransferLogFormat, which tells the module which information to send to the database; logging to the database will not take place without it. Place a LogSQLTransferLogFormat directive in the VirtualHost stanza of each virtual host that you want to activate.
After LogSQLTransferLogFormat you supply a string of characters that tell the module what information to log. In the configuration directive reference (section LogSQLTransferLogFormat ) there is a table which clearly defines all the possible things to log. Let's say you want to log only the "request time," the "remote host," and the "request"; you'd use:
LogSQLTransferLogFormat hUS
But a more appropriate string to use is
LogSQLTransferLogFormat AbHhmRSsTUuv
which logs all the information required to be compatible with the Combined Log Format (CLF).
If you don't choose to log everything that is available, that's fine. Fields in the unused columns in your table will simply contain NULL.
Some of the LogSQLTransferLogFormat characters require a little extra configuration:
If you specify 'c' to indicate that you want to log the cookie value, you must also tell the module which cookie you mean by using LogSQLWhichCookie -- after all, there could be many cookies associated with a given request. Fail to specify LogSQLWhichCookie, and no cookie information at all will be logged.
If you specify 'M' to indicate that you want to log the machine ID, you must also tell the module this machine's identity using the LogSQLMachineID directive. Fail to specify LogSQLMachineID, and a simple '-' character will be logged in the machine_id column.
Instructing the module what NOT to log using filtering directives
One "accept" and two "ignore" directives allow you to fine-tune what the module should not log. These are very handy for keeping your database as uncluttered as possible and keeping your statistics free of unneeded numbers. Think of each one as a gatekeeper.
It is important to remember that each of these three directives is purely optional. mod_log_sql's default is to log everything.
When a request comes in, the contents of LogSQLRequestAccept are evaluated first. This optional, "blanket" directive lets you specify that only certain things are to be accepted for logging, and everything else discarded. Because it is evaluated before LogSQLRequestIgnore and LogSQLRemhostIgnore it can halt logging before those two filtering directives "get their chance."
Once a request makes it past LogSQLRequestAccept, it still can be excluded based on LogSQLRemhostIgnore and LogSQLRequestIgnore. A good way to use LogSQLRemhostIgnore is to prevent the module from logging the traffic that your internal hosts generate. LogSQLRequestIgnore is great for preventing things like requests for "favicon.ico" from cluttering up your database, as well as excluding the various requests that worms make, etc.
You can specify a series of strings after each directive. Do not use any type of globbing or regular-expression syntax -- each string is considered a match if it is a substring of the larger request or remote-host; the comarison is case-sensitive. This means that "LogSQLRemhostIgnore micro" will ignore requests from "microsoft.com," "microworld.net," "mymicroscope.org," etc. "LogSQLRequestIgnore gif" will instruct the module to ignore requests for "leftbar.gif," "bluedot.gif" and even "giftwrap.jpg" -- but "RED.GIF" and "Tree.Gif" would still get logged because of case sensitivity.
A summary of the decision flow:
If LogSQLRequestAccept exists and a request does not match anything in that list, it is discarded.
If a request matches anything in the LogSQLRequestIgnore list, it is discarded.
If a reqiest matches anything in the LogSQLRemhostIgnore list, it is discarded.
Otherwise the request is logged.
This means that you can have a series of directives similar to the following:
LogSQLRequestAccept .html .gif .jpg
LogSQLRequestIgnore statistics.html bluedot.jpg
So the first line instructs the module to only log files with html, gif and jpg suffixes; requests for "formail.cgi" and "shopping-cart.pl" will never be considered for logging. ("LeftArrow.JPG" will also never be considered for logging -- remember, the comparison is case sensitive.) The second line prunes the list further -- you never want to log requests for those two objects.
Note
If you want to match all the hosts in your domain such as "host1.corp.foo.com" and "server.dmz.foo.com", simply specify:
LogSQLRemhostIgnore foo.com
A great way to catch the vast majority of worm-attack requests and prevent them from being logged is to specify:
LogSQLRequestIgnore root.exe cmd.exe default.ida
To prevent the logging of requests for common graphic types, make sure to put a '.' before the suffix to avoid matches that you didn't intend:
LogSQLRequestIgnore .gif .jpg
Advanced logging scenarios
Using the module in an ISP environment
mod_log_sql has three basic tiers of operation:
The administrator creates all necessary tables by hand and configures each Apache VirtualHost by hand. (LogSQLCreateTables Off)
The module is permitted to create necessary tables on-the-fly, but the administrator configures each Apache VirtualHost by hand. (LogSQLCreateTables On)
The module is permitted to create all necessary tables and to make intelligent, on-the-fly configuration of each VirtualHost. (LogSQLMassVirtualHosting On)
Many users are happy to use the module in its most minimal form: they hand-create any necessary tables (using "create_tables.sql"), and they configure each VirtualHost by hand to suit their needs. However, some administrators need extra features due to a large and growing number of VirtualHosts. The LogSQLMassVirtualHosting directive activates module capabilities that make it far easier to manage an ISP environment, or any situation characterized by a large and varying number of virtual servers.
the on-the-fly table creation feature is activated automatically
the transfer log table name is dynamically set from the virtual host's name (example: a virtual host "www.grubbybaby.com" gets logged to table "access_www_grubbybaby_com")
There are numerous benefits. The admin will not need to create new tables for every new VirtualHost. (Although the admin will still need to drop the tables of virtual hosts that are removed.) The admin will not need to set LogSQLTransferLogTable for each virtual host -- it will be configured automatically based on the host's name. Because each virtual host will log to its own segregated table, data about one virtual server will segregate from others; an admin can grant users access to the tables they need, and they will be unable to view data about another user's virtual host.
In an ISP scenario the admin is likely to have a cluster of many front-end webservers logging to a back-end database. mod_log_sql has a feature that permits analysis of how well the web servers are loadbalancing: the LogSQLMachineID directive. The administrator uses this directive to assign a unique identifier to each machine in the web cluster, e.g. "LogSQLMachineID web01," "LogSQLMachineID web02," etc. Used in conjunction with the 'M' character in LogSQLTransferLogFormat, each entry in the SQL log will include the machine ID of the machine that created the entry. This permits the administrator to count the entries made by each particular machine and thereby analyze the front-end loadbalancing algorithm.
Logging many-to-one data in separate tables
A given HTTP request can have a one-to-many relationship with certain kinds of data. For example, a single HTTP request can have 4 cookies, 3 headers and 5 "mod_gzip" notes associated with it. mod_log_sql is capable of logging these relationships due to the elegance of SQL relational data.
You already have a single table containing access requests. One of the columns in that table is 'id' which is intended to contain the unique request ID supplied by the standard Apache module mod_unique_id -- all you need to do is compile in that module and employ the LogSQLTransferLogFormat character 'I'. Thereafter, each request gets a unique ID that can be thought of as a primary key within the database, useful for joining multiple tables. So let's envision several new tables: a notes table, a cookies table, and a table for inbound and outbound headers.
Table 1. <tblAcc>access_log
id | remote_host | request_uri | time_stamp | status | bytes_sent |
---|
PPIDskBRH30AAGPtAsg | zerberus.aiacs.net | /mod_log_sql/index.html | 1022493617 | 200 | 2215 |
Table 2. <tblNotes>notes_log
id | item | val |
---|
PPIDskBRH30AAGPtAsg | mod_gzip_result | OK |
PPIDskBRH30AAGPtAsg | mod_gzip_compression_ratio | 69 |
Table 3. <tblHdr>headers_log
id | item | val |
---|
PPIDskBRH30AAGPtAsg | Content-Type | text/html |
PPIDskBRH30AAGPtAsg | Accept-Encoding | gzip, deflate |
PPIDskBRH30AAGPtAsg | Expires | Tue, 28 May 2002 10:00:18 GMT |
PPIDskBRH30AAGPtAsg | Cache-Control | max-age=86400 |
We have a certain request, and its unique ID is "PPIDskBRH30AAGPtAsg". Within each separate table will be multiple entries with that request ID: several cookie entries, several header entries, etc. As you can see in tables [tblAcc], [tblNotes] and [tblHdr], you have a one-to-many relationship for request PPIDskBRH30AAGPtAsg: that one access has two associated notes and four associated headers. You can extract this data easily using the power of SQL's "select" statement and table joins. To see the notes associated with a particular request:
select a.remote_host, a.request_uri, n.item, n.val from access_log a, notes_log n
where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';
Table 4. access_log joined to notes_log
remote_host | request_uri | item | val |
---|
zerberus.aiacs.net | /mod_log_sql/index.html | mod_gzip_result | OK |
zerberus.aiacs.net | /mod_log_sql/index.html | mod_gzip_compression_ratio | 69 |
Naturally you can craft similar statements for the outboud headers, inbound headers and cookies, all of which can live in separate tables. Your statements are limited in power only by your skill with SQL.
In order to use this capability of mod_log_sql, you must do several things.
Compile mod_unique_id into Apache (statically or as a DSO). mod_log_sql employs the unique request ID that mod_unique_id provides in order to key between the separate tables. You can still log the data without mod_unqiue_id, but it will be completely uncorrelated and you will have no way to discern any meaning.
Create the appropriate tables. This will be done for you if you permit mod_log_sql to create its own tables using LogSQLCreateTables On, or if you use the enclosed "create_tables.sql" script.
Create a SQL index on the "id" column. Without this index, table joins will be deathly slow. I recommend you consult the MySQL documentation on the proper way to create a column index if you are not familiar with this operation.
Within each appropriate VirtualHost stanza, use the LogSQLWhich* and LogSQL*LogTable directives to tell the module what and where to log the data. In the following example, I have overridden the name for the notes table whereas I have left the other table names at their defaults. I have then specified the cookies, headers and notes that interest me. (And as you can see, these directives do not require me to add any characters to LogSQLTransferLogTable.)
<VirtualHost 216.231.36.128>
(snip)
LogSQLNotesLogTable notestable
LogSQLWhichCookies bluecookie redcookie greencookie
LogSQLWhichNotes mod_gzip_result mod_gzip_compression_ratio
LogSQLWhichHeadersOut Expires Content-Type Cache-Control
LogSQLWhichHeadersIn UserAgent Accept-Encoding Host
(snip)
</VirtualHost>
Using the same database for production and test
Although sub-optimal, it is not uncommon to use the same back-end database for the "production" webservers as well as the "test" webservers (budgetary constraints, rack-space limits, etc.). Furthermore, an administrator in this situation may be unable to use LogSQLRemhostIgnore to exclude requests from the test servers -- perhaps the generated entries are genuinely useful for analytical or QA purposes, but their value after analysis is minimal.
It is wasteful and potentially confusing to permit this internal test data to clutter the database, and a solution to the problem is the proper use of the LogSQLMachineID directive. Assume a scenario where the production webservers have IDs like "web01," "web02," and so on -- and the test webservers have IDs like "test01," "test02," etc. Because entries in the log database are distinguished by their source machine, an administrator may purge unneeded test data from the access log as follows:
delete from access_log where machine_id like 'test%';
Optimizing for a busy database
A busy MySQL database will have SELECT statements running concurrently with INSERT and UPDATE statements. A long-running SELECT can in certain circumstances block INSERTs and therefore block mod_log_sql. A workaround is to enable mod_log_sql for "delayed inserts," which are described as follows in the MySQL documentation.
The DELAYED option for the INSERT statement is a MySQL-specific option that is very useful if you have clients that can't wait for the INSERT to complete. This is a common problem when you use MySQL for logging and you also periodically run SELECT and UPDATE statements that take a long time to complete. DELAYED was introduced in MySQL Version 3.22.15. It is a MySQL extension to ANSI SQL92.
INSERT DELAYED only works with ISAM and MyISAM tables. Note that as MyISAM tables supports concurrent SELECT and INSERT, if there is no free blocks in the middle of the data file, you very seldom need to use INSERT DELAYED with MyISAM.
When you use INSERT DELAYED, the client will get an OK at once and the row will be inserted when the table is not in use by any other thread.
Another major benefit of using INSERT DELAYED is that inserts from many clients are bundled together and written in one block. This is much faster than doing many separate inserts.
The general disadvantages of delayed inserts are
The queued rows are only stored in memory until they are inserted into the table. If mysqld dies unexpectedly, any queued rows that were not written to disk are lost.
There is additional overhead for the server to handle a separate thread for each table on which you use INSERT DELAYED.
Note
The MySQL documentation concludes, "This means that you should only use INSERT DELAYED when you are really sure you need it!" Furthermore, the current state of error return from a failed INSERT DELAYED seems to be in flux, and may behave in unpredictable ways between different MySQL versions. See FAQ entry Q: 3.4. -- you have been warned.
If you are experiencing issues which could be solved by delayed inserts, then set LogSqlDelayedInserts On in the httpd.conf. All regular INSERT statements are now INSERT DELAYED, and you should see no more blocking of the module.
Configuration Directive Reference
It is imperative that you understand which directives are used only once in the main server config, and which are used inside VirtualHost stanzas and therefore multiple times within httpd.conf. The "context" listed with each entry informs you of this.
- LogSQLLoginInfo
LogSQLLoginInfo {connection URI}
Example: LogSQLLoginInfo mysql://logwriter:passw0rd@foobar.baz.com/Apache_log
Context: main server config
Defines the basic connection URI to connect to the database with. The format of the connection URI is
driver://username[:password]@hostname[:port]/database
- driver
- The database driver to use (mysql, pgsql, etc..)
- username
- The database username to login with INSERT privileges on the logging table defined in LogSQLtransferLogTable.
- password
- The password to use for username, and can be omitted if there is no password.
- hostname
- The hostname or Ip address of the Database machine, ans is simple "localhost" if the database lives on the same machine as Apache.
- port
- Port on hostname to connect to the Database, if not specified use the default port for the database.
- database
- The database to connect to on the server.
Note
This is defined only once in the httpd.conf file.
This directive Must be defined for logging to be enabled.
- LogSQLDBParam
LogSQLDBParam {parameter-name} {value}
Example: LogSQLDBParam socketfile /var/lib/mysql/mysql.socket
Context: main server config
This is the new method of specifying Database connection credentials and settings. This is used to define database driver specific options. For a list of options read the documentation for each specific database driver.
Note
Each parameter-name may only be defined once.
- LogSQLCreateTables
LogSQLCreateTables {flag}
Example: LogSQLCreateTables On
Default: Off
Context: main server config
mod_log_sql has the ability to create its tables on-the-fly. The advantage to this is convenience: you don't have to execute any SQL by hand to prepare the table. This is especially helpful for people with lots of virtual hosts (who should also see the LogSQLMassVirtualHosting directive).
There is a slight disadvantage: if you wish to activate this feature, then the userid specified in LogSQLLoginInfo must have CREATE privileges on the database. In an absolutely paranoid, locked-down situation you may only want to grant your mod_log_sql user INSERT privileges on the database; in that situation you are unable to take advantage of LogSQLCreateTables. But most people -- even the very security-conscious -- will find that granting CREATE on the logging database is reasonable.
Note
This is defined only once in the httpd.conf file.
- LogSQLForcePreserve
LogSQLForcePreserve {flag}
Example: LogForcePreserve On
Default: Off
Context: main server config
You may need to perform debugging on your database and specifically want mod_log_sql to make no attempts to log to it. This directive instructs the module to send all its log entries directly to the preserve file and to make no database INSERT attempts.
This is presumably a directive for temporary use only; it could be dangerous if you set it and forget it, as all your entries will simply pile up in the preserve file.
Note
This is defined only once in the httpd.conf file.
- LogSQLDisablePreserve
LogSQLDisablePreserve {flag}
Example: LogDisablePreserve On
Default: Off
Context; main server config
This option can be enabled to completely disable the preserve file fail back. This may be useful for servers where the file-system is read-only.
If the database is not available those log entries will be lost.
Note
This is defined only once in the httpd.conf file.
- LogSQLMachineID
LogSQLMachineID {machineID}
Example: LogSQLMachineID web01
Context: main server config
If you have a farm of webservers then you may wish to know which particular machine made each entry; this is useful for analyzing your load-balancing methodology. LogSQLMachineID permits you to distinguish each machine's entries if you assign each machine its own LogSQLMachineID: for example, the first webserver gets ``LogSQLMachineID web01,'' the second gets ``LogSQLMachineID web02,'' etc.
Note
This is defined only once in the httpd.conf file.
- LogSQlPreserveFile
LogSQLPreserveFile {filename}
Example: LogSQLPreserveFile offline-preserve
Default: /tmp/sql-preserve
Context: virtual host
mod_log_sql writes queries to this local preserve file in the event that it cannot reach the database, and thus ensures that your high-availability web frontend does not lose logs during a temporary database outage. This could happen for a number of reasons: the database goes offline, the network breaks, etc. You will not lose entries since the module has this backup. The file consists of a series of SQL statements that can be imported into your database at your convenience; furthermore, because the SQL queries contain the access timestamps you do not need to worry about out-of-order data after the import, which is done in a simple manner:
# mysql -uadminuser -p mydbname < /tmp/sql-preserve
If you do not define LogSQLPreserveFile then all virtual servers will log to the same default preserve file (/tmp/sql-preserve). You can redefine this on a virtual-host basis in order to segregate your preserve files if you desire. Note that segregation is not usually necessary, as the SQL statements that are written to the preserve file already distinguish between different virtual hosts if you include the 'v' character in your LogSQLTransferLogFormat directive. It is only necessary to segregate preserve-files by virualhost if you also segregate access logs by virtualhost.
The module will log to Apache's ErrorLog when it notices a database outage, and upon database return. You will therefore know when the preserve file is being used, although it is your responsibility to import the file.
The file does not need to be created in advance. It is safe to remove or rename the file without interrupting Apache, as the module closes the filehandle immediately after completing the write. The file is created with the user & group ID of the running Apache process (e.g. 'nobody' on many Linux distributions).
- LogSQLTransferLogTable
LogSQLTransferLogTable {table-name}
Example: LogSQLTransferLogTable access_log_table
Context: virtual host
Defines which table is used for logging of Apache's transfers; this is analogous to Apache's TransferLog directive. table-name must be a valid table within the database defined in the LogSQLLoginInfo connection URI.
This directive is not necessary if you declare LogSQLMassVirtualHosting On, since that directive activates dynamically-named tables. If you attempt to use LogSqlTransferlogTable at the same time a warning will be logged and it will be ignored, since LogSQLMassVirtualHosting takes priority.
Note
Requires unless LogSQLMassVirtualHosting is set to On
- LogSQLCookieLogTable
LogSQLCookieLogTable {table-name}
Example: LogSQLCookieLogTable cookie_log
Default: cookies
Context: virtual host
Defines which table is used for logging of cookies. Working in conjunction with LogSQLWhichCookies, you can log many of each request's associated cookies to a separate table. For meaningful data retrieval the cookie table is keyed to the access table by the unique request ID supplied by the standard Apache module mod_unique_id.
Note
You must create the table (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to "on".
- LogSQLHeadersInLogTable
LogSQLHeadersInLogTable {table-name}
Example: LogSQLHeadersInLogTable headers
Default: headers_in
Context: virtual host
Defines which table is used for logging of inbound headers. Working in conjunction with LogSQLWhichHeadersIn, you can log many of each request's associated headers to a separate table. For meaningful data retrieval the headers table is keyed to the access table by the unique request ID supplied by the standard Apache module mod_unique_id.
Note
Note that you must create the table (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to "on".
- LogSQLHeadersOutLogTable
LogSQLHeadersOutLogTable {table-name}
Example: LogSQLHeadersOutLogTable headers
Default: headers_out
Context: virtual host
Defines which table is used for logging of outbound headers. Working in conjunction with LogSQLWhichHeadersOut, you can log many of each request's associated headers to a separate table. For meaningful data retrieval the headers table is keyed to the access table by the unique request ID supplied by the standard Apache module mod_unique_id.
Note
Note that you must create the table (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to "on".
- LogSQLNotesLogTable
LogSQLNotesLogTable {table-name}
Example: LogSQLNotesLogTable notes-log
Default: notes
Context: virtual_host
Defines which table is used for logging of notes. Working in conjunction with LogSQLWhichNotes, you can log many of each request's associated notes to a separate table. For meaningful data retrieval the notes table is keyed to the access table by the unique request ID supplied by the standard Apache module mod_unique_id.
Note
This table must be created (see create-tables.sql included in the package), or LogSQLCreateTables must be set to 'On'.
- LogSQLMassVirtualHosting
LogSQLMassVirtualHosting {flag}
Example: LogSQLMassVirtualHosting On
Default: Off
Context: main server config
If you administer a site hosting many, many virtual hosts then this option will appeal to you. If you turn on LogSQLMassVirtualHosting then several things happen:
the on-the-fly table creation feature is activated automatically
the transfer log table name is dynamically set from the virtual host's name after stripping out SQL-unfriendly characters (example: a virtual host www.grubbybaby.com gets logged to table access_www_grubbybaby_com)
which, in turn, means that each virtual host logs to its own segregated table. Because there is no data shared between virtual servers you can grant your users access to the tables they need; they will be unable to view others' data.
This is a huge boost in convenience for sites with many virtual servers. Activating LogSQLMassVirtualHosting obviates the need to create every virtual server's table and provides more granular security possibilities.
Note
This is defined only once in the httpd.conf file.
Configuring What Is logged
- LogSQLTransferLogFormat
LogSQLTransferLogFormat {format-string}
Example: LogSQLTransferLogFormat huSUTv
Default: AbHhmRSsTUuv
Context: virtual host
Each character in the format-string defines an attribute of the request that you wish to log. The default logs the information required to create Combined Log Format logs, plus several extras. Here is the full list of allowable keys, which sometimes resemble their Apache counterparts, but do not always:
Table 5. Core LogFormat parameters
Symbol | Meaning | DB Field | Data Type | Example |
---|
A | User Agent | agent | varchar(255) | Mozilla/4.0 (compat; MSIE 6.0; Windows) |
a | CGi request arguments | request_args | varchar(255) | user=Smith&cart=1231&item=532 |
b | Bytes transfered | bytes_sent | int unsigned | 32561 |
c??? | Text of cookie | cookie | varchar(255) | Apache=sdyn.fooonline.net 1300102700823 |
f | Local filename requested | request_file | varchar(255) | /var/www/html/books-cycroad.html |
H | HTTP request_protocol | request_protocol | varchar(10) | HTTP/1.1 |
h | Name of remote host | remote_host | varchar(50) | blah.foobar.com |
I | Request ID (from modd_unique_id) | id | char(19) | POlFcUBRH30AAALdBG8 |
l | Ident user info | remote_logname | varcgar(50) | bobby |
M | Machine ID??? | machine_id | varchar(25) | web01 |
m | HTTP request method | request_method | varchar(10) | GET |
P | httpd cchild PID | child_pid | smallint unsigned | 3215 |
p | http port | server_port | smallint unsigned | 80 |
R | Referer | referer | varchar(255) | http://www.biglinks4u.com/linkpage.html |
r | Request in full form | request_line | varchar(255) | GET /books-cycroad.html HTTP/1.1 |
S | Time of request in UNIX time_t format | time_stamp | int unsigned | 1005598029 |
T | Seconds to service request | request_duration | smallint unsigned | 2 |
t | Time of request in human format | request_time | char(28) | [02/Dec/2001:15:01:26 -0800] |
U | Request in simple form | request_uri | varchar(255) | /books-cycroad.html |
u | User info from HTTP auth | remote_user | varchar(50) | bobby |
v | Virtual host servicing the request | virtual_host | varchar(255) | www.foobar.com |
V | requested Virtual host name (mass virtualhosting) | virtual_host | varchar(255) | www.foobar.org |
Note
[1] You must also specify LogSQLWhichCookie for this to take effect.
[2] You must also specify LogSQLmachineID for this to take effect.
Table 6. SSL LogFormat Parameters
Symbol | Meaning | DB Field | Data Type | Example |
---|
z | SSL cipher used | ssl_cipher | varchar(25) | RC4-MD5 |
q | Keysize of the SSL connection | ssl_keysize | smallint unsigned | 56 |
Q | maximum keysize supported | ssl_maxkeysize | smallint unsigned | 128 |
- LogSQLRemhostIgnore
LogSQLRemhostIgnore {hostname...}
Example: LogSQLRemhostIgnore localnet.com
Context: virtual host
Lists a series of smortrings that, if present in the REMOTE_HOST, will cause that request to not be logged. This directive is useful for cutting down on log clutter when you are certain that you want to ignore requests from certain hosts, such as your own internal network machines. See section Instructing the module what NOT to log using filtering directives for some tips for using this directive.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
Each string is separated by a space, and no regular expressions or globbing are allowed. Each string is evaluated as a substring of the REMOTE_HOST using strstr(). The comparison is case sensitive.
- LogSQLRequestAccept
LogSQLRequestAccept {substring...}
Example: LogSQLRequestAccept .html .php .jpg
Default: if not specified, all requests are 'accepted'
Context: virtual host
Lists a series of strings that, if present in the URI, will permit that request to be considered for logging (depending on additional filtering by the "ignore" directives). Any request that fails to match one of the LogSQLRequestAccept entries will be discarded.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
This directive is useful for cutting down on log clutter when you are certain that you only want to log certain kinds of requests, and just blanket-ignore everything else. See section Instructing the module what NOT to log using filtering directives for some tips for using this directive.
Each string is separated by a space, and no regular expressions or globbing are allowed. Each string is evaluated as a substring of the URI using strstr(). The comparison is case sensitive.
This directive is completely optional. It is more general than LogSQLRequestIgnore and is evaluated before LogSQLRequestIgnore . If this directive is not used, all requests are accepted and passed on to the other filtering directives. Therefore, only use this directive if you have a specific reason to do so.
- LogSQLRequestIgnore
LogSQLRequestIgnore {substring...}
Example: LogSQLRequestIgnore root.exe cmd.exe default.ida favicon.ico
Context: virtual host
Lists a series of strings that, if present in the URI, will cause that request to NOT be logged. This directive is useful for cutting down on log clutter when you are certain that you want to ignore requests for certain objects. See section Instructing the module what NOT to log using filtering directives for some tips for using this directive.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
Each string is separated by a space, and no regular expressions or globbing are allowed. Each string is evaluated as a substring of the URI using strstr(). The comparison is case sensitive.
- LogSQLWhichCookie
LogSQLWhichCookie {cookiename}
Example; LogSQLWhichCookie Clicks
Context: virtual host
In HTTP, cookies have names to distinguish them from each other. Using mod_usertrack, for example, you can give your user-tracking cookies a name with the CookieName directive.
mod_log_sql allows you to log cookie information. LogSQL_WhichCookie tells mod_log_sql which cookie to log. This is necessary because you will usually be setting and receiving more than one cookie from a client.
Note
You must include a 'c' character in LogSQLTransferLogFormat for this directive to take effect.
although this was origintally intended for people using mod_usertrack to create user-tracking cookies, you are not restricted in any way. You can choose which cookie you wish to log to the database - any cookie at all - and it does not necessarily have to have anything to do with mod_usertrack.
- LogSQLWhichCookies
LogSQLWhichCookies {cookie-name...}
Example: logSQLWhichCookies userlogin cookie1 cookie2
Context: virtual host
Defines the list of cookies you would like logged. This works in conjunction with LogSQLCookieLogTable. This directive does not require any additional characters to be added to the LogSQLTransferLogFormat string. The feature is activated simply by including this directive, upon which you will begin populating the separate cookie table with data.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
Note
The table must be created (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to 'On'.
- LogSQLWhichHeadersIn
LogSQLWhichHeadersIn {header-name...}
Example: LogSQLWhichHeadersIn UserAgent Accept-Encodeing Host
Context: virtual host
Defines the list of inbound headers you would like logged. This works in conjunction with LogSQLHeadersInLogTable. This directive does not require any additional characters to be added to the LogSQLTransferLogFormat string. The feature is activated simply by including this directive, upon which you will begin populating the separate inbound-headers table with data.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
Note
The table must be created (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to 'On'.
- LogSQLWhichHeadersOut
LogSQLWhichHeadersOut {header-name...}
Example: LogSQLWhichHeadersOut Expires Content-Type Cache-Control
Context: virtual host
Defines the list of outbound headers you would like logged. This works in conjunction with LogSQLHeadersOutLogTable. This directive does not require any additional characters to be added to the LogSQLTransferLogFormat string. The feature is activated simply by including this directive, upon which you will begin populating the separate outbound-headers table with data.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
Note
The table must be created (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to 'On'.
- LogSQLWhichNotes
LogSQLWhichNotes {note-name...}
Example: LogSQLWhichNotes mod_gzip_result mod_gzip_ompression_ratio
Context: virtual host
Defines the list of notes you would like logged. This works in conjunction with LogSQLNotesLogTable. This directive does not require any additional characters to be added to the LogSQLTransferLogFormat string. The feature is activated simply by including this directive, upon which you will begin populating the separate notes table with data.
Each string may contain a + or - prefix in a <VirtualHost> context and will cause those strings to be added (+) or removed (-) from the global configuration. Otherwise the global is completely ignored and overridden if defined in a <VirtualHost>
Note
The table must be created (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to 'On'.
- LogSQLSocketFile [Deprecated]
LogSQLSocketFile {filename}
Example: LogSQLSocketFile /tmp/mysql.sock
Default: (database specific)
Default (MySQL): /var/lib/mysql/mysql.sock
Context: main server config
At Apache runtime you can specify the MySQL socket file to use. Set this once in your main server config to override the default value. This value is irrelevant if your database resides on a separate machine.
mod_log_sql will automatically employ the socket for db communications if the database resides on the local host. If the db resides on a separate host the module will automatically use TCP/IP. This is a function of the MySQL API and is not user-configurable.
Note
This directive is deprecated in favor of LogSQLDBParam socketfile [socketfilename]
This is defined only once in the httpd.conf file.
- LogSQLTCPPort [Deprecated]
LogSQLTCPPort {port-number}
Example: LogSQLTCPPort 3309
Default: (database specific)
Default (MySQL): 3306
Context: main server config
Your database may listen on a different port than the default. If so, use this directive to instruct the module which port to use. This directive only applies if the database is on a different machine connected via TCP/IP.
Note
This directive is deprecated in favor of LogSQLDBParam tcpport [port-number]
This is defined only once in the httpd.conf file.
- LogSQLDatabase [Deprecated]
LogSQLDatabase {database}
Example: LogSQLDatabase loggingdb
Context: main server config
Defines the database that is used for logging. "database" must be a valid db on the MySQL host defined in LogSQLLoginInfo
Note
This directive is deprecated in favor of the URI form of LogSQLLoginInfo.
This is defined only once in the httpd.conf file.
- 1. General module questions
- 1.1. Why log to an SQL database?
- 1.2. Why use MySQL? Are there alternatives?
- 1.3. Is this code production-ready?
- 1.4. Who's using mod_log_sql?
- 1.5. Why doesn't the module also replace the Apache ErrorLog?
- 1.6. Does mod_log_sql work with Apache 2.x?
- 1.7. Does mod_log_sql connect to MySQL via TCP/IP or a socket?
- 1.8. I have discovered a bug. Who can I contact?
- 2. Problems
- 2.1. Apache segfaults or has other problems when using PHP and mod_log_sql
- 2.2. Apache appears to start up fine, but nothing is getting logged in the database
- 2.3. Why do I get the message "insufficient configuration info to establish database link" in my Apache error log?
- 2.4. My database cannot handle all the open connections from mod_log_sql, is there anything I can do?
- 2.5. Why do I occasionally see a "lost connection to MySQL server" message in my Apache error log?
- 2.6. Sometimes a single VirtualHost gets logged to two different tables (e.g. access_foo_com, access_www_foo_com). Or, accesses to an unqualified hostname (e.g. "http://intranet/index.html") get logged in separate tables.
- 3. Performance and Tuning
- 3.1. How well does it perform?
- 3.2. Do I need to be worried about all the running MySQL children? Will holding open n Apache-to-MySQL connections consume a lot of memory?
- 3.3. My webserver cannot handle all the traffic that my site receives, is there anything I can do?
- 3.4. What is the issue with activating delayed inserts?
- 4. "How do I...?" -- accomplishing certain tasks
- 4.1. How do I extract the data in a format that my analysis tool can understand?
- 4.2. How can I log mod_usertrack cookies?
- 4.3. What if I want to log more than one cookie? What is the difference between LogSQLWhichCookie and LogSQLWhichCookies?
- 4.4. What are the SSL logging features, and how do I activate them?
1. General module questions |
1.1. | Why log to an SQL database? |
| To begin with, let's get it out of the way: logging to a database is not a panacea. But while there are complexities with this solution, the benefit can be substantial for certain classes of administrator or people with advanced requirements: Chores like log rotation go away, as you can DELETE records from the SQL database once they are no longer useful. For example, the excellent and popular log-analysis tool Webalizer (http://www.webalizer.com) does not need historic logs after it has processed them, enabling you to delete older logs. People with clusters of web servers (for high availability) will benefit the most - all their webservers can log to a single SQL database. This obviates the need to collate/interleave the many separate logfiles, which can be / highly/ problematic. People acquainted with the power of SQL SELECT statements will know the flexibility of the extraction possibilities at their fingertips.
For example, do you want to see all your 404's? Do this: select remote_host,status,request_uri,bytes_sent,from_unixtime(time_stamp) from acc_log_tbl where status=404 order by time_stamp; Table 7. remote_host | status | request_uri | bytes_sent | from_unixtime(time_stamp) |
---|
marge.mmm.co.uk | 404 | /favicon.ico | 321 | 2001-11-20 02:30:56 | 62.180.239.251 | 404 | /favicon.ico | 333 | 2001-11-20 02:45:25 | 212.234.12.66 | 404 | /favicon.ico | 321 | 2001-11-20 03:01:00 | 212.210.78.254 | 404 | /favicon.ico | 333 | 2001-11-20 03:26:05 |
Or do you want to see how many bytes you've sent within a certain directory or site? Do this: select request_uri,sum(bytes_sent) as bytes,count(request_uri) as howmany from acc_log_tbl where request_uri like '%mod_log_sql%' group by request_uri order by howmany desc; Table 8. request_uri | bytes | howmany |
---|
/mod_log_sql/style_1.css | 157396 | 1288 | /mod_log_sql/ | 2514337 | 801 | /mod_log_sql/mod_log_sql.tar.gz | 9769312 | 456 | /mod_log_sql/faq.html | 5038728 | 436 |
Or maybe you want to see who's linking to you? Do this: select count(referer) as num,referer from acc_log_tbl where request_uri='/mod_log_sql/' group by referer order by num desc; Table 9. num | referer |
---|
271 | http://freshmeat.net/projects/mod_log_sql/ | 96 | http://modules.apache.org/search?id=339 | 48 | http://freshmeat.net/ | 8 | http://freshmeat.net |
As you can see, there are myriad possibilities that can be constructed with the wonderful SQL SELECT statement. Logging to an SQL database can be really quite useful! |
1.2. | Why use MySQL? Are there alternatives? |
| MySQL is a robust, free, and very powerful production-quality database engine. It is well supported and comes with detailed documentation. Many 3rd-party software pacakges (e.g. Slashcode, the engine that powers Slashdot) run exclusively with MySQL. In other words, you will belong to a very robust and well-supported community by choosing MySQL. That being said, there are alternatives. PostgreSQL is probably MySQL's leading "competitor" in the free database world. There is also an excellent module available for Apache to permit logging to a PostgreSQL database, called pgLOGd |
| NoteCurrently a database abstraction system is in the works to allow any database to be used with mod_log_sql. |
1.3. | Is this code production-ready? |
| By all accounts it is. It is known to work without a problem on many-thousands-of-hits-per-day webservers. Does that mean it is 100% bug free? Well, no software is, but it is well-tested and believed to be fully compatible with production environments. (The usual disclaimers apply. This software is provided without warranty of any kind.) |
1.4. | Who's using mod_log_sql? |
| Good question! It would be great to find out! If you are a production-level mod_log_sql user, please contact eddie at <urkle <at> outoforder <dot> cc> so that you can be mentioned here. |
1.5. | Why doesn't the module also replace the Apache ErrorLog? |
| There are circumstances when that would be quite unwise -- for example, if Apache could not reach the MySQL server for some reason and needed to log that fact. Without a text-based error log you'd never know anything was wrong, because Apache would be trying to log a database connection error to the database... you get the point. |
| Error logs are usually not very high-traffic and are really best left as text files on a web server machine. |
| The Error log is free format text.. (no specified formatting what, so ever) which is rather difficult to nicely format for storing in a database. |
1.6. | Does mod_log_sql work with Apache 2.x? |
| Yes. A port of mod_log_sql is available for Apache 2.x as of mod_log_sql 1.90 |
1.7. | Does mod_log_sql connect to MySQL via TCP/IP or a socket? |
| Quick answer, Yes. |
| It depends! This is not determined by mod_log_sql. mod_log_sql relies on a connection command that is supplied in the MySQL API, and that command is somewhat intelligent. How it works: - if the specified MySQL database is on the same machine, the connection command uses a socket to communicate with MySQL
- if the specified MySQL database is on a different machine, mod_log_sql connects using TCP/IP.
You don't have any control of which methodology is used. You can fine-tune some of the configuration, however. The LogSQLSocketFile runtime configuration directive overrides the default of "/var/lib/mysql/mysql.sock" for socket-based connections, whereas the LogSQLTCPPort command allows to you override the default TCP port of 3306 for TCP/IP connections. |
1.8. | I have discovered a bug. Who can I contact? |
| Please contact Edward Rudd at <urkle <at> outoforder <dot> cc>, or post a message to the mod_log_sql Mailing Lists. Your comments, suggestions, bugfixes, bug catches, and usage testimonials are always welcome. As free software, mod_log_sql is intended to be a community effort -- any code contributions or other ideas will be fully and openly credited, of course. |
2. Problems |
2.1. | Apache segfaults or has other problems when using PHP and mod_log_sql |
| This occurs if you compiled PHP with MySQL database support. PHP utilizes its internal, bundled MySQL libraries by default. These conflict with the "real" MySQL libraries linked by mod_log_sql, causing the segmentation fault. PHP and mod_log_sql can be configured to happily coexist. The solution is to configure PHP to link against the real MySQL libraries: recompile PHP using --with-mysql=/your/path. Apache will run properly once the modules are all using the same version of the MySQL libraries. |
2.2. | Apache appears to start up fine, but nothing is getting logged in the database |
| If you do not see any entries in the access_log, then something is preventing the inserts from happening. This could be caused by several things: - Improper privileges set up in the MySQL database
- You are not hitting a VirtualHost that has a LogSQLTransferLogTable entry
- You did not specify the right database host or login information
- Another factor is preventing a connection to the database
NoteIt is improper to ask for help before you have followed these steps. First examine the MySQL log that you established in step 6 of section Preparing MySQL for logging. Ensure that the INSERT statements are not being rejected because of a malformed table name or other typographical error. By enabling that log, you instructed MySQL to log every connection and command it receives -- if you see no INSERT attempts in the log, the module isn't successfully connecting to the database. If you see nothing at all in the log -- not even a record of your administrative connection attempts, then you did not enable the log correctly. If you do see INSERT attempts but they are failing, the log should tell you why. Second, confirm that your LogSQL* directives are all correct. Third, examine the Apache error logs for messages from mod_log_sql; the module will offer hints as to why it cannot connect, etc. The next thing to do is to change the LogLevel directive in the main server config as well as in each VirtualHost config: LogLevel debug
ErrorLog /var/log/httpd/server-messages |
2.3. | Why do I get the message "insufficient configuration info to establish database link" in my Apache error log? |
| At a minimum, LogSQLLoginInfo in the URl form and either LogSQLTableName or LogSQLMassVirtualHosting must be defined in order for the module to be able to establish a database link. If these are not defined or are incomplete you will receive this error message. |
2.4. | My database cannot handle all the open connections from mod_log_sql, is there anything I can do? |
| The rule of thumb: if you have n webservers each configured to support y MaxClients, then your database must be able to handle n times y simultaneous connections in the worst case. Certainly you must use common sense, consider reasonable traffic expectations and structure things accordingly. |
| Tweaking my.cnf to scale to high connection loads is imperative. But if hardware limitations prevent your MySQL server from gracefully handling the number of incoming connections, it would be beneficial to upgrade the memory or CPU on that server in order to handle the load. |
| Jeremy Zawodny, a highly respected MySQL user and contributor to Linux Magazine, has this very helpful and highly appropriate article on tuning MySQL: MySQL, Linux, and Thread Caching |
| Please remember that mod_log_sql's overriding principle is performance -- that is what the target audience demands and expects. Other database logging solutions do not open and maintain many database connections, but their performance suffers drastically. For example, pgLOGd funnels all log connections through a separate daemon that connects to the database, but that bottlenecks the entire process. mod_log_sql achieves performance numbers an order of magnitude greater than the alternatives because it dispenses with the overhead associated with rapid connection cycling, and it does not attempt to shoehorn all the database traffic through a single extra daemon or proxy process. |
| NoteCurrently connection pooling is being implemented as part of the Database Abstraction layer to allow multiple httpd processes to share connections. |
2.5. | Why do I occasionally see a "lost connection to MySQL server" message in my Apache error log? |
| This message may appear every now and then in your Apache error log, especially on very lightly loaded servers. This does not mean that anything is necessarily wrong. Within each httpd child process, mod_log_sql will open (and keep open) a connection to the MySQL server. MySQL, however, will close connections that have not been used in a while; the default timeout is 8 hours. When this occurs, mod_log_sql will notice and re-open the connection. That event is what is being logged, and looks like this: [Tue Nov 12 19:04:10 2002] [error] mod_log_sql: first attempt failed,
API said: error 2013, Lost connection to MySQL server during query
[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: reconnect successful
[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: second attempt successful Reference: MySQL documentation |
2.6. | Sometimes a single VirtualHost gets logged to two different tables (e.g. access_foo_com, access_www_foo_com). Or, accesses to an unqualified hostname (e.g. "http://intranet/index.html") get logged in separate tables. |
| Proper usage of the Apache runtime ServerName directive and the directive UseCanonicalName On (or DNS) are necessary to prevent this problem. "On" is the default for UseCanonicalName, and specifies that self-referential URLs are generated from the ServerName part of your VirtualHost: With UseCanonicalName on (and in all versions prior to 1.3) Apache will use the ServerName and Port directives to construct the canonical name for the server. With UseCanonicalName off Apache will form self-referential URLs using the hostname and port supplied by the client if any are supplied (otherwise it will use the canonical name, as defined above). [From the Apache documentation] The module inherits Apache's "knowledge" about the server name being accessed. As long as those two directives are properly configured, mod_log_sql will log to only one table per virtual host while using LogSQLMassVirtualHosting. |
3. Performance and Tuning |
3.1. | How well does it perform? |
| mod_log_sql scales to very high loads. Apache 1.3.22 + mod_log_sql was benchmarked using the "ab" (Apache Bench) program that comes with the Apache distribution; here are the results. Overall configuration - Machine A: Apache webserver
- Machine B: MySQL server
- Machines A and B connected with 100Mbps Ethernet
- Webserver: Celeron 400, 128MB RAM, IDE storage
Example 2. Apache configuration Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
StartServers 10
MaxSpareServers 15
MaxClients 256
MaxRequestsPerChild 5000
LogSQLTransferLogFormat AbHhmRSsTUuvc
LogSQLWhichCookie Clicks
CookieTracking on
CookieName Clicks Example 3. "ab" commandline ./ab -c 10 -t 20 -v 2 -C Clicks=ab_run
http://www.hostname.com/target ( 10 concurrent requests; 20 second test; setting a cookie "Clicks=ab_run"; target = the mod_log_sql homepage. ) Ten total ab runs were conducted: five with MySQL logging enabled, and five with all MySQL directives commented out of httpd.conf. Then each five were averaged. The results: - Average of five runs employing MySQL and standard text logging: 139.01 requests per second, zero errors.
- Average of five runs employing only standard text logging: 139.96 requests per second, zero errors.
In other words, any rate-limiting effects on this particular hardware setup are not caused by MySQL. Note that although this very simple webserver setup is hardly cutting-edge -- it is, after all, a fairly small machine -- 139 requests per second equal over twelve million hits per day. If you run this benchmark yourself, take note of three things: - Use a target URL that is on your own webserver :-).
- Wait until all your connections are closed out between runs; after several thousand requests your TCP/IP stack will be filled with hundreds of connections in TIME_WAIT that need to close. Do a "netstat -t|wc -l" on the webserver to see. If you don't wait, you can expect to see a lot of messages like "ip_conntrack: table full, dropping packet" in your logs. (This has nothing to do with mod_log_sql, this is simply the nature of the TCP/IP stack in the Linux kernel.)
When done with your runs, clean these many thousands of requests out of your database: mysql> delete from access_log where agent like 'ApacheBench%';
mysql> optimize table access_log;
|
3.2. | Do I need to be worried about all the running MySQL children? Will holding open n Apache-to-MySQL connections consume a lot of memory? |
| Short answer: you shouldn't be worried. |
| Long answer: you might be evaluating at the output of "ps -aufxw" and becoming alarmed at all the 7MB httpd processes or 22MB mysqld children that you see. Don't be alarmed. It's true that mod_log_sql opens and holds open many MySQL connections: each httpd child maintains one open database connection (and holds it open for performance reasons). Four webservers, each running 20 Apache children, will hold open 80 MySQL connections, which means that your MySQL server needs to handle 80 simultaneous connections. In truth, your MySQL server needs to handle far more than that if traffic to your website spikes and the Apache webservers spawn off an additional 30 children each... Fortunately the cost reported by 'ps -aufxw' is deceptive. This is due to an OS memory-management feature called "copy-on-write." When you have a number of identical child processes (e.g. Apache, MySQL), it would appear in "ps" as though each one occupies a great deal of RAM -- as much as 7MB per httpd child! In actuality each additional child only occupies a small bit of extra memory -- most of the memory pages are common to each child and therefore shared in a "read-only" fashion. The OS can get away with this because the majority of memory pages for one child are identical across all children. Instead of thinking of each child as a rubber stamp of the others, think of each child as a basket of links to a common memory area. A memory page is only duplicated when it needs to be written to, hence "copy-on-write." The result is efficiency and decreased memory consumption. "ps" may report 7MB per child, but it might really only "cost" 900K of extra memory to add one more child. It is not correct to assume that 20 Apache children with a VSZ of 7MB each equals (2 x 7MB) of memory consumption -- the real answer is much, much lower. The same "copy-on-write" rules apply to all your MySQL children: 40 mysqld children @ 22MB each do not occupy 880MB of RAM. The bottom line: although there is a cost to spawn extra httpd or mysqld children, that cost is not as great as "ps" would lead you to believe. |
3.3. | My webserver cannot handle all the traffic that my site receives, is there anything I can do? |
| If you have exhausted all the tuning possibilities on your existing server, it is probably time you evaluated the benefits of clustering two or more webservers together in a load-balanced fashion. In fact, users of such a setup are mod_log_sql's target audience! |
3.4. | What is the issue with activating delayed inserts? |
| INSERT DELAYED is a specific syntax to MySQL and is not supported by any other database. Ergo, why is it needed, and what MySQL deficiency is it working around? INSERT DELAYED is a kluge. |
| The MySQL documentation is unclear whether INSERT DELAYED is even necessary for an optimized database. It says, "The DELAYED option for the INSERT statement is a MySQL-specific option that is very useful if you have clients that can't wait for the INSERT to complete." But then it goes on to say, "Note that as MyISAM tables supports concurrent SELECT and INSERT, if there is no free blocks in the middle of the data file, you very seldom need to use INSERT DELAYED with MyISAM." |
| Because INSERT DELAYED returns without waiting for the data to be written, a hard kill of your MySQL database at the right (wrong?) moment could lose those logfile entries. |
| As of MySQL version 3.23.52, the error return functions disagree after a failed INSERT DELAYED: mysql_errno() always returns 0, even if mysql_error() returns a textual error. I have reported this bug to the MySQL folks. However, we have no way of knowing what solution they will adopt to fix this, and with the worst case solution mod_log_sql would not be able to tell if anything went wrong with a delayed insert. |
| Instead of delayed inserts, you may wish to utilize InnoDB tables (instead of the standard MyISAM tables). InnoDB tables suppot row-level locking and are recommended for high-volume databases. |
| If after understanding these problems you still wish to enable delayed inserts, section Optimizing for a busy database discusses how. |
4. "How do I...?" -- accomplishing certain tasks |
4.1. | How do I extract the data in a format that my analysis tool can understand? |
| mod_log_sql would be virtually useless if there weren't a way for you to extract the data from your database in a somewhat meaningful fashion. To that end there's a Perl script enclosed with the distribution. That script (make_combined_log.pl) is designed to extract N-many days worth of access logs and provide them in a Combined Log Format output. You can use this very tool right in /etc/crontab to extract logs on a regular basis so that your favorite web analysis tool can read them. Or you can examine the Perl code to construct your own custom tool. For example, let's say that you want your web statistics updated once per day in the wee hours of the morning. A good way to accomplish that could be the following entries in /etc/crontab: # Generate the temporary apache logs from the MySQL database (for webalizer)
05 04 * * * root make_combined_log.pl 1 www.grubbybaby.com > /var/log/temp01
# Run webalizer on httpd log
30 04 * * * root webalizer -c /etc/webalizer.conf; rm -f /var/log/temp01 Or if you have a newer system that puts files in /etc/cron.daily etc., create a file called "webalizer" in the cron.daily subdirectory. Use the following as the contents of your file, and make sure to chmod 755 it when done. #!/bin/sh
/usr/local/sbin/make_combined_log.pl 1 www.yourdomain.com > /var/log/httpd/templog
/usr/local/bin/webalizer -q -c /etc/webalizer.conf
rm -f /var/log/httpd/templog See? Easy. |
4.2. | How can I log mod_usertrack cookies? |
| A number of people like to log mod_usertrack cookies in their Apache TransferLog to aid in understanding their visitors' clickstreams. This is accomplished, for example, with a statement as follows: LogFormat "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\"" \"%{cookie}n\"" Naturally it would be nice for mod_log_sql to permit the admin to log the cookie data as well, so as of version 1.10 you can do this. You need to have already compiled mod_usertrack into httpd -- it's one of the standard Apache modules. First make sure you have a column called "cookie" in the MySQL database to hold the cookies, which can be done as follows if you already have a working database: mysql> alter table acc_log_tbl add column cookie varchar(255); Next configure your server to set usertracking cookies as follows, and make sure you include the new 'c' directive in your LogSQLTransferLogFormat, which activates cookie logging. Here's an example: <VirtualHost 1.2.3.4>
CookieTracking on
CookieStyle Cookie
CookieName Foobar
LogSQLTransferLogFormat huSUsbTvRAc
LogSQLWhichCookie Foobar
</VirtualHost> The first three lines configure mod_usertrack to create a COOKIE (RFC 2109) format cookie called Foobar. The last two lines tell mod_log_sql to log cookies named Foobar. You have to choose which cookie to log because more than one cookie can/will be sent to the server by the client. Recap: the 'c' character activates cookie logging, and the LogSQLWhichCookie directive chooses which cookie to log. FYI, you are advised NOT to use CookieStyle Cookie2 -- it seems that even newer browsers (IE 5.5, etc.) have trouble with the new COOKIE2 (RFC 2965) format. Just stick with the standard COOKIE format and you'll be fine. Perform some hits on your server and run a select mysql> select request_uri,cookie from access_log where cookie is not null; Table 10. request_uri | cookie |
---|
/mod_log_sql/ | ool-18e4.dyn.optonline.net.130051007102700823 | /mod_log_sql/usa.gif | ool-18e4.dyn.optonline.net.130051007102700823 | /mod_log_sql/style_1.css | ool-18e4.dyn.optonline.net.130051007102700823 |
|
4.3. | What if I want to log more than one cookie? What is the difference between LogSQLWhichCookie and LogSQLWhichCookies? |
| As of version 1.17, you have a choice in how you want cookie logging handled. If you are interested in logging only one cookie per request, follow the instructions in FAQ entry Q: 4.2. above. That cookie will be logged to a column in the regular access_log table, and the actual cookie you want to log is specified with LogSQLWhichCookie. Don't forget to specify the 'c' character in LogSQLTransferLogFormat. If, however, you need to log multiple cookies per request, you must employ the LogSQLWhichCookies (note the plural) directive. The cookies you specify will be logged to a separate table (as discussed in section Logging many-to-one data in separate tables), and entries in that table will be linked to the regular access_log entries via the unique ID that is supplied by mod_unique_id. Without mod_unique_id the information will still be logged but you will be unable to correlate which cookies go with which access-requests. Furthermore, with LogSQLWhichCookies, you do not need to include the 'c' character in LogSQLTransferLogFormat. LogSQLWhichCookie and LogSQLWhichCookies can coexist without conflict because they operate on entireley different tables, but you're better off choosing the one you need. |
4.4. | What are the SSL logging features, and how do I activate them? |
| NoteYou do not need to compile SSL support into mod_log_sql in order to simply use it with a secure site. You only need to compile SSL support into mod_log_sql if you want to log SSL-specific data such as the cipher type used, or the keysize that was negotiated. If that information is unimportant to you, you can ignore this FAQ. By adding certain characters to your LogSQLTransferLogFormat string you can tell mod_log_sql to log the SSL cipher, the SSL keysize of the connection, and the maximum keysize that was available. This would let you tell, for example, which clients were using only export-grade security to access your secure software area. You can compile mod_log_sql with SSL logging support if you have the right packages installed. If you already have an SSL-enabled Apache then you by definition have the correct packages already installed: OpenSSL and mod_ssl. You need to ensure that your database is set up to log the SSL data. Issue the following commands to MySQL if your access table does not already have them: mysql> alter table access_log add column ssl_cipher varchar(25);
mysql> alter table access_log add column ssl_keysize smallint unsigned;
mysql> alter table access_log add column ssl_maxkeysize smallint unsigned; Finally configure httpd.conf to activate the SSL fields. Note that this is only meaningful in a VirtualHost that is set up for SSL. <VirtualHost 1.2.3.4:443>
LogSQLTransferLogFormat AbHhmRSsTUuvcQqz
</VirtualHost> You also need to make sure you have the mod_log_sql_ssl module loaded as well. The last three characters (Qqz) in the directive are the SSL ones; see section LogSQLTransferLogFormat in the directives documentation for details of the LogSQLTransferLogFormat directive. Restart Apache, then perform some hits on your server. Then run the following select statement: mysql> select remote_host,request_uri,ssl_cipher,ssl_keysize,ssl_maxkeysize from access_log where ssl_cipher is not null; Table 11. remote_host | request_uri | ssl_cipher | ssl_keysize | ssl_maxkeysize |
---|
216.192.52.4 | /dir/somefile.html | RC4-MD5 | 128 | 128 | 216.192.52.4 | /dir/somefile.gif | RC4-MD5 | 128 | 128 | 216.192.52.4 | /dir/somefile.jpg | RC4-MD5 | 128 | 128 |
|
mod_log_sql-1.100/contrib/ 0000755 0001750 0001750 00000000000 10171050565 015414 5 ustar zigo zigo 0000000 0000000 mod_log_sql-1.100/contrib/Makefile.in 0000644 0001750 0001750 00000003273 10171046152 017463 0 ustar zigo zigo 0000000 0000000 # @configure_input@
# Modify these top variables.
SUBDIRS =
EXTRA_DIST = README \
create_tables.sql \
make_combined_log.pl \
mysql_import_combined_log.pl
#Don't modify anything below here
srcdir = @abs_srcdir@
builddir = @abs_builddir@
STD_DIST = Makefile.in
DISTFILES = $(STD_DIST) $(EXTRA_DIST)
all: all-subdirs
all-subdirs install-subdirs update-subdirs clean-subdirs distclean-subdirs:
@otarget=`echo $@|sed s/-subdirs//`; \
list=' $(SUBDIRS)'; \
for i in $$list; do \
if test -d "$$i"; then \
target="$$otarget"; \
echo "Making $$target in $$i"; \
if test "$$i" = "."; then \
made_local=yes; \
target="local-$$target"; \
fi; \
(cd $$i && $(MAKE) $$target) || exit 1; \
fi; \
done; \
include:
rm -rf include
ln -s @APACHE_INCDIR@ include
install: install-subdirs
update: update-subdirs
clean: clean-subdirs
distclean: clean distclean-subdirs
$(RM) Makefile
DESTDIR = @PACKAGE_NAME@-@PACKAGE_VERSION@
DESTTGZ = $(DESTDIR).tar.gz
dist:
@rm -rf $(DESTDIR); \
list=' $(SUBDIRS)'; \
for i in $$list; do \
if test -d "$$i"; then \
target=local-dist; \
echo "Making $$target in $$i"; \
if test "$$i" = "."; then \
made_local=yes; \
target="local-dist"; \
fi; \
NEWDESTDIR=$(builddir)/$(DESTDIR)/$$i; \
echo $(NEWDESTDIR); \
(cd $$i && $(MAKE) DESTDIR=$(builddir)/$(DESTDIR)/$$i $$target) || exit 1; \
fi; \
done;
if test "$$made_local" != "yes"; then \
$(MAKE) "local-dist" || exit 1; \
fi
tar -zcf $(DESTTGZ) $(DESTDIR)
rm -rf $(DESTDIR)
local-dist: $(DISTFILES)
mkdir -p $(DESTDIR)
cp -dp --parents $(DISTFILES) $(DESTDIR)
.PHONY: include all-subdirs update-subdirs install-subdirs \
clean-subdirs distclean-subdirs dist
mod_log_sql-1.100/contrib/README 0000644 0001750 0001750 00000002612 10171046153 016273 0 ustar zigo zigo 0000000 0000000 This directory contains contributed scripts/programs/utilites for mod_log_sql.
* create_tables.sql
This is the create table SQL commands to create the access, headers_in,
headers_out, cookies, and notes tables in the MySQL database.
Use it like this.
mysql -u user -h host -p apachelogdatabase < create_tables.sql
Where:
user is the username to log in as,
host is the hostname the server is on,
apachelogdatabase is the database to put the tables into
-p will have mysql ask you for a password for the user
*make_combined_log.pl
This perl script will extract the data from mod_log_sql's tables in the
database and export a standard Apache combined log file. Use this to run
logs through a program like webalizer.
You must edit the perl script to configure variables before you run it.
Usage:
./make_combined_log.pl days virtualhost
Where:
days is the number of days to fetch (starting from now and going back
in time)
virtualhost is the name of the virtualhost to retrieve
Example:
./make_combined_log.pl 2 example.com
*mysql_import_combined_log.pl
This is a perl script written by Aaron Jenson that imports a combined log file
from apache into a SQL database table.. You can use this script to import logs
from a webserver you are converting over from the standard Apache log system to
mod_log_sql. A Usage statement can be fetch by running the program with no
parameters or with --help or -?.
mod_log_sql-1.100/contrib/create_tables.sql 0000644 0001750 0001750 00000002054 10171046153 020731 0 ustar zigo zigo 0000000 0000000 create table access_log (
id char(19) ,
agent varchar(255) ,
bytes_sent int unsigned ,
child_pid smallint unsigned,
cookie varchar(255),
machine_id varchar(25),
request_file varchar(255),
referer varchar(255) ,
remote_host varchar(50) ,
remote_logname varchar(50) ,
remote_user varchar(50) ,
request_duration smallint unsigned ,
request_line varchar(255),
request_method varchar(10) ,
request_protocol varchar(10) ,
request_time char(28),
request_uri varchar(255),
request_args varchar(255),
server_port smallint unsigned,
ssl_cipher varchar(25),
ssl_keysize smallint unsigned,
ssl_maxkeysize smallint unsigned,
status smallint unsigned ,
time_stamp int unsigned ,
virtual_host varchar(255)
);
create table notes (
id char(19),
item varchar(80),
val varchar(80)
);
create table headers_in (
id char(19),
item varchar(80),
val varchar(80)
);
create table headers_out (
id char(19),
item varchar(80),
val varchar(80)
);
create table cookies (
id char(19),
item varchar(80),
val varchar(80)
);
mod_log_sql-1.100/contrib/make_combined_log.pl 0000644 0001750 0001750 00000010441 10171046152 021364 0 ustar zigo zigo 0000000 0000000 #!/usr/bin/perl
# $Id: make_combined_log.pl,v 1.2 2004/02/12 23:32:55 urkle Exp $
#
# make_combined_log.pl
#
# Usage: make_combined_log
#
# This perl script extracts the httpd access data from a MySQL database
# and formats it properly for parsing by 3rd-party log analysis tools.
#
# The script is intended to be run out by cron. Its commandline arguments tell
# it how many days' worth of access records to extract, and which virtual_host
# you are interested in (because many people log several virthosts to one MySQL
# db.) This permits you to run it daily, weekly, every 9 days -- whatever you
# decide.
#
# Note: By "days" I mean "chunks of 24 hours prior to the moment this script is
# run." So if you run it at 4:34 p.m. on the 12th, it will go back through 4:34
# p.m. on the 11th.
#
# Known issues:
# * Because GET and POST are not discriminated in the MySQL log, we'll just
# assume that all requests are GETs. This should have negligible effect
# on any analysis software. This could be remedied IF you stored the full
# HTTP request in your database instead of just the URI, but that's going to
# cost you a LOT of space really quickly...
#
# * Because this is somewhat of a quick hack it doesn't do the most robust
# error checking in the world. Run it by hand to confirm your usage before
# putting it in crontab.
$| = 1;
use DBI;
# Remove the # in front of this line when you have
# edited the variables below.
#$has_edited_source = 1;
#
# Set up the proper variables to permit database access
#
$serverName = "your.dbhost.com";
$serverPort = "3306";
$serverUser = "someuser";
$serverPass = "somepass";
$serverTbl = "acc_log_tbl";
$serverDb = "apache";
if (!defined($has_edited_source)) {
print "Please edit this file and configure it first.\n";
print "This program is $0\n";
exit 1;
}
# Remember, $#ARGV is parameters minus one...
if ($#ARGV != 1) {
print "Usage $0 days virtualhost\n";
exit 1;
}
$days = $ARGV[0];
$virthost = $ARGV[1];
#
# Other constants
#
$st_tz = "-0800";
$dt_tz = "-0700";
$now = time();
$start = $now - (86400 * $days);
#
# Connect and fetch the records
#
$dbh = DBI->connect("DBI:mysql:database=$serverDb;host=$serverName;port=$serverPort",$serverUser,$serverPass);
if (not $dbh) {
die "Unable to connect to the database. Please check your connection variables. (Bad password? Incorrect perms?)";
}
$records = $dbh->prepare("select remote_host,remote_user,request_uri,time_stamp,status,bytes_sent,referer,agent,request_method,request_protocol from `$serverTbl` where virtual_host='$virthost' and time_stamp >= $start order by time_stamp");
$records->execute;
if (not $records) {
die "No such table or the select returned no records."
}
#Right
#ariston.netcraft.com - - [14/Nov/2001:05:13:39 -0800] "GET / HTTP/1.0" 200 502 "-" "Mozilla/4.08 [en] (Win98; I)"
#ariston.netcraft.com - - [14/Nov/2001:05:13:39 -0800] "GET / HTTP/1.0" 200 502 "-" "Mozilla/4.08 [en] (Win98; I)"
#Bad
#ariston.netcraft.com - - [2001-11-14 05:13:39 -0800] "GET / HTTP/1.1" 200 502 "-" "Mozilla/4.08 [en] (Win98; I)"
#ariston.netcraft.com - - [2001-11-14 05:13:39 -0800] "GET / HTTP/1.1" 200 502 "-" "Mozilla/4.08 [en] (Win98; I)"
#
# Pull out the data row by row and format it
#
while (@data = $records->fetchrow_array) {
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($data[3]);
$year=$year+1900;
# Create format for leading-zero formatting
if ($mday < 10) { $mday = "0$mday"; }
if ($mon < 10) { $mon = "0$mon"; }
if ($hour < 10) { $hour = "0$hour"; }
if ($min < 10) { $min = "0$min"; }
if ($sec < 10) { $sec = "0$sec"; }
# Convert numeric month to string month
for ($mon) {
if (/00/) { $mon = "Jan";}
elsif (/01/) { $mon = "Feb";}
elsif (/02/) { $mon = "Mar";}
elsif (/03/) { $mon = "Apr";}
elsif (/04/) { $mon = "May";}
elsif (/05/) { $mon = "Jun";}
elsif (/06/) { $mon = "Jul";}
elsif (/07/) { $mon = "Aug";}
elsif (/08/) { $mon = "Sep";}
elsif (/09/) { $mon = "Oct";}
elsif (/10/) { $mon = "Nov";}
elsif (/11/) { $mon = "Dec";}
}
# Create the output
print "$data[0] $data[1] - [$mday/$mon/$year:$hour:$min:$sec ";
if ($isdst) {
print "$dt_tz\] ";
} else {
print "$st_tz\] ";
}
print "\"$data[8] $data[2] $data[9]\" $data[4] $data[5] \"$data[6]\" \"$data[7]\"\n";
}
#
# Done
#
$records->finish;
mod_log_sql-1.100/contrib/mysql_import_combined_log.pl 0000644 0001750 0001750 00000012531 10171046152 023210 0 ustar zigo zigo 0000000 0000000 #!/usr/bin/perl -w
# $Id: mysql_import_combined_log.pl,v 1.4 2004/02/21 18:09:50 urkle Exp $
# Written by Aaron Jenson.
# Original source: http://www.visualprose.com/software.php
# Updated to work under Perl 5.6.1 by Edward Rudd
use strict;
use Getopt::Long qw(:config bundling);
use DBI;
use Date::Parse;
my %options = ();
my $i = 0;
my $sql = '';
my $valuesSql = '';
my $line = '';
my $dbh = 0;
my $sth = 0;
my @parts = ();
my $part;
my $TIMESTAMP = 3;
my $REQUEST_LINE = 4;
my @cols = (
'remote_host', ## 0
'remote_logname', ## 1
'remote_user', ## 2
'request_time', ## 3.string
'time_stamp', ## 3.posix
'request_line', ## 5
'request_method', ## 6
'request_uri', ## 7
'request_args', ## 8
'request_protocol', ## 9
'status', ## 10
'bytes_sent', ## 11
'referer', ## 12
'agent' ## 13
);
my $col = '';
GetOptions (\%options,
"version" => sub { VERSION_MESSAGE(); exit 0; },
"help|?" => sub { HELP_MESSAGE(); exit 0; },
"host|h=s",
"database|d=s",
"table|t=s",
"username|u=s",
"password|p=s",
"logfile|f=s");
$options{host} ||= 'localhost';
$options{database} ||= '';
$options{username} ||= '';
$options{password} ||= '';
$options{logfile} ||= '';
if( ! $options{database} )
{
HELP_MESSAGE();
print "Must supply a database to connect to.\n";
exit 1;
}
if( ! $options{table} )
{
HELP_MESSAGE();
print "Must supply table name.\n";
exit 1;
}
if( $options{logfile} )
{
if( ! -e $options{logfile} )
{
print "File '$options{logfile}' doesn't exist.\n";
exit 1;
}
open(STDIN, "<$options{logfile}") || die "Can't open $options{logfile} for reading.";
}
$dbh = Connect();
if (! $dbh) {
exit 1;
}
$sql = "INSERT INTO $options{table} (";
foreach $col (@cols)
{
$sql .= "$col," if( $col );
}
chop($sql);
$sql .= ') VALUES (';
my ($linecount,$insertcount) = (0,0);
while($line = )
{
$linecount++;
@parts = SplitLogLine( $line );
next if( $parts[$TIMESTAMP+1] == 0 );
$valuesSql = '';
for( $i = 0; $i < @cols; ++$i )
{
$parts[$i] =~ s/\\/\\\\/g;
$parts[$i] =~ s/'/\\'/g;
$valuesSql .= "'$parts[$i]'," if( $cols[$i] );
}
chop($valuesSql);
$sth = $dbh->prepare("$sql$valuesSql)");
if( ! $sth->execute() )
{
print "Unable to perform specified query.\n$sql$valuesSql\n" . $sth->errstr() . "\n";
} else {
$insertcount++;
}
$sth->finish();
}
print "Parsed $linecount Log lines\n";
print "Inserted $insertcount records\n";
print "to table '$options{table}' in database '$options{database}' on '$options{host}'\n";
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Connects to a MySQL database and returns the connection.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub Connect
{
my $dsn = "DBI:mysql:$options{database};hostname=$options{host}";
return DBI->connect( $dsn, $options{username}, $options{password} );
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Splits up a log line into its parts.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub SplitLogLine
{
my $line = shift;
my $i = 0;
my $inQuote = 0;
my $char = '';
my $part = '';
my @parts = ();
my $count = 0;
chomp($line);
for( $i = 0; $i < length($line); ++$i )
{
$char = substr($line, $i, 1);
if( $char eq ' ' && ! $inQuote )
{
## print "Found part $part.\n";
if( $count == $TIMESTAMP )
{
push(@parts, "[".$part."]");
$part = str2time($part);
}
push(@parts, $part);
if( $count == $REQUEST_LINE )
{
my @request = split(/[ ?]/, $part);
push(@parts, $request[0]);
push(@parts, $request[1]);
if( $request[3] )
{
push(@parts, $request[2]);
push(@parts, $request[3]);
}
else
{
push(@parts, '');
push(@parts, $request[2]);
}
$count += 5;
}
else
{
++$count;
}
$part = '';
}
elsif( $char eq '"' || $char eq '[' || $char eq ']' )
{
$inQuote = !$inQuote;
}
else
{
$part .= $char;
}
}
push(@parts,$part) if $part;
return @parts;
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Prints the usage/help message for this program.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub HELP_MESSAGE
{
print< -t [-h ] [-u ] [-p ] [-f The host to connect to. Default is localhost.
--database|-d The database to use. Required.
--username|-u The user to connect as.
--password|-p The user's password.
--table|-t The name of the table in which to insert data.
--logfile|-f The file to read from. If not given, data is read from stdin.
--help|-? Print out this help message.
--version Print out the version of this software.
EOF
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Prints the version information for this program
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub VERSION_MESSAGE
{
print "mysql_import_combined_log.pl version 1.2\n";
print "Version 1.0 Written by Aaron Jenson.\n";
print "Update to work with perl 5.6.1 by Edward Rudd\n";
}
1;
mod_log_sql-1.100/install-sh 0000755 0001750 0001750 00000012736 10171046153 015767 0 ustar zigo zigo 0000000 0000000 #!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0
mod_log_sql-1.100/config.sub 0000755 0001750 0001750 00000067005 10171046152 015744 0 ustar zigo zigo 0000000 0000000 #! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
timestamp='2001-08-13'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Please send patches to .
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS
$0 [OPTION] ALIAS
Canonicalize a configuration name.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to ."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit 0 ;;
--version | -v )
echo "$version" ; exit 0 ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help"
exit 1 ;;
*local*)
# First pass through any local machine types.
echo $1
exit 0;;
* )
break ;;
esac
done
case $# in
0) echo "$me: missing argument$help" >&2
exit 1;;
1) ;;
*) echo "$me: too many arguments$help" >&2
exit 1;;
esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis)
os=
basic_machine=$1
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
;;
-scout)
;;
-wrs)
os=-vxworks
basic_machine=$1
;;
-chorusos*)
os=-chorusos
basic_machine=$1
;;
-chorusrdb)
os=-chorusrdb
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-udk*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*)
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
-psos*)
os=-psos
;;
-mint | -mint[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| c4x | clipper \
| d10v | d30v | dsp16xx \
| fr30 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| m32r | m68000 | m68k | m88k | mcore \
| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
| mips64vr4100 | mips64vr4100el | mips64vr4300 \
| mips64vr4300el | mips64vr5000 | mips64vr5000el \
| mipsbe | mipsel | mipsle | mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| ns16k | ns32k \
| openrisc \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| s390 | s390x \
| sh | sh[34] | sh[34]eb | shbe | shle \
| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic80 | tron \
| v850 \
| we32k \
| x86 | xscale \
| z8k)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
os=-none
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alphapca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armv*-* \
| bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c54x-* \
| clipper-* | cray2-* | cydra-* \
| d10v-* | d30v-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| m32r-* \
| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipsel-* \
| mipsle-* | mipstx39-* | mipstx39el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| s390-* | s390x-* \
| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \
| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
| v850-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \
| ymp-* \
| z8k-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
basic_machine=i386-unknown
os=-bsd
;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
a29khif)
basic_machine=a29k-amd
os=-udi
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-unknown
;;
amigaos | amigados)
basic_machine=m68k-unknown
os=-amigaos
;;
amigaunix | amix)
basic_machine=m68k-unknown
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
os=-bsd
;;
aux)
basic_machine=m68k-apple
os=-aux
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | ymp)
basic_machine=ymp-cray
os=-unicos
;;
cray2)
basic_machine=cray2-cray
os=-unicos
;;
[cjt]90)
basic_machine=${basic_machine}-cray
os=-unicos
;;
crds | unos)
basic_machine=m68k-crds
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
;;
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;;
encore | umax | mmax)
basic_machine=ns32k-encore
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
os=-ose
;;
fx2800)
basic_machine=i860-alliant
;;
genix)
basic_machine=ns32k-ns
;;
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
go32)
basic_machine=i386-pc
os=-go32
;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
h8300xray)
basic_machine=h8300-hitachi
os=-xray
;;
h8500hms)
basic_machine=h8500-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k6[0-9][0-9] | hp6[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k7[0-79][0-9] | hp7[0-79][0-9])
basic_machine=hppa1.1-hp
;;
hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][13679] | hp8[0-9][13679])
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
hppaosf)
basic_machine=hppa1.1-hp
os=-osf
;;
hppro)
basic_machine=hppa1.1-hp
os=-proelf
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i*86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i*86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i*86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
i386mach)
basic_machine=i386-mach
os=-mach
;;
i386-vsta | vsta)
basic_machine=i386-unknown
os=-vsta
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
-irix*)
;;
*)
os=-irix4
;;
esac
;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
mingw32)
basic_machine=i386-pc
os=-mingw32
;;
miniframe)
basic_machine=m68000-convergent
;;
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
mipsel*-linux*)
basic_machine=mipsel-unknown
os=-linux-gnu
;;
mips*-linux*)
basic_machine=mips-unknown
os=-linux-gnu
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
mmix*)
basic_machine=mmix-knuth
os=-mmixware
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
;;
msdos)
basic_machine=i386-pc
os=-msdos
;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
netbsd386)
basic_machine=i386-unknown
os=-netbsd
;;
netwinder)
basic_machine=armv4l-rebel
os=-linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;;
news-3600 | risc-news)
basic_machine=mips-sony
os=-newsos
;;
necv70)
basic_machine=v70-nec
os=-sysv
;;
next | m*-next )
basic_machine=m68k-next
case $os in
-nextstep* )
;;
-ns2*)
os=-nextstep2
;;
*)
os=-nextstep3
;;
esac
;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
mon960)
basic_machine=i960-intel
os=-mon960
;;
nonstopux)
basic_machine=mips-compaq
os=-nonstopux
;;
np1)
basic_machine=np1-gould
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
;;
os68k)
basic_machine=m68k-none
os=-os68k
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
paragon)
basic_machine=i860-intel
os=-osf
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium | p5 | k5 | k6 | nexgen)
basic_machine=i586-pc
;;
pentiumpro | p6 | 6x86 | athlon)
basic_machine=i686-pc
;;
pentiumii | pentium2)
basic_machine=i686-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
power) basic_machine=power-ibm
;;
ppc) basic_machine=powerpc-unknown
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
pw32)
basic_machine=i586-unknown
os=-pw32
;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
sa29200)
basic_machine=a29k-amd
os=-udi
;;
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sparclite-wrs)
basic_machine=sparclite-wrs
os=-vxworks
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
;;
spur)
basic_machine=spur-unknown
;;
st2000)
basic_machine=m68k-tandem
;;
stratus)
basic_machine=i860-stratus
os=-sysv4
;;
sun2)
basic_machine=m68000-sun
;;
sun2os3)
basic_machine=m68000-sun
os=-sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=-sunos4
;;
sun3os3)
basic_machine=m68k-sun
os=-sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=-sunos4
;;
sun4os3)
basic_machine=sparc-sun
os=-sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=-sunos4
;;
sun4sol2)
basic_machine=sparc-sun
os=-solaris2
;;
sun3 | sun3-*)
basic_machine=m68k-sun
;;
sun4)
basic_machine=sparc-sun
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
sv1)
basic_machine=sv1-cray
os=-unicos
;;
symmetry)
basic_machine=i386-sequent
os=-dynix
;;
t3e)
basic_machine=t3e-cray
os=-unicos
;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
;;
tx39)
basic_machine=mipstx39-unknown
;;
tx39el)
basic_machine=mipstx39el-unknown
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
udi29k)
basic_machine=a29k-amd
os=-udi
;;
ultra3)
basic_machine=a29k-nyu
os=-sym1
;;
v810 | necv810)
basic_machine=v810-nec
os=-none
;;
vaxv)
basic_machine=vax-dec
os=-sysv
;;
vms)
basic_machine=vax-dec
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=-vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
os=-vxworks
;;
w65*)
basic_machine=w65-wdc
os=-none
;;
w89k-*)
basic_machine=hppa1.1-winbond
os=-proelf
;;
windows32)
basic_machine=i386-pc
os=-windows32-msvcrt
;;
xmp)
basic_machine=xmp-cray
os=-unicos
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
z8k-*-coff)
basic_machine=z8k-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
;;
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
w89k)
basic_machine=hppa1.1-winbond
;;
op50n)
basic_machine=hppa1.1-oki
;;
op60c)
basic_machine=hppa1.1-oki
;;
mips)
if [ x$os = x-linux-gnu ]; then
basic_machine=mips-unknown
else
basic_machine=mips-mips
fi
;;
romp)
basic_machine=romp-ibm
;;
rs6000)
basic_machine=rs6000-ibm
;;
vax)
basic_machine=vax-dec
;;
pdp10)
# there are many clones, so DEC is not a safe bet
basic_machine=pdp10-unknown
;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
sh3 | sh4 | sh3eb | sh4eb)
basic_machine=sh-unknown
;;
sparc | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
orion)
basic_machine=orion-highlevel
;;
orion105)
basic_machine=clipper-highlevel
;;
mac | mpw | mac-mpw)
basic_machine=m68k-apple
;;
pmac | pmac-mpw)
basic_machine=powerpc-apple
;;
c4x*)
basic_machine=c4x-none
os=-coff
;;
*-unknown)
# Make sure to match an already-canonicalized machine name.
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
;;
*)
;;
esac
# Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
-solaris)
os=-solaris2
;;
-svr4*)
os=-sysv4
;;
-unixware*)
os=-sysv4.2uw
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
case $basic_machine in
x86-* | i*86-*)
;;
*)
os=-nto$os
;;
esac
;;
-nto*)
os=-nto-qnx
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
-opened*)
os=-openedition
;;
-wince*)
os=-wince
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-utek*)
os=-bsd
;;
-dynix*)
os=-bsd
;;
-acis*)
os=-aos
;;
-386bsd)
os=-bsd
;;
-ctix* | -uts*)
os=-sysv
;;
-ns2 )
os=-nextstep2
;;
-nsk*)
os=-nsk
;;
# Preserve the version number of sinix5.
-sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
;;
-sinix*)
os=-sysv4
;;
-triton*)
os=-sysv3
;;
-oss*)
os=-sysv3
;;
-svr4)
os=-sysv4
;;
-svr3)
os=-sysv3
;;
-sysvr4)
os=-sysv4
;;
# This must come after -sysvr4.
-sysv*)
;;
-ose*)
os=-ose
;;
-es1800*)
os=-ose
;;
-xenix)
os=-xenix
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1
;;
esac
else
# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.
# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system. Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
case $basic_machine in
*-acorn)
os=-riscix1.2
;;
arm*-rebel)
os=-linux
;;
arm*-semi)
os=-aout
;;
pdp10-*)
os=-tops20
;;
pdp11-*)
os=-none
;;
*-dec | vax-*)
os=-ultrix4.2
;;
m68*-apollo)
os=-domain
;;
i386-sun)
os=-sunos4.0.2
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
m68*-cisco)
os=-aout
;;
mips*-cisco)
os=-elf
;;
mips*-*)
os=-elf
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
*-be)
os=-beos
;;
*-ibm)
os=-aix
;;
*-wec)
os=-proelf
;;
*-winbond)
os=-proelf
;;
*-oki)
os=-proelf
;;
*-hp)
os=-hpux
;;
*-hitachi)
os=-hiux
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv
;;
*-cbm)
os=-amigaos
;;
*-dg)
os=-dgux
;;
*-dolphin)
os=-sysv3
;;
m68k-ccur)
os=-rtu
;;
m88k-omron*)
os=-luna
;;
*-next )
os=-nextstep
;;
*-sequent)
os=-ptx
;;
*-crds)
os=-unos
;;
*-ns)
os=-genix
;;
i370-*)
os=-mvs
;;
*-next)
os=-nextstep3
;;
*-gould)
os=-sysv
;;
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
os=-irix
;;
*-siemens)
os=-sysv4
;;
*-masscomp)
os=-rtu
;;
f30[01]-fujitsu | f700-fujitsu)
os=-uxpv
;;
*-rom68k)
os=-coff
;;
*-*bug)
os=-coff
;;
*-apple)
os=-macos
;;
*-atari*)
os=-mint
;;
*)
os=-none
;;
esac
fi
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
*-unknown)
case $os in
-riscix*)
vendor=acorn
;;
-sunos*)
vendor=sun
;;
-aix*)
vendor=ibm
;;
-beos*)
vendor=be
;;
-hpux*)
vendor=hp
;;
-mpeix*)
vendor=hp
;;
-hiux*)
vendor=hitachi
;;
-unos*)
vendor=crds
;;
-dgux*)
vendor=dg
;;
-luna*)
vendor=omron
;;
-genix*)
vendor=ns
;;
-mvs* | -opened*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-vxsim* | -vxworks*)
vendor=wrs
;;
-aux*)
vendor=apple
;;
-hms*)
vendor=hitachi
;;
-mpw* | -macos*)
vendor=apple
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
vendor=atari
;;
-vos*)
vendor=stratus
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
mod_log_sql-1.100/config.guess 0000755 0001750 0001750 00000113020 10171046152 016266 0 ustar zigo zigo 0000000 0000000 #! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
timestamp='2001-08-21'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Written by Per Bothner .
# Please send patches to .
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit build system type.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to ."
version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit 0 ;;
--version | -v )
echo "$version" ; exit 0 ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help" >&2
exit 1 ;;
* )
break ;;
esac
done
if test $# != 0; then
echo "$me: too many arguments$help" >&2
exit 1
fi
dummy=dummy-$$
trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int dummy(){}" > $dummy.c ;
for c in cc gcc c89 ; do
($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
if test $? = 0 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
rm -f $dummy.c $dummy.o $dummy.rel ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# Netbsd (nbsd) targets should (where applicable) match one or
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the
# object file format.
# Determine the machine/vendor (is the vendor relevant).
case "${UNAME_MACHINE}" in
amiga) machine=m68k-unknown ;;
arm32) machine=arm-unknown ;;
atari*) machine=m68k-atari ;;
sun3*) machine=m68k-sun ;;
mac68k) machine=m68k-apple ;;
macppc) machine=powerpc-apple ;;
hp3[0-9][05]) machine=m68k-hp ;;
ibmrt|romp-ibm) machine=romp-ibm ;;
*) machine=${UNAME_MACHINE}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE}" in
i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep __ELF__ >/dev/null
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
os=netbsd
else
os=netbsdelf
fi
;;
*)
os=netbsd
;;
esac
# The OS release
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit 0 ;;
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
fi
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
cat <$dummy.s
.data
\$Lformat:
.byte 37,100,45,37,120,10,0 # "%d-%x\n"
.text
.globl main
.align 4
.ent main
main:
.frame \$30,16,\$26,0
ldgp \$29,0(\$27)
.prologue 1
.long 0x47e03d80 # implver \$0
lda \$2,-1
.long 0x47e20c21 # amask \$2,\$1
lda \$16,\$Lformat
mov \$0,\$17
not \$1,\$18
jsr \$26,printf
ldgp \$29,0(\$26)
mov 0,\$16
jsr \$26,exit
.end main
EOF
eval $set_cc_for_build
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
case `./$dummy` in
0-0)
UNAME_MACHINE="alpha"
;;
1-0)
UNAME_MACHINE="alphaev5"
;;
1-1)
UNAME_MACHINE="alphaev56"
;;
1-101)
UNAME_MACHINE="alphapca56"
;;
2-303)
UNAME_MACHINE="alphaev6"
;;
2-307)
UNAME_MACHINE="alphaev67"
;;
2-1307)
UNAME_MACHINE="alphaev68"
;;
esac
fi
rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
exit 0;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit 0 ;;
arc64:OpenBSD:*:*)
echo mips64el-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hkmips:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit 0;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
;;
sun4)
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
exit 0 ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
sparc*:NetBSD:*)
echo `uname -p`-unknown-netbsd${UNAME_RELEASE}
exit 0 ;;
atari*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit 0 ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit 0 ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
sun3*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
#include /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
eval $set_cc_for_build
$CC_FOR_BUILD $dummy.c -o $dummy \
&& ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
[ ${TARGET_BINARY_INTERFACE}x = x ]
then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit 0 ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit 0 ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit 0 ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
sed 's/^ //' << EOF >$dummy.c
#include
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
eval $set_cc_for_build
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
*:AIX:*:[45])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit 0 ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit 0 ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
case "${HPUX_REV}" in
11.[0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
esac ;;
esac
fi ;;
esac
if [ "${HP_ARCH}" = "" ]; then
sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include
#include
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
eval $set_cc_for_build
(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
rm -f $dummy.c $dummy
fi ;;
esac
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ia64-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >$dummy.c
#include
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
eval $set_cc_for_build
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
hppa*:OpenBSD:*:*)
echo hppa-unknown-openbsd
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit 0 ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit 0 ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
CRAY*X-MP:*:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3D:*:*:*)
echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit 0 ;;
i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit 0 ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i386-pc-interix
exit 0 ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit 0 ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux
exit 0 ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
mips:Linux:*:*)
case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
big) echo mips-unknown-linux-gnu && exit 0 ;;
little) echo mipsel-unknown-linux-gnu && exit 0 ;;
esac
;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit 0 ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit 0 ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit 0 ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-gnu ;;
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
esac
exit 0 ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
exit 0 ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit 0 ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
exit 0 ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
ld_supported_targets=`cd /; ld --help 2>&1 \
| sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g
s/.*supported targets: *//
s/ .*//
p'`
case "$ld_supported_targets" in
elf32-i386)
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit 0 ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit 0 ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
exit 0 ;;
esac
# Determine whether the default compiler is a.out or elf
cat >$dummy.c <
#ifdef __cplusplus
#include /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
printf ("%s-pc-linux-gnu\n", argv[1]);
# else
printf ("%s-pc-linux-gnulibc1\n", argv[1]);
# endif
# else
printf ("%s-pc-linux-gnulibc1\n", argv[1]);
# endif
#else
printf ("%s-pc-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
EOF
eval $set_cc_for_build
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
echo i386-sequent-sysv4
exit 0 ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit 0 ;;
i*86:*:5:[78]*)
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
exit 0 ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
exit 0 ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit 0 ;;
paragon:*:*:*)
echo i860-intel-osf1
exit 0 ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit 0 ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit 0 ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says
echo i586-unisys-sysv4
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes .
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit 0 ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit 0 ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
exit 0 ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit 0 ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
exit 0 ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit 0 ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit 0 ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit 0 ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Darwin:*:*)
echo `uname -p`-apple-darwin${UNAME_RELEASE}
exit 0 ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
if test "${UNAME_MACHINE}" = "x86pc"; then
UNAME_MACHINE=pc
fi
echo `uname -p`-${UNAME_MACHINE}-nto-qnx
exit 0 ;;
*:QNX:*:4*)
echo i386-pc-qnx
exit 0 ;;
NSR-[KW]:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit 0 ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
exit 0 ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
exit 0 ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "$cputype" = "386"; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit 0 ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit 0 ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
exit 0 ;;
*:TENEX:*:*)
echo pdp10-unknown-tenex
exit 0 ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
echo pdp10-dec-tops20
exit 0 ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
echo pdp10-xkl-tops20
exit 0 ;;
*:TOPS-20:*:*)
echo pdp10-unknown-tops20
exit 0 ;;
*:ITS:*:*)
echo pdp10-unknown-its
exit 0 ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
cat >$dummy.c <
# include
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
eval $set_cc_for_build
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit 0 ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
c34*)
echo c34-convex-bsd
exit 0 ;;
c38*)
echo c38-convex-bsd
exit 0 ;;
c4*)
echo c4-convex-bsd
exit 0 ;;
esac
fi
cat >&2 < in order to provide the needed
information to handle your system.
config.guess timestamp = $timestamp
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
hostinfo = `(hostinfo) 2>/dev/null`
/bin/universe = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF
exit 1
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
mod_log_sql-1.100/aclocal.m4 0000644 0001750 0001750 00000034251 10171050466 015621 0 ustar zigo zigo 0000000 0000000 # generated automatically by aclocal 1.7.8 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
dnl m4 for utility macros used by all out of order projects
dnl this writes a "config.nice" file which reinvokes ./configure with all
dnl of the arguments. this is different from config.status which simply
dnl regenerates the output files. config.nice is useful after you rebuild
dnl ./configure (via autoconf or autogen.sh)
AC_DEFUN(OOO_CONFIG_NICE,[
echo configure: creating $1
rm -f $1
cat >$1<> $1
fi
done
echo '"[$]@"' >> $1
chmod +x $1
])
dnl this macro adds a maintainer mode option to enable programmer specific
dnl code in makefiles
AC_DEFUN(OOO_MAINTAIN_MODE,[
AC_ARG_ENABLE(
maintainer,
[AC_HELP_STRING([--enable-maintainer],[Enable maintainer mode for this project])],
AC_MSG_RESULT([Enabling Maintainer Mode!!])
OOO_MAINTAIN=1,
OOO_MAINTAIN=0)
AC_SUBST(OOO_MAINTAIN)
])
dnl CHECK_APACHE([MINIMUM13-VERSION [, MINIMUM20-VERSION [,
dnl ACTION-IF-FOUND13 [, ACTION-IF-FOUND20 [, ACTION-IF-NOT-FOUND]]])
dnl Test for Apache apxs, APR, and APU
AC_DEFUN(CHECK_APACHE,
[dnl
AC_ARG_WITH(
apxs,
[AC_HELP_STRING([--with-apxs=PATH],[Path to apxs])],
apxs_prefix="$withval",
apxs_prefix="/usr"
)
AC_ARG_ENABLE(
apachetest,
[AC_HELP_STRING([--disable-apxstest],[Do not try to compile and run apache version test program])],
,
enable_apachetest=yes
)
if test -x $apxs_prefix -a ! -d $apxs_prefix; then
APXS_BIN=$apxs_prefix
else
test_paths="$apxs_prefix:$apxs_prefix/bin:$apxs_prefix/sbin"
test_paths="${test_paths}:/usr/bin:/usr/sbin"
test_paths="${test_paths}:/usr/local/bin:/usr/local/sbin:/usr/local/apache2/bin"
AC_PATH_PROG(APXS_BIN, apxs, no, [$test_paths])
fi
min_apache13_version=ifelse([$1], ,no,$1)
min_apache20_version=ifelse([$2], ,no,$2)
no_apxs=""
if test "$APXS_BIN" = "no"; then
AC_MSG_ERROR([*** The apxs binary installed by apache could not be found!])
AC_MSG_ERROR([*** Use the --with-apxs option with the full path to apxs])
else
AP_INCLUDES="-I`$APXS_BIN -q INCLUDEDIR 2>/dev/null`"
AP_INCLUDEDIR="`$APXS_BIN -q INCLUDEDIR 2>/dev/null`"
AP_PREFIX="`$APXS_BIN -q prefix 2>/dev/null`"
AP_BINDIR="`$APXS_BIN -q bindir 2>/dev/null`"
AP_SBINDIR="`$APXS_BIN -q sbindir 2>/dev/null`"
APXS_CFLAGS=""
for flag in CFLAGS EXTRA_CFLAGS EXTRA_CPPFLAGS NOTEST_CFLAGS; do
APXS_CFLAGS="$APXS_CFLAGS `$APXS_BIN -q $flag 2>/dev/null`"
done
AP_CPPFLAGS="$APXS_CPPFLAGS $AP_INCLUDES"
AP_CFLAGS="$APXS_CFLAGS $AP_INCLUDES"
AP_LIBEXECDIR=`$APXS_BIN -q LIBEXECDIR 2>/dev/null`
if test "x$enable_apachetest" = "xyes" ; then
if test "$min_apache20_version" != "no"; then
APR_CONFIG="`$APXS_BIN -q APR_BINDIR 2>/dev/null`/apr-1-config"
if test ! -x $APR_CONFIG; then
APR_CONFIG="`$APXS_BIN -q APR_BINDIR 2>/dev/null`/apr-config"
fi
APR_INCLUDES=`$APR_CONFIG --includes 2>/dev/null`
APR_VERSION=`$APR_CONFIG --version 2>/dev/null`
APU_CONFIG="`$APXS_BIN -q APU_BINDIR 2>/dev/null`/apu-1-config"
if test ! -x $APU_CONFIG; then
APU_CONFIG="`$APXS_BIN -q APU_BINDIR 2>/dev/null`/apu-config"
fi
APU_INCLUDES=`$APU_CONFIG --includes 2>/dev/null`
APU_VERSION=`$APU_CONFIG --version 2>/dev/null`
AC_MSG_CHECKING(for Apache 2.0 version >= $min_apache20_version)
TEST_APACHE_VERSION(20,$min_apache20_version,
AC_MSG_RESULT(yes)
AC_DEFINE(WITH_APACHE20,1,[Define to 1 if we are compiling with Apache 2.0.x])
AP_VERSION="2.0"
APXS_EXTENSION=.la
AP_CFLAGS="$AP_CFLAGS $APU_INCLUDES $APR_INCLUDES"
AP_CPPFLAGS="$AP_CPPFLAGS $APU_INCLUDES $APR_INCLUDES"
AP_DEFS="-DWITH_APACHE20"
ifelse([$4], , , $4),
AC_MSG_RESULT(no)
if test "x$min_apache13_version" = "xno"; then
ifelse([$5], , , $5)
fi
)
fi
if test "$min_apache13_version" != "no" -a "x$AP_VERSION" = "x"; then
APR_INCLUDES=""
APR_VERSION=""
APU_INCLUDES=""
APU_VERSION=""
AC_MSG_CHECKING(for Apache 1.3 version >= $min_apache13_version)
TEST_APACHE_VERSION(13,$min_apache13_version,
AC_MSG_RESULT(yes)
AC_DEFINE(WITH_APACHE13,1,[Define to 1 if we are compiling with Apache 1.3.x])
AP_VERSION="1.3"
APXS_EXTENSION=.so
AP_CFLAGS="-g $AP_CFLAGS"
AP_DEFS="-DWITH_APACHE13"
ifelse([$3], , , $3),
AC_MSG_RESULT(no)
ifelse([$5], , , $5)
)
fi
fi
AC_SUBST(AP_DEFS)
AC_SUBST(AP_PREFIX)
AC_SUBST(AP_CFLAGS)
AC_SUBST(AP_CPPFLAGS)
AC_SUBST(AP_INCLUDES)
AC_SUBST(AP_INCLUDEDIR)
AC_SUBST(AP_LIBEXECDIR)
AC_SUBST(AP_VERSION)
AC_SUBST(AP_BINDIR)
AC_SUBST(AP_SBINDIR)
AC_SUBST(APR_INCLUDES)
AC_SUBST(APU_INCLUDES)
AC_SUBST(APXS_EXTENSION)
AC_SUBST(APXS_BIN)
AC_SUBST(APXS_CFLAGS)
fi
])
dnl TEST_APACHE_VERSION(RELEASE, [MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for Apache
dnl
AC_DEFUN(TEST_APACHE_VERSION,
[dnl
AC_REQUIRE([AC_CANONICAL_TARGET])
releasetest=$1
min_apache_version="$2"
no_apache=""
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $AP_CFLAGS"
if test $releasetest -eq 20; then
CFLAGS="$CFLAGS $APU_INCLUDES $APR_INCLUDES"
fi
AC_TRY_RUN([
#include
#include
#include
#include "httpd.h"
#ifndef AP_SERVER_BASEREVISION
#define AP_SERVER_BASEREVISION SERVER_BASEREVISION
#endif
char* my_strdup (char *str)
{
char *new_str;
if (str) {
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
} else
new_str = NULL;
return new_str;
}
int main (int argc, char *argv[])
{
int major1, minor1, micro1;
int major2, minor2, micro2;
char *tmp_version;
{ FILE *fp = fopen("conf.apachetest", "a"); if ( fp ) fclose(fp); }
tmp_version = my_strdup("$min_apache_version");
if (sscanf(tmp_version, "%d.%d.%d", &major1, &minor1, µ1) != 3) {
printf("%s, bad version string\n", "$min_apache_version");
exit(1);
}
tmp_version = my_strdup(AP_SERVER_BASEREVISION);
if (sscanf(tmp_version, "%d.%d.%d", &major2, &minor2, µ2) != 3) {
printf("%s, bad version string\n", AP_SERVER_BASEREVISION);
exit(1);
}
if ( (major2 == major1) &&
( (minor2 > minor1) ||
((minor2 == minor1) && (micro2 >= micro1)) ) ) {
exit(0);
} else {
exit(1);
}
}
],, no_apache=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
if test "x$no_apache" = x ; then
ifelse([$3], , :, [$3])
else
if test -f conf.apachetest ; then
:
else
echo "*** Could not run Apache test program, checking why..."
CFLAGS="$CFLAGS $AP_CFLAGS"
if test $releasetest -eq 20; then
CFLAGS="$CFLAGS $APU_INCLUDES $APR_INCLUDES"
fi
AC_TRY_LINK([
#include
#include "httpd.h"
int main(int argc, char *argv[])
{ return 0; }
#undef main
#define main K_and_R_C_main
], [ return 0; ],
[ echo "*** The test program compiled, but failed to run. Check config.log" ],
[ echo "*** The test program failed to compile or link. Check config.log" ])
CFLAGS="$ac_save_CFLAGS"
fi
ifelse([$4], , :, [$4])
fi
rm -f conf.apachetest
])
dnl CHECK_PATH_MYSQL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUNT]])
dnl Check for MySQL Libs
dnl
AC_DEFUN(CHECK_MYSQL,
[dnl
AC_ARG_WITH(
mysql,
[AC_HELP_STRING([--with-mysql=PATH],[Path to MySQL client library])],
mysql_prefix="$withval",
)
AC_ARG_ENABLE(
mysqltest,
[AC_HELP_STRING([--disble-mysqltest],[Do not try to compile and run mysql test program])],
,
enable_mysqltest=yes)
AC_REQUIRE([AC_CANONICAL_TARGET])
testdirs="/usr /usr/local /usr/local /opt"
if test "x$mysql_prefix" != "x" && test "x$mysql_prefix" != "xyes"; then
testdirs="${testdirs} ${mysql_prefix}"
fi
for dir in $testdirs; do
if test -e $dir/include/mysql.h; then
MYSQL_CFLAGS=-I${dir}/include
MYSQL_LDFLAGS=-L${dir}/lib
MYSQL_LIBS="-lmysqlclient -lm -lz"
break
elif test -e $dir/include/mysql/mysql.h; then
MYSQL_CFLAGS=-I${dir}/include/mysql
MYSQL_LDFLAGS=-L${dir}/lib/mysql
MYSQL_LIBS="-lmysqlclient -lm -lz"
break
fi
done
if test -z $MYSQL_CFLAGS; then
echo "*** MySQL development files could not be found!"
fi
ac_save_CFLAGS=$CFLAGS
ac_save_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS $MYSQL_CFLAGS"
LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
AC_CHECK_LIB(m, floor)
AC_CHECK_LIB(z, gzclose)
with_mysql="yes"
AC_DEFINE(WITH_MYSQL,1,[Define to 1 if we are compiling with mysql])
AC_CHECK_LIB(mysqlclient, mysql_init, ,
[AC_MSG_ERROR(libmysqlclient is needed for MySQL support)])
AC_CHECK_FUNCS(mysql_real_escape_string)
AC_MSG_CHECKING(whether mysql clients can run)
AC_TRY_RUN([
#include
#include
int main(void)
{
MYSQL *a = mysql_init(NULL);
return 0;
}
], , no_mysql=yes,[echo $ac_n "cross compiling; assumed OK.... $ac_c"])
CFLAGS=$ac_save_CFLAGS
LDFLAGS=$ac_save_LDFLAGS
if test "x$no_mysql" = x; then
AC_MSG_RESULT(yes)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
echo "*** MySQL could not be found ***"
MYSQL_CFLAGS=""
MYSQL_LDFLAGS=""
MYSQL_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(MYSQL_LDFLAGS)
AC_SUBST(MYSQL_CFLAGS)
AC_SUBST(MYSQL_LIBS)
])
dnl Check for libdbi libraries
dnl CHECK_LIBDBI(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
AC_DEFUN(CHECK_LIBDBI,
[dnl
AC_ARG_WITH(
dbi,
[AC_HELP_STRING([--with-dbi=PATH],[Path libdbi headers and libraries])],
dbi_path="$withval",
:)
# Determine dbi include directory.
if test -z $dbi_path; then
test_paths="/usr/include /usr/local/include"
else
test_paths="${dbi_path}/include"
fi
for x in $test_paths ; do
AC_MSG_CHECKING([for dbi Includes in ${x}])
if test -f ${x}/dbi/dbi.h; then
DBI_CFLAGS="-I$x"
AC_MSG_RESULT([found it! Use --with-dbi to specify another.])
break
else
AC_MSG_RESULT(no)
fi
done
if test -z "$DBI_CFLAGS"; then
ifelse([$2], , AC_MSG_ERROR([libdbi include files not found.]), $2)
fi
# Determine libdbi lib directory
if test -z $dbi_path; then
test_paths="/usr/lib /usr/local/lib"
else
test_paths="${dbi_path}/lib"
fi
for x in $test_paths ; do
AC_MSG_CHECKING([for libdbi library in ${x}])
if test -f ${x}/libdbi.so; then
AC_MSG_RESULT([yes])
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
CFLAGS="$DBI_CFLAGS $CFLAGS"
LDFLAGS="-L$x $LDFLAGS"
AC_CHECK_LIB(dbi, dbi_version,
DBI_LDFLAGS="-L$x")
dnl // TODO: Should we check for other libs here?
CFLAGS=$save_CFLAGS
LDFLAGS=$save_LDFLAGS
break
else
AC_MSG_RESULT([no])
fi
done
if test -z "$DBI_LDFLAGS"; then
ifelse([$2], , AC_MSG_ERROR([libdbi library not found.]), $2)
else
AC_SUBST(DBI_LDFLAGS)
DBI_LIBS=-ldbi
AC_SUBST(DBI_LIBS)
AC_SUBST(DBI_CFLAGS)
ifelse([$1], , , $1)
fi
])
dnl CHECK_PATH_MOD_SSL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for mod_ssl and openssl header directory.
dnl
AC_DEFUN(CHECK_MOD_SSL,
[dnl
AC_ARG_ENABLE(
ssl,
[AC_HELP_STRING([--disable-ssl],[Do not compile in SSL support])],
ssl_val=no,
ssl_val=yes
)
AC_ARG_WITH(
ssl-inc,
[AC_HELP_STRING([--with-ssl-inc=PATH],[Location of SSL header files])],
ssl_incdir="$withval",
)
AC_ARG_WITH(
db-inc,
[AC_HELP_STRING([--with-db-inc=PATH],[Location of DB header files])],
db_incdir="$withval",
db_incdir="/usr/include/db1"
)
if test "x$ssl_val" = "xyes"; then
ac_save_CFLAGS=$CFLAGS
ac_save_CPPFLAGS=$CPPFLAGS
MOD_SSL_CFLAGS="-I/usr/include/openssl"
if test "x$ssl_incdir" != "x"; then
MOD_SSL_CFLAGS="-I$ssl_incdir -I$ssl_incdir/openssl $MOD_SSL_CFLAGS"
fi
if test "x$db_incdir" != "x"; then
MOD_SSL_CFLAGS="-I$db_incdir $MOD_SSL_CFLAGS"
fi
CFLAGS="$AP_CFLAGS $MOD_SSL_CFLAGS $CFLAGS"
CPPFLAGS="$AP_CFLAGS $MOD_SSL_CFLAGS $CPPFLAGS"
AC_CHECK_HEADERS([mod_ssl.h],
mod_ssl_h=yes
)
CFLAGS=$ac_save_CFLAGS
CPPFLAGS=$ac_save_CPPFLAGS
if test "x$mod_ssl_h" = "x"; then
ifelse([$2], , :, [$2])
else
AC_SUBST(MOD_SSL_CFLAGS)
ifelse([$1], , :, [$1])
fi
else
ifelse([$2], , :, [$2])
fi
])
mod_log_sql-1.100/Makefile.in 0000644 0001750 0001750 00000014564 10171046152 016030 0 ustar zigo zigo 0000000 0000000 # @configure_input@
# Modify these top variables.
SUBDIRS = docs contrib
HEADERS = mod_log_sql.h \
functions.h \
functions13.h \
functions20.h \
apache13.h \
apache20.h \
winconfig.h
CFLAGS = -Wc,-Wall -Wc,-fno-strict-aliasing
ifeq (@OOO_MAINTAIN@,1)
CFLAGS += -Wc,-Werror
endif
EXTRA_DIST = AUTHORS INSTALL TODO LICENSE CHANGELOG \
build-apache13.bat build-apache2.bat
coreSOURCES = @PACKAGE_NAME@.c
coreTARGET = @PACKAGE_NAME@@APXS_EXTENSION@
coreLDADD = @RT_LIBS@
coreCFLAGS =
coreNAME = log_sql
TARGETS = $(coreTARGET)
sslSOURCES = @PACKAGE_NAME@_ssl.c
sslTARGET = @PACKAGE_NAME@_ssl@APXS_EXTENSION@
sslLDADD =
sslCFLAGS = @MOD_SSL_CFLAGS@
sslNAME = log_sql_ssl
ifeq (@WANT_SSL_MOD@,1)
TARGETS += $(sslTARGET)
endif
mysqlSOURCES = @PACKAGE_NAME@_mysql.c
mysqlTARGET = @PACKAGE_NAME@_mysql@APXS_EXTENSION@
mysqlLDADD = @MYSQL_LDFLAGS@ @MYSQL_LIBS@
mysqlCFLAGS = @MYSQL_CFLAGS@
mysqlNAME = log_sql_mysql
ifeq (@WANT_MYSQL_MOD@,1)
TARGETS += $(mysqlTARGET)
endif
pgsqlSOURCES = @PACKAGE_NAME@_pgsql.c
pgsqlTARGET = @PACKAGE_NAME@_pgsql@APXS_EXTENSION@
pgsqlLDADD = @PGSQL_LDFLAGS@ @PGSQL_LIBS@
pgsqlCFLAGS = @PGSQL_CFLAGS@
pgsqlNAME = log_sql_pgsql
ifeq (@WANT_PGSQL_MOD@,1)
TARGETS += $(pgsqlTARGET)
endif
dbiSOURCES = @PACKAGE_NAME@_dbi.c
dbiTARGET = @PACKAGE_NAME@_dbi@APXS_EXTENSION@
dbiLDADD = @DBI_LDFLAGS@ @DBI_LIBS@
dbiCFLAGS = @DBI_CFLAGS@
dbiNAME = log_sql_dbi
ifeq (@WANT_DBI_MOD@,1)
TARGETS += $(dbiTARGET)
endif
#Don't modify anything below here
PROVIDERS_SUBDIRS = @subdirs@
srcdir = @abs_srcdir@
builddir = @abs_builddir@
OBJ = $(coreSOURCES:.c=.o) $(sslSOURCES:.c=.o) $(mysqlSOURCES:.c=.o) \
$(dbiSOURCES:.c=.o) $(pgsqlSOURCES:.c=.o)
LO = $(coreSOURCES:.c=.lo) $(sslSOURCES:.c=.lo) $(mysqlSOURCES:.c=.lo) \
$(dbiSOURCES:.c=.lo) $(pgsqlSOURCES:.c=.lo)
SLO = $(coreSOURCES:.c=.slo) $(sslSOURCES:.c=.slo) $(mysqlSOURCES:.c=.slo) \
$(dbiSOURCES:.c=.slo) $(pgsqlSOURCES:.c=.slo)
STD_DIST = install-sh \
config.sub \
config.guess \
aclocal.m4 \
Makefile.in \
configure.ac \
configure \
stamp-h.in \
config.h.in
DISTFILES = $(STD_DIST) $(EXTRA_DIST) $(coreSOURCES) $(HEADERS) \
$(sslSOURCES) $(mysqlSOURCES) $(pgsqlSOURCES) $(dbiSOURCES)
all: $(TARGETS) all-subdirs
all-subdirs install-subdirs activate-subdirs clean-subdirs distclean-subdirs:
@otarget=`echo $@|sed s/-subdirs//`; \
list=' $(PROVIDERS_SUBDIRS) $(SUBDIRS)'; \
for i in $$list; do \
if test -d "$$i"; then \
target="$$otarget"; \
echo "Making $$target in $$i"; \
if test "$$i" = "."; then \
made_local=yes; \
target="local-$$target"; \
fi; \
(cd $$i && $(MAKE) $$target) || exit 1; \
fi; \
done;
TODO: TODO.in
@./gen_todo.pl
$(coreTARGET): $(coreSOURCES) $(HEADERS)
@@APXS_BIN@ -c -o $(coreTARGET) $(coreCFLAGS) $(CFLAGS) \
@DEFS@ @AP_DEFS@ $(coreLDADD) $(coreSOURCES)
$(sslTARGET): $(sslSOURCES) $(HEADERS)
@@APXS_BIN@ -c -o $(sslTARGET) $(sslCFLAGS) $(CFLAGS) \
@DEFS@ @AP_DEFS@ $(sslLDADD) $(sslSOURCES)
$(mysqlTARGET): $(mysqlSOURCES) $(HEADERS)
@@APXS_BIN@ -c -o $(mysqlTARGET) $(mysqlCFLAGS) $(CFLAGS) \
@DEFS@ @AP_DEFS@ $(mysqlLDADD) $(mysqlSOURCES)
$(pgsqlTARGET): $(pgsqlSOURCES) $(HEADERS)
@@APXS_BIN@ -c -o $(pgsqlTARGET) $(pgsqlCFLAGS) $(CFLAGS) \
@DEFS@ @AP_DEFS@ $(pgsqlLDADD) $(pgsqlSOURCES)
$(dbiTARGET): $(dbiSOURCES) $(HEADERS)
@@APXS_BIN@ -c -o $(dbiTARGET) $(dbiCFLAGS) $(CFLAGS) \
@DEFS@ @AP_DEFS@ $(dbiLDADD) $(dbiSOURCES)
install: $(TARGETS) install-subdirs
@@APXS_BIN@ -n $(coreNAME) -i $(coreTARGET); \
if test @WANT_MYSQL_MOD@ -eq 1; then \
@APXS_BIN@ -n $(mysqlNAME) -i $(mysqlTARGET); \
fi; \
if test @WANT_PGSQL_MOD@ -eq 1; then \
@APXS_BIN@ -n $(pgsqlNAME) -i $(pgsqlTARGET); \
fi; \
if test @WANT_DBI_MOD@ -eq 1; then \
@APXS_BIN@ -n $(dbiNAME) -i $(dbiTARGET); \
fi; \
if test @WANT_SSL_MOD@ -eq 1; then \
@APXS_BIN@ -n $(sslNAME) -i $(sslTARGET); \
fi; \
echo "*************************************************************************"; \
echo "*** The mod_log_sql modules have been installed."; \
echo "*** Please edit your Apache configuration files and"; \
echo "*** add the appropriate LoadModule directives per the documentation"; \
echo "*** in docs/manual.html"; \
echo "*** If you have previously used 1.18 or lower then you must change"; \
echo "*** >LoadModule sql_log_module modules/mod_log_sql.so"; \
echo "*** to"; \
echo "*** >LoadModule log_sql_module modules/mod_log_sql.so"; \
echo "*** in your httpd.conf as the internal name of the module has changed."; \
echo "*** "; \
echo "*** Also read the documentation about using SSL support and new "; \
echo "*** configuration directives."; \
echo "*************************************************************************";
activate: activate-subdirs
@@APXS_BIN@ -n $(coreNAME) -i -a $(coreTARGET); \
if test @WANT_SSL_MOD@ -eq 1; then \
@APXS_BIN@ -n $(sslNAME) -i -a $(sslTARGET); \
fi
clean: clean-subdirs
$(RM) $(OBJ) $(SLO) $(LO) $(TARGETS)
$(RM) -r .libs
distclean: clean distclean-subdirs
$(RM) config.status config.log config.h config.h.in \
configure stamp-h stamp-h.in Makefile aclocal.m4
$(RM) -r autom4te-2.53.cache
DESTDIR = @PACKAGE_NAME@-@PACKAGE_VERSION@
DESTTGZ = $(DESTDIR).tar.gz
dist:
@rm -rf $(DESTDIR); \
list=' $(PROVIDERS_SUBDIRS) $(SUBDIRS)'; \
for i in $$list; do \
if test -d "$$i"; then \
target=local-dist; \
echo "Making $$target in $$i"; \
if test "$$i" = "."; then \
made_local=yes; \
target="local-dist"; \
fi; \
NEWDESTDIR=$(builddir)/$(DESTDIR)/$$i; \
echo $(NEWDESTDIR); \
(cd $$i && $(MAKE) DESTDIR=$(builddir)/$(DESTDIR)/$$i $$target) || exit 1; \
fi; \
done; \
if test "$$made_local" != "yes"; then \
$(MAKE) "local-dist" || exit 1; \
fi; \
tar -zcf $(DESTTGZ) $(DESTDIR); \
rm -rf $(DESTDIR); \
local-dist: $(DISTFILES)
@mkdir -p $(DESTDIR); \
cp -dp --parents $(DISTFILES) $(DESTDIR);
.PHONY: include all-subdirs activate-subdirs install-subdirs \
clean-subdirs distclean-subdirs dist
# Regenerate makefiles
# autoheader might not change config.h.in, so touch a stamp file.
$(srcdir)/config.h.in: stamp-h.in
$(srcdir)/stamp-h.in: configure.ac aclocal.m4
cd $(srcdir) && autoheader-2.53
echo timestamp > $(srcdir)/stamp-h.in
config.h: stamp-h
stamp-h: config.h.in config.status
./config.status
$(srcdir)/configure: configure.ac aclocal.m4
cd $(srcdir) && autoconf-2.53
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck
mod_log_sql-1.100/configure.ac 0000644 0001750 0001750 00000004345 10171047517 016253 0 ustar zigo zigo 0000000 0000000 dnl Required initializer
AC_INIT(mod_log_sql, 1.100)
OOO_CONFIG_NICE(config.nice)
AC_PREREQ(2.53)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_SRCDIR(mod_log_sql.c)
OOO_MAINTAIN_MODE
dnl Add a test for a compiler.
AC_PROG_CC
APACHE20_VERSION=2.0.40
APACHE13_VERSION=1.3.20
CHECK_APACHE($APACHE13_VERSION,$APACHE20_VERSION,
:,
:,
AC_MSG_ERROR([*** The correct version Apache was not found!])
AC_MSG_ERROR([*** You need either Apache 1.3 version $APACHE13_VERSION or greater])
AC_MSG_ERROR([*** or Apache 2.0/2.1 version $APACHE20_VERSION or greater!])
)
CHECK_MYSQL(
WANT_MYSQL_MOD=1,
AC_MSG_WARN([*** Mysql client libraries not found!])
WANT_MYSQL_MOD=0
)
AC_SUBST(WANT_MYSQL_MOD)
CHECK_LIBDBI(WANT_DBI_MOD=1,
AC_MSG_WARN([** libDBI client libraries not found!])
WANT_DBI_MOD=0
)
AC_SUBST(WANT_DBI_MOD)
dnl to write, checking for pgsql libs
WANT_PGSQL_MOD=0
AC_SUBST(WANT_PGSQL_MOD)
CHECK_MOD_SSL(
WANT_SSL_MOD=1,
AC_MSG_WARN([** mod_ssl.h not found or missing SSL headers!])
WANT_SSL_MOD=0
)
AC_SUBST(WANT_SSL_MOD)
case "$target" in
*-*-solaris* | *-*-osf* )
if test $AP_VERSION -eq 1.3; then
RT_LIBS=-lrt
fi
;;
*)
RT_LIBS=""
;;
esac
AC_SUBST(RT_LIBS)
AC_CHECK_HEADERS(limits.h)
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
dnl Write config.status and the Makefile
AC_OUTPUT(Makefile
docs/Makefile
contrib/Makefile)
AC_MSG_RESULT([------------------------------------])
AC_MSG_RESULT([Apache version : $AP_VERSION])
if test $WANT_SSL_MOD -eq 1; then
AC_MSG_RESULT([SSL Support : yes])
else
AC_MSG_RESULT([SSL Support : no])
AC_MSG_RESULT([*** Make sure OpenSSL headers, and mod_ssl.h are installed.])
fi
AC_MSG_RESULT([Enabled drivers :])
if test $WANT_MYSQL_MOD -eq 1; then
AC_MSG_RESULT([ MySQL Driver])
fi
if test $WANT_PGSQL_MOD -eq 1; then
AC_MSG_RESULT([ PostgreSQL Driver])
fi
if test $WANT_DBI_MOD -eq 1; then
AC_MSG_RESULT([ libDBI Driver])
fi
if test $OOO_MAINTAIN -eq 1; then
AC_MSG_RESULT([Maintainer mode is on. -Werror is in effect])
fi
AC_MSG_RESULT([------------------------------------])
mod_log_sql-1.100/configure 0000755 0001750 0001750 00000465436 10171050470 015700 0 ustar zigo zigo 0000000 0000000 #! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57 for mod_log_sql 1.100.
#
# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
# Support unset when possible.
if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# Work around bugs in pre-3.0 UWIN ksh.
$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
$as_unset $as_var
fi
done
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
# Name of the executable.
as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)$' \| \
. : '\(.\)' 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
/^X\/\(\/\/\)$/{ s//\1/; q; }
/^X\/\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" || {
# Find who we are. Look in the path if we contain no path at all
# relative or not.
case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
{ echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
{ (exit 1); exit 1; }; }
fi
case $CONFIG_SHELL in
'')
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for as_base in sh bash ksh sh5; do
case $as_dir in
/*)
if ("$as_dir/$as_base" -c '
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
$as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
$as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
CONFIG_SHELL=$as_dir/$as_base
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$0" ${1+"$@"}
fi;;
esac
done
done
;;
esac
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
# line-number line before each line; the second 'sed' does the real
# work. The second script uses 'N' to pair each line-number line
# with the numbered line, and appends trailing '-' during
# substitution so that $LINENO is not a special case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
# second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
sed '=' <$as_myself |
sed '
N
s,$,-,
: loop
s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
t loop
s,-$,,
s,^['$as_cr_digits']*\n,,
' >$as_me.lineno &&
chmod +x $as_me.lineno ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensible to this).
. ./$as_me.lineno
# Exit status is that of the last command.
exit
}
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
*c*,-n*) ECHO_N= ECHO_C='
' ECHO_T=' ' ;;
*c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
*) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
# We could just check for DJGPP; but this test a) works b) is more generic
# and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
if test -f conf$$.exe; then
# Don't use ln at all; we don't have any links
as_ln_s='cp -p'
else
as_ln_s='ln -s'
fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
as_mkdir_p=false
fi
as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
'
IFS=" $as_nl"
# CDPATH.
$as_unset CDPATH
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
exec 6>&1
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_config_libobj_dir=.
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
# This variable seems obsolete. It should probably be removed, and
# only ac_max_sed_lines should be used.
: ${ac_max_here_lines=38}
# Identity of this package.
PACKAGE_NAME='mod_log_sql'
PACKAGE_TARNAME='mod_log_sql'
PACKAGE_VERSION='1.100'
PACKAGE_STRING='mod_log_sql 1.100'
PACKAGE_BUGREPORT=''
ac_unique_file="mod_log_sql.c"
# Factoring default headers for most tests.
ac_includes_default="\
#include
#if HAVE_SYS_TYPES_H
# include
#endif
#if HAVE_SYS_STAT_H
# include
#endif
#if STDC_HEADERS
# include
# include
#else
# if HAVE_STDLIB_H
# include
# endif
#endif
#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include
# endif
# include
#endif
#if HAVE_STRINGS_H
# include
#endif
#if HAVE_INTTYPES_H
# include
#else
# if HAVE_STDINT_H
# include
# endif
#endif
#if HAVE_UNISTD_H
# include
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS OOO_MAINTAIN CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT APXS_BIN build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os AP_DEFS AP_PREFIX AP_CFLAGS AP_CPPFLAGS AP_INCLUDES AP_INCLUDEDIR AP_LIBEXECDIR AP_VERSION AP_BINDIR AP_SBINDIR APR_INCLUDES APU_INCLUDES APXS_EXTENSION APXS_CFLAGS MYSQL_LDFLAGS MYSQL_CFLAGS MYSQL_LIBS WANT_MYSQL_MOD DBI_LDFLAGS DBI_LIBS DBI_CFLAGS WANT_DBI_MOD WANT_PGSQL_MOD CPP EGREP MOD_SSL_CFLAGS WANT_SSL_MOD RT_LIBS LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
ac_prev=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
datadir=$ac_optarg ;;
-disable-* | --disable-*)
ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
eval "enable_$ac_feature=no" ;;
-enable-* | --enable-*)
ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
case $ac_option in
*=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
| --locals | --local | --loca | --loc | --lo)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
case $ac_option in
*=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package | sed 's/-/_/g'`
eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) { echo "$as_me: error: unrecognized option: $ac_option
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; }
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid variable name: $ac_envvar" >&2
{ (exit 1); exit 1; }; }
ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
eval "$ac_envvar='$ac_optarg'"
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
{ echo "$as_me: error: missing argument to $ac_option" >&2
{ (exit 1); exit 1; }; }
fi
# Be sure to have absolute paths.
for ac_var in exec_prefix prefix
do
eval ac_val=$`echo $ac_var`
case $ac_val in
[\\/$]* | ?:[\\/]* | NONE | '' ) ;;
*) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
done
# Be sure to have absolute paths.
for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
localstatedir libdir includedir oldincludedir infodir mandir
do
eval ac_val=$`echo $ac_var`
case $ac_val in
[\\/$]* | ?:[\\/]* ) ;;
*) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then its parent.
ac_confdir=`(dirname "$0") 2>/dev/null ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$0" : 'X\(//\)[^/]' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$0" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
{ echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
{ (exit 1); exit 1; }; }
else
{ echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
{ (exit 1); exit 1; }; }
fi
fi
(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
{ echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
{ (exit 1); exit 1; }; }
srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
ac_env_build_alias_set=${build_alias+set}
ac_env_build_alias_value=$build_alias
ac_cv_env_build_alias_set=${build_alias+set}
ac_cv_env_build_alias_value=$build_alias
ac_env_host_alias_set=${host_alias+set}
ac_env_host_alias_value=$host_alias
ac_cv_env_host_alias_set=${host_alias+set}
ac_cv_env_host_alias_value=$host_alias
ac_env_target_alias_set=${target_alias+set}
ac_env_target_alias_value=$target_alias
ac_cv_env_target_alias_set=${target_alias+set}
ac_cv_env_target_alias_value=$target_alias
ac_env_CC_set=${CC+set}
ac_env_CC_value=$CC
ac_cv_env_CC_set=${CC+set}
ac_cv_env_CC_value=$CC
ac_env_CFLAGS_set=${CFLAGS+set}
ac_env_CFLAGS_value=$CFLAGS
ac_cv_env_CFLAGS_set=${CFLAGS+set}
ac_cv_env_CFLAGS_value=$CFLAGS
ac_env_LDFLAGS_set=${LDFLAGS+set}
ac_env_LDFLAGS_value=$LDFLAGS
ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
ac_cv_env_LDFLAGS_value=$LDFLAGS
ac_env_CPPFLAGS_set=${CPPFLAGS+set}
ac_env_CPPFLAGS_value=$CPPFLAGS
ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
ac_cv_env_CPPFLAGS_value=$CPPFLAGS
ac_env_CPP_set=${CPP+set}
ac_env_CPP_value=$CPP
ac_cv_env_CPP_set=${CPP+set}
ac_cv_env_CPP_value=$CPP
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures mod_log_sql 1.100 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print \`checking...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
_ACEOF
cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--infodir=DIR info documentation [PREFIX/info]
--mandir=DIR man documentation [PREFIX/man]
_ACEOF
cat <<\_ACEOF
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of mod_log_sql 1.100:";;
esac
cat <<\_ACEOF
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-maintainer Enable maintainer mode for this project
--disable-apxstest Do not try to compile and run apache version test
program
--disble-mysqltest Do not try to compile and run mysql test program
--disable-ssl Do not compile in SSL support
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-apxs=PATH Path to apxs
--with-mysql=PATH Path to MySQL client library
--with-dbi=PATH Path libdbi headers and libraries
--with-ssl-inc=PATH Location of SSL header files
--with-db-inc=PATH Location of DB header files
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have
headers in a nonstandard directory
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
_ACEOF
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
ac_popdir=`pwd`
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
test -d $ac_dir || continue
ac_builddir=.
if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A "../" for each directory in $ac_dir_suffix.
ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
else
ac_dir_suffix= ac_top_builddir=
fi
case $srcdir in
.) # No --srcdir option. We are building in place.
ac_srcdir=.
if test -z "$ac_top_builddir"; then
ac_top_srcdir=.
else
ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
fi ;;
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
# absolute.
ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
cd $ac_dir
# Check for guested configure; otherwise get Cygnus style configure.
if test -f $ac_srcdir/configure.gnu; then
echo
$SHELL $ac_srcdir/configure.gnu --help=recursive
elif test -f $ac_srcdir/configure; then
echo
$SHELL $ac_srcdir/configure --help=recursive
elif test -f $ac_srcdir/configure.ac ||
test -f $ac_srcdir/configure.in; then
echo
$ac_configure --help
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
cd $ac_popdir
done
fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
mod_log_sql configure 1.100
generated by GNU Autoconf 2.57
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit 0
fi
exec 5>config.log
cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by mod_log_sql $as_me 1.100, which was
generated by GNU Autoconf 2.57. Invocation command line was
$ $0 $@
_ACEOF
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
echo "PATH: $as_dir"
done
} >&5
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_sep=
ac_must_keep_next=false
for ac_pass in 1 2
do
for ac_arg
do
case $ac_arg in
-no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
2)
ac_configure_args1="$ac_configure_args1 '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
# Get rid of the leading space.
ac_sep=" "
;;
esac
done
done
$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# WARNING: Be sure not to use single quotes in there, as some shells,
# such as our DU 5.0 friend, will then `close' the trap.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
echo
cat <<\_ASBOX
## ---------------- ##
## Cache variables. ##
## ---------------- ##
_ASBOX
echo
# The following way of writing the cache mishandles newlines in values,
{
(set) 2>&1 |
case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
*ac_space=\ *)
sed -n \
"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
;;
*)
sed -n \
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
}
echo
cat <<\_ASBOX
## ----------------- ##
## Output variables. ##
## ----------------- ##
_ASBOX
echo
for ac_var in $ac_subst_vars
do
eval ac_val=$`echo $ac_var`
echo "$ac_var='"'"'$ac_val'"'"'"
done | sort
echo
if test -n "$ac_subst_files"; then
cat <<\_ASBOX
## ------------- ##
## Output files. ##
## ------------- ##
_ASBOX
echo
for ac_var in $ac_subst_files
do
eval ac_val=$`echo $ac_var`
echo "$ac_var='"'"'$ac_val'"'"'"
done | sort
echo
fi
if test -s confdefs.h; then
cat <<\_ASBOX
## ----------- ##
## confdefs.h. ##
## ----------- ##
_ASBOX
echo
sed "/^$/d" confdefs.h | sort
echo
fi
test "$ac_signal" != 0 &&
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
rm -f core core.* *.core &&
rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -rf conftest* confdefs.h
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
echo >confdefs.h
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
else
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
{ echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
# Some versions of bash will fail to source /dev/null (special
# files actually), so we avoid doing that.
if test -f "$cache_file"; then
{ echo "$as_me:$LINENO: loading cache $cache_file" >&5
echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . $cache_file;;
*) . ./$cache_file;;
esac
fi
else
{ echo "$as_me:$LINENO: creating cache $cache_file" >&5
echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in `(set) 2>&1 |
sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val="\$ac_cv_env_${ac_var}_value"
eval ac_new_val="\$ac_env_${ac_var}_value"
case $ac_old_set,$ac_new_set in
set,)
{ echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
{ echo "$as_me:$LINENO: former value: $ac_old_val" >&5
echo "$as_me: former value: $ac_old_val" >&2;}
{ echo "$as_me:$LINENO: current value: $ac_new_val" >&5
echo "$as_me: current value: $ac_new_val" >&2;}
ac_cache_corrupted=:
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
*) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
{ echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
echo "$as_me: error: changes in the environment can compromise the build" >&2;}
{ { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
{ (exit 1); exit 1; }; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
echo configure: creating config.nice
rm -f config.nice
cat >config.nice<> config.nice
fi
done
echo '"$@"' >> config.nice
chmod +x config.nice
ac_config_headers="$ac_config_headers config.h"
# Check whether --enable-maintainer or --disable-maintainer was given.
if test "${enable_maintainer+set}" = set; then
enableval="$enable_maintainer"
echo "$as_me:$LINENO: result: Enabling Maintainer Mode!!" >&5
echo "${ECHO_T}Enabling Maintainer Mode!!" >&6
OOO_MAINTAIN=1
else
OOO_MAINTAIN=0
fi;
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
CC=$ac_ct_CC
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
CC=$ac_ct_CC
else
CC="$ac_cv_prog_CC"
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$ac_ct_CC" && break
done
CC=$ac_ct_CC
fi
fi
test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&5
echo "$as_me: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
# Provide some information about the compiler.
echo "$as_me:$LINENO:" \
"checking for C compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5
(eval $ac_compiler --version &5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5
(eval $ac_compiler -v &5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5
(eval $ac_compiler -V &5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
echo "$as_me:$LINENO: checking for C compiler default output" >&5
echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
(eval $ac_link_default) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
# Find the output, starting from the most likely. This scheme is
# not robust to junk in `.', hence go to wildcards (a.*) only as a last
# resort.
# Be careful to initialize this variable, since it used to be cached.
# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
ac_cv_exeext=
# b.out is created by i960 compilers.
for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
;;
conftest.$ac_ext )
# This is the source file.
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
# FIXME: I believe we export ac_cv_exeext for Libtool,
# but it would be cool to find out if it's true. Does anybody
# maintain Libtool? --akim.
export ac_cv_exeext
break;;
* )
break;;
esac
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
See \`config.log' for more details." >&5
echo "$as_me: error: C compiler cannot create executables
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }
fi
ac_exeext=$ac_cv_exeext
echo "$as_me:$LINENO: result: $ac_file" >&5
echo "${ECHO_T}$ac_file" >&6
# Check the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
echo "$as_me:$LINENO: checking whether the C compiler works" >&5
echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
# If not cross compiling, check that we can run a simple program.
if test "$cross_compiling" != yes; then
if { ac_try='./$ac_file'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cross_compiling=no
else
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details." >&5
echo "$as_me: error: cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
fi
fi
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
rm -f a.out a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
# Check the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $cross_compiling" >&5
echo "${ECHO_T}$cross_compiling" >&6
echo "$as_me:$LINENO: checking for suffix of executables" >&5
echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
# If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
export ac_cv_exeext
break;;
* ) break;;
esac
done
else
{ { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest$ac_cv_exeext
echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
echo "${ECHO_T}$ac_cv_exeext" >&6
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
echo "$as_me:$LINENO: checking for suffix of object files" >&5
echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
if test "${ac_cv_objext+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.o conftest.obj
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute suffix of object files: cannot compile
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
echo "${ECHO_T}$ac_cv_objext" >&6
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_compiler_gnu=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_compiler_gnu=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
GCC=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
CFLAGS="-g"
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_prog_cc_g=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
if test "${ac_cv_prog_cc_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include
#include
#include
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
# Don't try gcc -ansi; that turns off useful extensions and
# breaks some systems' header files.
# AIX -qlanglvl=ansi
# Ultrix and OSF/1 -std1
# HP-UX 10.20 and later -Ae
# HP-UX older versions -Aa -D_HPUX_SOURCE
# SVR4 -Xc -D__EXTENSIONS__
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cc_stdc=$ac_arg
break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext
done
rm -f conftest.$ac_ext conftest.$ac_objext
CC=$ac_save_CC
fi
case "x$ac_cv_prog_cc_stdc" in
x|xno)
echo "$as_me:$LINENO: result: none needed" >&5
echo "${ECHO_T}none needed" >&6 ;;
*)
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
CC="$CC $ac_cv_prog_cc_stdc" ;;
esac
# Some people use a C++ compiler to compile C. Since we use `exit',
# in C++ we need to declare it. In case someone uses the same compiler
# for both compiling C and C++ we need to have the C++ compiler decide
# the declaration of exit, since it's the most demanding environment.
cat >conftest.$ac_ext <<_ACEOF
#ifndef __cplusplus
choke me
#endif
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
for ac_declaration in \
''\
'#include ' \
'extern "C" void std::exit (int) throw (); using std::exit;' \
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
'extern "C" void exit (int);' \
'void exit (int);'
do
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
$ac_declaration
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
continue
fi
rm -f conftest.$ac_objext conftest.$ac_ext
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_declaration
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
done
rm -f conftest*
if test -n "$ac_declaration"; then
echo '#ifdef __cplusplus' >>confdefs.h
echo $ac_declaration >>confdefs.h
echo '#endif' >>confdefs.h
fi
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
APACHE20_VERSION=2.0.40
APACHE13_VERSION=1.3.20
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/install-sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f $ac_dir/install.sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f $ac_dir/shtool; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
{ { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
{ (exit 1); exit 1; }; }
fi
ac_config_guess="$SHELL $ac_aux_dir/config.guess"
ac_config_sub="$SHELL $ac_aux_dir/config.sub"
ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
# Make sure we can run config.sub.
$ac_config_sub sun4 >/dev/null 2>&1 ||
{ { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
echo "$as_me: error: cannot run $ac_config_sub" >&2;}
{ (exit 1); exit 1; }; }
echo "$as_me:$LINENO: checking build system type" >&5
echo $ECHO_N "checking build system type... $ECHO_C" >&6
if test "${ac_cv_build+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_build_alias=$build_alias
test -z "$ac_cv_build_alias" &&
ac_cv_build_alias=`$ac_config_guess`
test -z "$ac_cv_build_alias" &&
{ { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
{ (exit 1); exit 1; }; }
ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
{ { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
{ (exit 1); exit 1; }; }
fi
echo "$as_me:$LINENO: result: $ac_cv_build" >&5
echo "${ECHO_T}$ac_cv_build" >&6
build=$ac_cv_build
build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$as_me:$LINENO: checking host system type" >&5
echo $ECHO_N "checking host system type... $ECHO_C" >&6
if test "${ac_cv_host+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_host_alias=$host_alias
test -z "$ac_cv_host_alias" &&
ac_cv_host_alias=$ac_cv_build_alias
ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
{ { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
{ (exit 1); exit 1; }; }
fi
echo "$as_me:$LINENO: result: $ac_cv_host" >&5
echo "${ECHO_T}$ac_cv_host" >&6
host=$ac_cv_host
host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$as_me:$LINENO: checking target system type" >&5
echo $ECHO_N "checking target system type... $ECHO_C" >&6
if test "${ac_cv_target+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_target_alias=$target_alias
test "x$ac_cv_target_alias" = "x" &&
ac_cv_target_alias=$ac_cv_host_alias
ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
{ { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5
echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
{ (exit 1); exit 1; }; }
fi
echo "$as_me:$LINENO: result: $ac_cv_target" >&5
echo "${ECHO_T}$ac_cv_target" >&6
target=$ac_cv_target
target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# The aliases save the names the user supplied, while $host etc.
# will get canonicalized.
test -n "$target_alias" &&
test "$program_prefix$program_suffix$program_transform_name" = \
NONENONEs,x,x, &&
program_prefix=${target_alias}-
# Check whether --with-apxs or --without-apxs was given.
if test "${with_apxs+set}" = set; then
withval="$with_apxs"
apxs_prefix="$withval"
else
apxs_prefix="/usr"
fi;
# Check whether --enable-apachetest or --disable-apachetest was given.
if test "${enable_apachetest+set}" = set; then
enableval="$enable_apachetest"
else
enable_apachetest=yes
fi;
if test -x $apxs_prefix -a ! -d $apxs_prefix; then
APXS_BIN=$apxs_prefix
else
test_paths="$apxs_prefix:$apxs_prefix/bin:$apxs_prefix/sbin"
test_paths="${test_paths}:/usr/bin:/usr/sbin"
test_paths="${test_paths}:/usr/local/bin:/usr/local/sbin:/usr/local/apache2/bin"
# Extract the first word of "apxs", so it can be a program name with args.
set dummy apxs; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_APXS_BIN+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $APXS_BIN in
[\\/]* | ?:[\\/]*)
ac_cv_path_APXS_BIN="$APXS_BIN" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $test_paths
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_APXS_BIN="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
test -z "$ac_cv_path_APXS_BIN" && ac_cv_path_APXS_BIN="no"
;;
esac
fi
APXS_BIN=$ac_cv_path_APXS_BIN
if test -n "$APXS_BIN"; then
echo "$as_me:$LINENO: result: $APXS_BIN" >&5
echo "${ECHO_T}$APXS_BIN" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
min_apache13_version=$APACHE13_VERSION
min_apache20_version=$APACHE20_VERSION
no_apxs=""
if test "$APXS_BIN" = "no"; then
{ { echo "$as_me:$LINENO: error: *** The apxs binary installed by apache could not be found!" >&5
echo "$as_me: error: *** The apxs binary installed by apache could not be found!" >&2;}
{ (exit 1); exit 1; }; }
{ { echo "$as_me:$LINENO: error: *** Use the --with-apxs option with the full path to apxs" >&5
echo "$as_me: error: *** Use the --with-apxs option with the full path to apxs" >&2;}
{ (exit 1); exit 1; }; }
else
AP_INCLUDES="-I`$APXS_BIN -q INCLUDEDIR 2>/dev/null`"
AP_INCLUDEDIR="`$APXS_BIN -q INCLUDEDIR 2>/dev/null`"
AP_PREFIX="`$APXS_BIN -q prefix 2>/dev/null`"
AP_BINDIR="`$APXS_BIN -q bindir 2>/dev/null`"
AP_SBINDIR="`$APXS_BIN -q sbindir 2>/dev/null`"
APXS_CFLAGS=""
for flag in CFLAGS EXTRA_CFLAGS EXTRA_CPPFLAGS NOTEST_CFLAGS; do
APXS_CFLAGS="$APXS_CFLAGS `$APXS_BIN -q $flag 2>/dev/null`"
done
AP_CPPFLAGS="$APXS_CPPFLAGS $AP_INCLUDES"
AP_CFLAGS="$APXS_CFLAGS $AP_INCLUDES"
AP_LIBEXECDIR=`$APXS_BIN -q LIBEXECDIR 2>/dev/null`
if test "x$enable_apachetest" = "xyes" ; then
if test "$min_apache20_version" != "no"; then
APR_CONFIG="`$APXS_BIN -q APR_BINDIR 2>/dev/null`/apr-1-config"
if test ! -x $APR_CONFIG; then
APR_CONFIG="`$APXS_BIN -q APR_BINDIR 2>/dev/null`/apr-config"
fi
APR_INCLUDES=`$APR_CONFIG --includes 2>/dev/null`
APR_VERSION=`$APR_CONFIG --version 2>/dev/null`
APU_CONFIG="`$APXS_BIN -q APU_BINDIR 2>/dev/null`/apu-1-config"
if test ! -x $APU_CONFIG; then
APU_CONFIG="`$APXS_BIN -q APU_BINDIR 2>/dev/null`/apu-config"
fi
APU_INCLUDES=`$APU_CONFIG --includes 2>/dev/null`
APU_VERSION=`$APU_CONFIG --version 2>/dev/null`
echo "$as_me:$LINENO: checking for Apache 2.0 version >= $min_apache20_version" >&5
echo $ECHO_N "checking for Apache 2.0 version >= $min_apache20_version... $ECHO_C" >&6
releasetest=20
min_apache_version="$min_apache20_version"
no_apache=""
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $AP_CFLAGS"
if test $releasetest -eq 20; then
CFLAGS="$CFLAGS $APU_INCLUDES $APR_INCLUDES"
fi
if test "$cross_compiling" = yes; then
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include
#include
#include "httpd.h"
#ifndef AP_SERVER_BASEREVISION
#define AP_SERVER_BASEREVISION SERVER_BASEREVISION
#endif
char* my_strdup (char *str)
{
char *new_str;
if (str) {
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
} else
new_str = NULL;
return new_str;
}
int main (int argc, char *argv[])
{
int major1, minor1, micro1;
int major2, minor2, micro2;
char *tmp_version;
{ FILE *fp = fopen("conf.apachetest", "a"); if ( fp ) fclose(fp); }
tmp_version = my_strdup("$min_apache_version");
if (sscanf(tmp_version, "%d.%d.%d", &major1, &minor1, µ1) != 3) {
printf("%s, bad version string\n", "$min_apache_version");
exit(1);
}
tmp_version = my_strdup(AP_SERVER_BASEREVISION);
if (sscanf(tmp_version, "%d.%d.%d", &major2, &minor2, µ2) != 3) {
printf("%s, bad version string\n", AP_SERVER_BASEREVISION);
exit(1);
}
if ( (major2 == major1) &&
( (minor2 > minor1) ||
((minor2 == minor1) && (micro2 >= micro1)) ) ) {
exit(0);
} else {
exit(1);
}
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
no_apache=yes
fi
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
CFLAGS="$ac_save_CFLAGS"
if test "x$no_apache" = x ; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
cat >>confdefs.h <<\_ACEOF
#define WITH_APACHE20 1
_ACEOF
AP_VERSION="2.0"
APXS_EXTENSION=.la
AP_CFLAGS="$AP_CFLAGS $APU_INCLUDES $APR_INCLUDES"
AP_CPPFLAGS="$AP_CPPFLAGS $APU_INCLUDES $APR_INCLUDES"
AP_DEFS="-DWITH_APACHE20"
:
else
if test -f conf.apachetest ; then
:
else
echo "*** Could not run Apache test program, checking why..."
CFLAGS="$CFLAGS $AP_CFLAGS"
if test $releasetest -eq 20; then
CFLAGS="$CFLAGS $APU_INCLUDES $APR_INCLUDES"
fi
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include "httpd.h"
int main(int argc, char *argv[])
{ return 0; }
#undef main
#define main K_and_R_C_main
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
echo "*** The test program compiled, but failed to run. Check config.log"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
echo "*** The test program failed to compile or link. Check config.log"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
CFLAGS="$ac_save_CFLAGS"
fi
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
if test "x$min_apache13_version" = "xno"; then
{ { echo "$as_me:$LINENO: error: *** The correct version Apache was not found!" >&5
echo "$as_me: error: *** The correct version Apache was not found!" >&2;}
{ (exit 1); exit 1; }; }
{ { echo "$as_me:$LINENO: error: *** You need either Apache 1.3 version $APACHE13_VERSION or greater" >&5
echo "$as_me: error: *** You need either Apache 1.3 version $APACHE13_VERSION or greater" >&2;}
{ (exit 1); exit 1; }; }
{ { echo "$as_me:$LINENO: error: *** or Apache 2.0/2.1 version $APACHE20_VERSION or greater!" >&5
echo "$as_me: error: *** or Apache 2.0/2.1 version $APACHE20_VERSION or greater!" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
rm -f conf.apachetest
fi
if test "$min_apache13_version" != "no" -a "x$AP_VERSION" = "x"; then
APR_INCLUDES=""
APR_VERSION=""
APU_INCLUDES=""
APU_VERSION=""
echo "$as_me:$LINENO: checking for Apache 1.3 version >= $min_apache13_version" >&5
echo $ECHO_N "checking for Apache 1.3 version >= $min_apache13_version... $ECHO_C" >&6
releasetest=13
min_apache_version="$min_apache13_version"
no_apache=""
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $AP_CFLAGS"
if test $releasetest -eq 20; then
CFLAGS="$CFLAGS $APU_INCLUDES $APR_INCLUDES"
fi
if test "$cross_compiling" = yes; then
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include
#include
#include "httpd.h"
#ifndef AP_SERVER_BASEREVISION
#define AP_SERVER_BASEREVISION SERVER_BASEREVISION
#endif
char* my_strdup (char *str)
{
char *new_str;
if (str) {
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
} else
new_str = NULL;
return new_str;
}
int main (int argc, char *argv[])
{
int major1, minor1, micro1;
int major2, minor2, micro2;
char *tmp_version;
{ FILE *fp = fopen("conf.apachetest", "a"); if ( fp ) fclose(fp); }
tmp_version = my_strdup("$min_apache_version");
if (sscanf(tmp_version, "%d.%d.%d", &major1, &minor1, µ1) != 3) {
printf("%s, bad version string\n", "$min_apache_version");
exit(1);
}
tmp_version = my_strdup(AP_SERVER_BASEREVISION);
if (sscanf(tmp_version, "%d.%d.%d", &major2, &minor2, µ2) != 3) {
printf("%s, bad version string\n", AP_SERVER_BASEREVISION);
exit(1);
}
if ( (major2 == major1) &&
( (minor2 > minor1) ||
((minor2 == minor1) && (micro2 >= micro1)) ) ) {
exit(0);
} else {
exit(1);
}
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
no_apache=yes
fi
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
CFLAGS="$ac_save_CFLAGS"
if test "x$no_apache" = x ; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
cat >>confdefs.h <<\_ACEOF
#define WITH_APACHE13 1
_ACEOF
AP_VERSION="1.3"
APXS_EXTENSION=.so
AP_CFLAGS="-g $AP_CFLAGS"
AP_DEFS="-DWITH_APACHE13"
:
else
if test -f conf.apachetest ; then
:
else
echo "*** Could not run Apache test program, checking why..."
CFLAGS="$CFLAGS $AP_CFLAGS"
if test $releasetest -eq 20; then
CFLAGS="$CFLAGS $APU_INCLUDES $APR_INCLUDES"
fi
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include "httpd.h"
int main(int argc, char *argv[])
{ return 0; }
#undef main
#define main K_and_R_C_main
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
echo "*** The test program compiled, but failed to run. Check config.log"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
echo "*** The test program failed to compile or link. Check config.log"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
CFLAGS="$ac_save_CFLAGS"
fi
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
{ { echo "$as_me:$LINENO: error: *** The correct version Apache was not found!" >&5
echo "$as_me: error: *** The correct version Apache was not found!" >&2;}
{ (exit 1); exit 1; }; }
{ { echo "$as_me:$LINENO: error: *** You need either Apache 1.3 version $APACHE13_VERSION or greater" >&5
echo "$as_me: error: *** You need either Apache 1.3 version $APACHE13_VERSION or greater" >&2;}
{ (exit 1); exit 1; }; }
{ { echo "$as_me:$LINENO: error: *** or Apache 2.0/2.1 version $APACHE20_VERSION or greater!" >&5
echo "$as_me: error: *** or Apache 2.0/2.1 version $APACHE20_VERSION or greater!" >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conf.apachetest
fi
fi
fi
# Check whether --with-mysql or --without-mysql was given.
if test "${with_mysql+set}" = set; then
withval="$with_mysql"
mysql_prefix="$withval"
fi;
# Check whether --enable-mysqltest or --disable-mysqltest was given.
if test "${enable_mysqltest+set}" = set; then
enableval="$enable_mysqltest"
else
enable_mysqltest=yes
fi;
testdirs="/usr /usr/local /usr/local /opt"
if test "x$mysql_prefix" != "x" && test "x$mysql_prefix" != "xyes"; then
testdirs="${testdirs} ${mysql_prefix}"
fi
for dir in $testdirs; do
if test -e $dir/include/mysql.h; then
MYSQL_CFLAGS=-I${dir}/include
MYSQL_LDFLAGS=-L${dir}/lib
MYSQL_LIBS="-lmysqlclient -lm -lz"
break
elif test -e $dir/include/mysql/mysql.h; then
MYSQL_CFLAGS=-I${dir}/include/mysql
MYSQL_LDFLAGS=-L${dir}/lib/mysql
MYSQL_LIBS="-lmysqlclient -lm -lz"
break
fi
done
if test -z $MYSQL_CFLAGS; then
echo "*** MySQL development files could not be found!"
fi
ac_save_CFLAGS=$CFLAGS
ac_save_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS $MYSQL_CFLAGS"
LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
echo "$as_me:$LINENO: checking for floor in -lm" >&5
echo $ECHO_N "checking for floor in -lm... $ECHO_C" >&6
if test "${ac_cv_lib_m_floor+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lm $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char floor ();
int
main ()
{
floor ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_m_floor=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_m_floor=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_m_floor" >&5
echo "${ECHO_T}$ac_cv_lib_m_floor" >&6
if test $ac_cv_lib_m_floor = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBM 1
_ACEOF
LIBS="-lm $LIBS"
fi
echo "$as_me:$LINENO: checking for gzclose in -lz" >&5
echo $ECHO_N "checking for gzclose in -lz... $ECHO_C" >&6
if test "${ac_cv_lib_z_gzclose+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lz $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char gzclose ();
int
main ()
{
gzclose ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_z_gzclose=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_z_gzclose=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzclose" >&5
echo "${ECHO_T}$ac_cv_lib_z_gzclose" >&6
if test $ac_cv_lib_z_gzclose = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBZ 1
_ACEOF
LIBS="-lz $LIBS"
fi
with_mysql="yes"
cat >>confdefs.h <<\_ACEOF
#define WITH_MYSQL 1
_ACEOF
echo "$as_me:$LINENO: checking for mysql_init in -lmysqlclient" >&5
echo $ECHO_N "checking for mysql_init in -lmysqlclient... $ECHO_C" >&6
if test "${ac_cv_lib_mysqlclient_mysql_init+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lmysqlclient $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char mysql_init ();
int
main ()
{
mysql_init ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_mysqlclient_mysql_init=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_mysqlclient_mysql_init=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_mysqlclient_mysql_init" >&5
echo "${ECHO_T}$ac_cv_lib_mysqlclient_mysql_init" >&6
if test $ac_cv_lib_mysqlclient_mysql_init = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBMYSQLCLIENT 1
_ACEOF
LIBS="-lmysqlclient $LIBS"
else
{ { echo "$as_me:$LINENO: error: libmysqlclient is needed for MySQL support" >&5
echo "$as_me: error: libmysqlclient is needed for MySQL support" >&2;}
{ (exit 1); exit 1; }; }
fi
for ac_func in mysql_real_escape_string
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
if eval "test \"\${$as_ac_var+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer to if __STDC__ is defined, since
exists even on freestanding compilers. */
#ifdef __STDC__
# include
#else
# include
#endif
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
{
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
char (*f) () = $ac_func;
#endif
#ifdef __cplusplus
}
#endif
int
main ()
{
return f != $ac_func;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
echo "$as_me:$LINENO: checking whether mysql clients can run" >&5
echo $ECHO_N "checking whether mysql clients can run... $ECHO_C" >&6
if test "$cross_compiling" = yes; then
echo $ac_n "cross compiling; assumed OK.... $ac_c"
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include
int main(void)
{
MYSQL *a = mysql_init(NULL);
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
no_mysql=yes
fi
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
CFLAGS=$ac_save_CFLAGS
LDFLAGS=$ac_save_LDFLAGS
if test "x$no_mysql" = x; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
WANT_MYSQL_MOD=1
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
echo "*** MySQL could not be found ***"
MYSQL_CFLAGS=""
MYSQL_LDFLAGS=""
MYSQL_LIBS=""
{ echo "$as_me:$LINENO: WARNING: *** Mysql client libraries not found!" >&5
echo "$as_me: WARNING: *** Mysql client libraries not found!" >&2;}
WANT_MYSQL_MOD=0
fi
# Check whether --with-dbi or --without-dbi was given.
if test "${with_dbi+set}" = set; then
withval="$with_dbi"
dbi_path="$withval"
else
:
fi;
# Determine dbi include directory.
if test -z $dbi_path; then
test_paths="/usr/include /usr/local/include"
else
test_paths="${dbi_path}/include"
fi
for x in $test_paths ; do
echo "$as_me:$LINENO: checking for dbi Includes in ${x}" >&5
echo $ECHO_N "checking for dbi Includes in ${x}... $ECHO_C" >&6
if test -f ${x}/dbi/dbi.h; then
DBI_CFLAGS="-I$x"
echo "$as_me:$LINENO: result: found it! Use --with-dbi to specify another." >&5
echo "${ECHO_T}found it! Use --with-dbi to specify another." >&6
break
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
done
if test -z "$DBI_CFLAGS"; then
{ echo "$as_me:$LINENO: WARNING: ** libDBI client libraries not found!" >&5
echo "$as_me: WARNING: ** libDBI client libraries not found!" >&2;}
WANT_DBI_MOD=0
fi
# Determine libdbi lib directory
if test -z $dbi_path; then
test_paths="/usr/lib /usr/local/lib"
else
test_paths="${dbi_path}/lib"
fi
for x in $test_paths ; do
echo "$as_me:$LINENO: checking for libdbi library in ${x}" >&5
echo $ECHO_N "checking for libdbi library in ${x}... $ECHO_C" >&6
if test -f ${x}/libdbi.so; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
CFLAGS="$DBI_CFLAGS $CFLAGS"
LDFLAGS="-L$x $LDFLAGS"
echo "$as_me:$LINENO: checking for dbi_version in -ldbi" >&5
echo $ECHO_N "checking for dbi_version in -ldbi... $ECHO_C" >&6
if test "${ac_cv_lib_dbi_dbi_version+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldbi $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char dbi_version ();
int
main ()
{
dbi_version ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_dbi_dbi_version=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_dbi_dbi_version=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_dbi_dbi_version" >&5
echo "${ECHO_T}$ac_cv_lib_dbi_dbi_version" >&6
if test $ac_cv_lib_dbi_dbi_version = yes; then
DBI_LDFLAGS="-L$x"
fi
CFLAGS=$save_CFLAGS
LDFLAGS=$save_LDFLAGS
break
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
done
if test -z "$DBI_LDFLAGS"; then
{ echo "$as_me:$LINENO: WARNING: ** libDBI client libraries not found!" >&5
echo "$as_me: WARNING: ** libDBI client libraries not found!" >&2;}
WANT_DBI_MOD=0
else
DBI_LIBS=-ldbi
WANT_DBI_MOD=1
fi
WANT_PGSQL_MOD=0
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
if test "${ac_cv_prog_CPP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
do
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
break
fi
done
ac_cv_prog_CPP=$CPP
fi
CPP=$ac_cv_prog_CPP
else
ac_cv_prog_CPP=$CPP
fi
echo "$as_me:$LINENO: result: $CPP" >&5
echo "${ECHO_T}$CPP" >&6
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
:
else
{ { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." >&5
echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
echo "$as_me:$LINENO: checking for egrep" >&5
echo $ECHO_N "checking for egrep... $ECHO_C" >&6
if test "${ac_cv_prog_egrep+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if echo a | (grep -E '(a|b)') >/dev/null 2>&1
then ac_cv_prog_egrep='grep -E'
else ac_cv_prog_egrep='egrep'
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
echo "${ECHO_T}$ac_cv_prog_egrep" >&6
EGREP=$ac_cv_prog_egrep
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include
#include
#include
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_header_stdc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_header_stdc=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "memchr" >/dev/null 2>&1; then
:
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "free" >/dev/null 2>&1; then
:
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then
:
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
exit(2);
exit (0);
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
echo "${ECHO_T}$ac_cv_header_stdc" >&6
if test $ac_cv_header_stdc = yes; then
cat >>confdefs.h <<\_ACEOF
#define STDC_HEADERS 1
_ACEOF
fi
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_Header=no"
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
# Check whether --enable-ssl or --disable-ssl was given.
if test "${enable_ssl+set}" = set; then
enableval="$enable_ssl"
ssl_val=no
else
ssl_val=yes
fi;
# Check whether --with-ssl-inc or --without-ssl-inc was given.
if test "${with_ssl_inc+set}" = set; then
withval="$with_ssl_inc"
ssl_incdir="$withval"
fi;
# Check whether --with-db-inc or --without-db-inc was given.
if test "${with_db_inc+set}" = set; then
withval="$with_db_inc"
db_incdir="$withval"
else
db_incdir="/usr/include/db1"
fi;
if test "x$ssl_val" = "xyes"; then
ac_save_CFLAGS=$CFLAGS
ac_save_CPPFLAGS=$CPPFLAGS
MOD_SSL_CFLAGS="-I/usr/include/openssl"
if test "x$ssl_incdir" != "x"; then
MOD_SSL_CFLAGS="-I$ssl_incdir -I$ssl_incdir/openssl $MOD_SSL_CFLAGS"
fi
if test "x$db_incdir" != "x"; then
MOD_SSL_CFLAGS="-I$db_incdir $MOD_SSL_CFLAGS"
fi
CFLAGS="$AP_CFLAGS $MOD_SSL_CFLAGS $CFLAGS"
CPPFLAGS="$AP_CFLAGS $MOD_SSL_CFLAGS $CPPFLAGS"
for ac_header in mod_ssl.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc in
yes:no )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
no:yes )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
mod_ssl_h=yes
fi
done
CFLAGS=$ac_save_CFLAGS
CPPFLAGS=$ac_save_CPPFLAGS
if test "x$mod_ssl_h" = "x"; then
{ echo "$as_me:$LINENO: WARNING: ** mod_ssl.h not found or missing SSL headers!" >&5
echo "$as_me: WARNING: ** mod_ssl.h not found or missing SSL headers!" >&2;}
WANT_SSL_MOD=0
else
WANT_SSL_MOD=1
fi
else
{ echo "$as_me:$LINENO: WARNING: ** mod_ssl.h not found or missing SSL headers!" >&5
echo "$as_me: WARNING: ** mod_ssl.h not found or missing SSL headers!" >&2;}
WANT_SSL_MOD=0
fi
case "$target" in
*-*-solaris* | *-*-osf* )
if test $AP_VERSION -eq 1.3; then
RT_LIBS=-lrt
fi
;;
*)
RT_LIBS=""
;;
esac
for ac_header in limits.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc in
yes:no )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
no:yes )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
ac_config_files="$ac_config_files stamp-h"
ac_config_files="$ac_config_files Makefile docs/Makefile contrib/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
_ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
{
(set) 2>&1 |
case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n \
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
} |
sed '
t clear
: clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
/^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
: end' >>confcache
if diff $cache_file confcache >/dev/null 2>&1; then :; else
if test -w $cache_file; then
test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
cat confcache >$cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# VPATH may cause trouble with some makes, so we remove $(srcdir),
# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=/{
s/:*\$(srcdir):*/:/;
s/:*\${srcdir}:*/:/;
s/:*@srcdir@:*/:/;
s/^\([^=]*=[ ]*\):*/\1/;
s/:*$//;
s/^[^=]*=[ ]*$//;
}'
fi
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_i=`echo "$ac_i" |
sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
# 2. Add them.
ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
echo "$as_me: creating $CONFIG_STATUS" >&6;}
cat >$CONFIG_STATUS <<_ACEOF
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
# Support unset when possible.
if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# Work around bugs in pre-3.0 UWIN ksh.
$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
$as_unset $as_var
fi
done
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
# Name of the executable.
as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)$' \| \
. : '\(.\)' 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
/^X\/\(\/\/\)$/{ s//\1/; q; }
/^X\/\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" || {
# Find who we are. Look in the path if we contain no path at all
# relative or not.
case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
{ { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
{ (exit 1); exit 1; }; }
fi
case $CONFIG_SHELL in
'')
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for as_base in sh bash ksh sh5; do
case $as_dir in
/*)
if ("$as_dir/$as_base" -c '
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
$as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
$as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
CONFIG_SHELL=$as_dir/$as_base
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$0" ${1+"$@"}
fi;;
esac
done
done
;;
esac
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
# line-number line before each line; the second 'sed' does the real
# work. The second script uses 'N' to pair each line-number line
# with the numbered line, and appends trailing '-' during
# substitution so that $LINENO is not a special case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
# second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
sed '=' <$as_myself |
sed '
N
s,$,-,
: loop
s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
t loop
s,-$,,
s,^['$as_cr_digits']*\n,,
' >$as_me.lineno &&
chmod +x $as_me.lineno ||
{ { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensible to this).
. ./$as_me.lineno
# Exit status is that of the last command.
exit
}
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
*c*,-n*) ECHO_N= ECHO_C='
' ECHO_T=' ' ;;
*c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
*) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
# We could just check for DJGPP; but this test a) works b) is more generic
# and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
if test -f conf$$.exe; then
# Don't use ln at all; we don't have any links
as_ln_s='cp -p'
else
as_ln_s='ln -s'
fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
as_mkdir_p=false
fi
as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
'
IFS=" $as_nl"
# CDPATH.
$as_unset CDPATH
exec 6>&1
# Open the log real soon, to keep \$[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. Logging --version etc. is OK.
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by mod_log_sql $as_me 1.100, which was
generated by GNU Autoconf 2.57. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
_CSEOF
echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
echo >&5
_ACEOF
# Files that config.status was made for.
if test -n "$ac_config_files"; then
echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
fi
if test -n "$ac_config_headers"; then
echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
fi
if test -n "$ac_config_links"; then
echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
fi
if test -n "$ac_config_commands"; then
echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
fi
cat >>$CONFIG_STATUS <<\_ACEOF
ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
current configuration.
Usage: $0 [OPTIONS] [FILE]...
-h, --help print this help, then exit
-V, --version print version number, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
$config_files
Configuration headers:
$config_headers
Report bugs to ."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
mod_log_sql config.status 1.100
configured by $0, generated by GNU Autoconf 2.57,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
srcdir=$srcdir
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# If no file are specified by the user, then we need to provide default
# value. By we need to know if files were specified by the user.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=*)
ac_option=`expr "x$1" : 'x\([^=]*\)='`
ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
ac_shift=:
;;
-*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
*) # This is not an option, so the user has probably given explicit
# arguments.
ac_option=$1
ac_need_defaults=false;;
esac
case $ac_option in
# Handling of the options.
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --vers* | -V )
echo "$ac_cs_version"; exit 0 ;;
--he | --h)
# Conflict between --help and --header
{ { echo "$as_me:$LINENO: error: ambiguous option: $1
Try \`$0 --help' for more information." >&5
echo "$as_me: error: ambiguous option: $1
Try \`$0 --help' for more information." >&2;}
{ (exit 1); exit 1; }; };;
--help | --hel | -h )
echo "$ac_cs_usage"; exit 0 ;;
--debug | --d* | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
CONFIG_FILES="$CONFIG_FILES $ac_optarg"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
ac_need_defaults=false;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
Try \`$0 --help' for more information." >&5
echo "$as_me: error: unrecognized option: $1
Try \`$0 --help' for more information." >&2;}
{ (exit 1); exit 1; }; } ;;
*) ac_config_targets="$ac_config_targets $1" ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
if \$ac_cs_recheck; then
echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
for ac_config_target in $ac_config_targets
do
case "$ac_config_target" in
# Handling of arguments.
"stamp-h" ) CONFIG_FILES="$CONFIG_FILES stamp-h" ;;
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"docs/Makefile" ) CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;;
"contrib/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/Makefile" ;;
"config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason to put it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Create a temporary directory, and hook for its removal unless debugging.
$debug ||
{
trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
trap '{ (exit 1); exit 1; }' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
tmp=./confstat$$-$RANDOM
(umask 077 && mkdir $tmp)
} ||
{
echo "$me: cannot create a temporary directory in ." >&2
{ (exit 1); exit 1; }
}
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
#
# CONFIG_FILES section.
#
# No need to generate the scripts if there are no CONFIG_FILES.
# This happens for instance when ./config.status config.h
if test -n "\$CONFIG_FILES"; then
# Protect against being on the right side of a sed subst in config.status.
sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
s,@SHELL@,$SHELL,;t t
s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
s,@exec_prefix@,$exec_prefix,;t t
s,@prefix@,$prefix,;t t
s,@program_transform_name@,$program_transform_name,;t t
s,@bindir@,$bindir,;t t
s,@sbindir@,$sbindir,;t t
s,@libexecdir@,$libexecdir,;t t
s,@datadir@,$datadir,;t t
s,@sysconfdir@,$sysconfdir,;t t
s,@sharedstatedir@,$sharedstatedir,;t t
s,@localstatedir@,$localstatedir,;t t
s,@libdir@,$libdir,;t t
s,@includedir@,$includedir,;t t
s,@oldincludedir@,$oldincludedir,;t t
s,@infodir@,$infodir,;t t
s,@mandir@,$mandir,;t t
s,@build_alias@,$build_alias,;t t
s,@host_alias@,$host_alias,;t t
s,@target_alias@,$target_alias,;t t
s,@DEFS@,$DEFS,;t t
s,@ECHO_C@,$ECHO_C,;t t
s,@ECHO_N@,$ECHO_N,;t t
s,@ECHO_T@,$ECHO_T,;t t
s,@LIBS@,$LIBS,;t t
s,@OOO_MAINTAIN@,$OOO_MAINTAIN,;t t
s,@CC@,$CC,;t t
s,@CFLAGS@,$CFLAGS,;t t
s,@LDFLAGS@,$LDFLAGS,;t t
s,@CPPFLAGS@,$CPPFLAGS,;t t
s,@ac_ct_CC@,$ac_ct_CC,;t t
s,@EXEEXT@,$EXEEXT,;t t
s,@OBJEXT@,$OBJEXT,;t t
s,@APXS_BIN@,$APXS_BIN,;t t
s,@build@,$build,;t t
s,@build_cpu@,$build_cpu,;t t
s,@build_vendor@,$build_vendor,;t t
s,@build_os@,$build_os,;t t
s,@host@,$host,;t t
s,@host_cpu@,$host_cpu,;t t
s,@host_vendor@,$host_vendor,;t t
s,@host_os@,$host_os,;t t
s,@target@,$target,;t t
s,@target_cpu@,$target_cpu,;t t
s,@target_vendor@,$target_vendor,;t t
s,@target_os@,$target_os,;t t
s,@AP_DEFS@,$AP_DEFS,;t t
s,@AP_PREFIX@,$AP_PREFIX,;t t
s,@AP_CFLAGS@,$AP_CFLAGS,;t t
s,@AP_CPPFLAGS@,$AP_CPPFLAGS,;t t
s,@AP_INCLUDES@,$AP_INCLUDES,;t t
s,@AP_INCLUDEDIR@,$AP_INCLUDEDIR,;t t
s,@AP_LIBEXECDIR@,$AP_LIBEXECDIR,;t t
s,@AP_VERSION@,$AP_VERSION,;t t
s,@AP_BINDIR@,$AP_BINDIR,;t t
s,@AP_SBINDIR@,$AP_SBINDIR,;t t
s,@APR_INCLUDES@,$APR_INCLUDES,;t t
s,@APU_INCLUDES@,$APU_INCLUDES,;t t
s,@APXS_EXTENSION@,$APXS_EXTENSION,;t t
s,@APXS_CFLAGS@,$APXS_CFLAGS,;t t
s,@MYSQL_LDFLAGS@,$MYSQL_LDFLAGS,;t t
s,@MYSQL_CFLAGS@,$MYSQL_CFLAGS,;t t
s,@MYSQL_LIBS@,$MYSQL_LIBS,;t t
s,@WANT_MYSQL_MOD@,$WANT_MYSQL_MOD,;t t
s,@DBI_LDFLAGS@,$DBI_LDFLAGS,;t t
s,@DBI_LIBS@,$DBI_LIBS,;t t
s,@DBI_CFLAGS@,$DBI_CFLAGS,;t t
s,@WANT_DBI_MOD@,$WANT_DBI_MOD,;t t
s,@WANT_PGSQL_MOD@,$WANT_PGSQL_MOD,;t t
s,@CPP@,$CPP,;t t
s,@EGREP@,$EGREP,;t t
s,@MOD_SSL_CFLAGS@,$MOD_SSL_CFLAGS,;t t
s,@WANT_SSL_MOD@,$WANT_SSL_MOD,;t t
s,@RT_LIBS@,$RT_LIBS,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
ac_max_sed_lines=48
ac_sed_frag=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_lines # Line after last line for current file.
ac_more_lines=:
ac_sed_cmds=
while $ac_more_lines; do
if test $ac_beg -gt 1; then
sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
else
sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
fi
if test ! -s $tmp/subs.frag; then
ac_more_lines=false
else
# The purpose of the label and of the branching condition is to
# speed up the sed processing (if there are no `@' at all, there
# is no need to browse any of the substitutions).
# These are the two extra sed commands mentioned above.
(echo ':t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
if test -z "$ac_sed_cmds"; then
ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
else
ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
fi
ac_sed_frag=`expr $ac_sed_frag + 1`
ac_beg=$ac_end
ac_end=`expr $ac_end + $ac_max_sed_lines`
fi
done
if test -z "$ac_sed_cmds"; then
ac_sed_cmds=cat
fi
fi # test -n "$CONFIG_FILES"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case $ac_file in
- | *:- | *:-:* ) # input from stdin
cat >$tmp/stdin
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
* ) ac_file_in=$ac_file.in ;;
esac
# Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
{ if $as_mkdir_p; then
mkdir -p "$ac_dir"
else
as_dir="$ac_dir"
as_dirs=
while test ! -d "$as_dir"; do
as_dirs="$as_dir $as_dirs"
as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
done
test ! -n "$as_dirs" || mkdir $as_dirs
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }; }
ac_builddir=.
if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A "../" for each directory in $ac_dir_suffix.
ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
else
ac_dir_suffix= ac_top_builddir=
fi
case $srcdir in
.) # No --srcdir option. We are building in place.
ac_srcdir=.
if test -z "$ac_top_builddir"; then
ac_top_srcdir=.
else
ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
fi ;;
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
# absolute.
ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
if test x"$ac_file" != x-; then
{ echo "$as_me:$LINENO: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
rm -f "$ac_file"
fi
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
if test x"$ac_file" = x-; then
configure_input=
else
configure_input="$ac_file. "
fi
configure_input=$configure_input"Generated from `echo $ac_file_in |
sed 's,.*/,,'` by configure."
# First look for the input files in the build tree, otherwise in the
# src tree.
ac_file_inputs=`IFS=:
for f in $ac_file_in; do
case $f in
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo $f;;
*) # Relative
if test -f "$f"; then
# Build tree
echo $f
elif test -f "$srcdir/$f"; then
# Source tree
echo $srcdir/$f
else
# /dev/null tree
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
esac
done` || { (exit 1); exit 1; }
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s,@configure_input@,$configure_input,;t t
s,@srcdir@,$ac_srcdir,;t t
s,@abs_srcdir@,$ac_abs_srcdir,;t t
s,@top_srcdir@,$ac_top_srcdir,;t t
s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
s,@builddir@,$ac_builddir,;t t
s,@abs_builddir@,$ac_abs_builddir,;t t
s,@top_builddir@,$ac_top_builddir,;t t
s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
rm -f $tmp/stdin
if test x"$ac_file" != x-; then
mv $tmp/out $ac_file
else
cat $tmp/out
rm -f $tmp/out
fi
# Run the commands associated with the file.
case $ac_file in
stamp-h ) echo timestamp > stamp-h ;;
esac
done
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
#
# CONFIG_HEADER section.
#
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
ac_dB='[ ].*$,\1#\2'
ac_dC=' '
ac_dD=',;t'
# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_uB='$,\1#\2define\3'
ac_uC=' '
ac_uD=',;t'
for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case $ac_file in
- | *:- | *:-:* ) # input from stdin
cat >$tmp/stdin
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
* ) ac_file_in=$ac_file.in ;;
esac
test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
# First look for the input files in the build tree, otherwise in the
# src tree.
ac_file_inputs=`IFS=:
for f in $ac_file_in; do
case $f in
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo $f;;
*) # Relative
if test -f "$f"; then
# Build tree
echo $f
elif test -f "$srcdir/$f"; then
# Source tree
echo $srcdir/$f
else
# /dev/null tree
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
esac
done` || { (exit 1); exit 1; }
# Remove the trailing spaces.
sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
_ACEOF
# Transform confdefs.h into two sed scripts, `conftest.defines' and
# `conftest.undefs', that substitutes the proper values into
# config.h.in to produce config.h. The first handles `#define'
# templates, and the second `#undef' templates.
# And first: Protect against being on the right side of a sed subst in
# config.status. Protect against being in an unquoted here document
# in config.status.
rm -f conftest.defines conftest.undefs
# Using a here document instead of a string reduces the quoting nightmare.
# Putting comments in sed scripts is not portable.
#
# `end' is used to avoid that the second main sed command (meant for
# 0-ary CPP macros) applies to n-ary macro definitions.
# See the Autoconf documentation for `clear'.
cat >confdef2sed.sed <<\_ACEOF
s/[\\&,]/\\&/g
s,[\\$`],\\&,g
t clear
: clear
s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
t end
s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
: end
_ACEOF
# If some macros were called several times there might be several times
# the same #defines, which is useless. Nevertheless, we may not want to
# sort them, since we want the *last* AC-DEFINE to be honored.
uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
rm -f confdef2sed.sed
# This sed command replaces #undef with comments. This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
cat >>conftest.undefs <<\_ACEOF
s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
_ACEOF
# Break up conftest.defines because some shells have a limit on the size
# of here documents, and old seds have small limits too (100 cmds).
echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
echo ' :' >>$CONFIG_STATUS
rm -f conftest.tail
while grep . conftest.defines >/dev/null
do
# Write a limited-size here document to $tmp/defines.sed.
echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS
# Speed up: don't consider the non `#define' lines.
echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
# Work around the forget-to-reset-the-flag bug.
echo 't clr' >>$CONFIG_STATUS
echo ': clr' >>$CONFIG_STATUS
sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
echo 'CEOF
sed -f $tmp/defines.sed $tmp/in >$tmp/out
rm -f $tmp/in
mv $tmp/out $tmp/in
' >>$CONFIG_STATUS
sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
rm -f conftest.defines
mv conftest.tail conftest.defines
done
rm -f conftest.defines
echo ' fi # grep' >>$CONFIG_STATUS
echo >>$CONFIG_STATUS
# Break up conftest.undefs because some shells have a limit on the size
# of here documents, and old seds have small limits too (100 cmds).
echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
rm -f conftest.tail
while grep . conftest.undefs >/dev/null
do
# Write a limited-size here document to $tmp/undefs.sed.
echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS
# Speed up: don't consider the non `#undef'
echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
# Work around the forget-to-reset-the-flag bug.
echo 't clr' >>$CONFIG_STATUS
echo ': clr' >>$CONFIG_STATUS
sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
echo 'CEOF
sed -f $tmp/undefs.sed $tmp/in >$tmp/out
rm -f $tmp/in
mv $tmp/out $tmp/in
' >>$CONFIG_STATUS
sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
rm -f conftest.undefs
mv conftest.tail conftest.undefs
done
rm -f conftest.undefs
cat >>$CONFIG_STATUS <<\_ACEOF
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
if test x"$ac_file" = x-; then
echo "/* Generated by configure. */" >$tmp/config.h
else
echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
fi
cat $tmp/in >>$tmp/config.h
rm -f $tmp/in
if test x"$ac_file" != x-; then
if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
{ echo "$as_me:$LINENO: $ac_file is unchanged" >&5
echo "$as_me: $ac_file is unchanged" >&6;}
else
ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
{ if $as_mkdir_p; then
mkdir -p "$ac_dir"
else
as_dir="$ac_dir"
as_dirs=
while test ! -d "$as_dir"; do
as_dirs="$as_dir $as_dirs"
as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
done
test ! -n "$as_dirs" || mkdir $as_dirs
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }; }
rm -f $ac_file
mv $tmp/config.h $ac_file
fi
else
cat $tmp/config.h
rm -f $tmp/config.h
fi
done
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
{ (exit 0); exit 0; }
_ACEOF
chmod +x $CONFIG_STATUS
ac_clean_files=$ac_clean_files_save
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
# by configure, so config.status won't be able to write to it; its
# output is simply discarded. So we exec the FD to /dev/null,
# effectively closing config.log, so it can be properly (re)opened and
# appended to by config.status. When coming back to configure, we
# need to make the FD available again.
if test "$no_create" != yes; then
ac_cs_success=:
ac_config_status_args=
test "$silent" = yes &&
ac_config_status_args="$ac_config_status_args --quiet"
exec 5>/dev/null
$SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
$ac_cs_success || { (exit 1); exit 1; }
fi
echo "$as_me:$LINENO: result: ------------------------------------" >&5
echo "${ECHO_T}------------------------------------" >&6
echo "$as_me:$LINENO: result: Apache version : $AP_VERSION" >&5
echo "${ECHO_T}Apache version : $AP_VERSION" >&6
if test $WANT_SSL_MOD -eq 1; then
echo "$as_me:$LINENO: result: SSL Support : yes" >&5
echo "${ECHO_T}SSL Support : yes" >&6
else
echo "$as_me:$LINENO: result: SSL Support : no" >&5
echo "${ECHO_T}SSL Support : no" >&6
echo "$as_me:$LINENO: result: *** Make sure OpenSSL headers, and mod_ssl.h are installed." >&5
echo "${ECHO_T}*** Make sure OpenSSL headers, and mod_ssl.h are installed." >&6
fi
echo "$as_me:$LINENO: result: Enabled drivers :" >&5
echo "${ECHO_T}Enabled drivers :" >&6
if test $WANT_MYSQL_MOD -eq 1; then
echo "$as_me:$LINENO: result: MySQL Driver" >&5
echo "${ECHO_T} MySQL Driver" >&6
fi
if test $WANT_PGSQL_MOD -eq 1; then
echo "$as_me:$LINENO: result: PostgreSQL Driver" >&5
echo "${ECHO_T} PostgreSQL Driver" >&6
fi
if test $WANT_DBI_MOD -eq 1; then
echo "$as_me:$LINENO: result: libDBI Driver" >&5
echo "${ECHO_T} libDBI Driver" >&6
fi
if test $OOO_MAINTAIN -eq 1; then
echo "$as_me:$LINENO: result: Maintainer mode is on. -Werror is in effect" >&5
echo "${ECHO_T}Maintainer mode is on. -Werror is in effect" >&6
fi
echo "$as_me:$LINENO: result: ------------------------------------" >&5
echo "${ECHO_T}------------------------------------" >&6
mod_log_sql-1.100/stamp-h.in 0000644 0001750 0001750 00000000000 10171050470 015636 0 ustar zigo zigo 0000000 0000000 mod_log_sql-1.100/config.h.in 0000644 0001750 0001750 00000003745 10077317461 016016 0 ustar zigo zigo 0000000 0000000 /* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `mysqlclient' library (-lmysqlclient). */
#undef HAVE_LIBMYSQLCLIENT
/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ
/* Define to 1 if you have the header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the header file. */
#undef HAVE_MOD_SSL_H
/* Define to 1 if you have the `mysql_real_escape_string' function. */
#undef HAVE_MYSQL_REAL_ESCAPE_STRING
/* Define to 1 if you have the header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the header file. */
#undef HAVE_UNISTD_H
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if we are compiling with Apache 1.3.x */
#undef WITH_APACHE13
/* Define to 1 if we are compiling with Apache 2.0.x */
#undef WITH_APACHE20
/* Define to 1 if we are compiling with mysql */
#undef WITH_MYSQL
mod_log_sql-1.100/AUTHORS 0000644 0001750 0001750 00000000556 10171046152 015027 0 ustar zigo zigo 0000000 0000000 Edward Rudd
Apache 2.0 port. Current Maintainer as of February, 2004
Christopher B. Powell
Maintainer since version 1.06
Zeev Suraski
Adding the mysql routines (intial revisions)
The Apache Foundation
standard apache logging module for which this module is based on
mod_log_sql-1.100/INSTALL 0000644 0001750 0001750 00000001006 10171046153 015000 0 ustar zigo zigo 0000000 0000000 This document has been superseded by the new documentation in the
docs/ directory. There you will find the docs in a variety of
formats, including PostScript, plaintext, and HTML.
Basic overview is..
./configure --with-apxs=/path/to/apxs --enable-ssl
gmake
gmake install
edit httpd.conf and add the following.
LoadModule log_sql_module modules/mod_log_sql.so
LoadModule log_sql_mysql_module modules/mod_log_sql_mysql.so
LoadModule log_sql_ssl_module modules/mod_log_sql_ssl.so
mod_log_sql-1.100/TODO 0000644 0001750 0001750 00000002036 10171050565 014445 0 ustar zigo zigo 0000000 0000000 TODO:
* verify a db driver has been loaded.
* validate table names before trying to log them.
* write alternate DB driver (PostgreSQL, libDBI, mod_*_pool)
* look at forcing table name to ServerName instead of on of the names in
ServerAlias?
* LogSQLRotateLogs directive with daily/monthly/weekly/etc.
* socket-based middleman daemon with configurable conns, or connect/disconnect.
* DBI connection pooling.
* apr_dbd backend driver
* ignore by cookie
* investigate thread safety issues
Use libmysqlclient_r for threaded MPM (or always?)
Add thread locks if using standard mysqlclient
Check locking issues with the preserve file
* rewrite main core logging function to optimize for speed.
* Clean up table creation code.
support DB independent way of defining the tables
-----
mod_log_sql.c:349: to more error checking/force all params to be set
mod_log_sql.c:460: Add local_address, remote_address, server_name, connection_status
mod_log_sql.c:466: Document
mod_log_sql.c:537: What do we do here
mod_log_sql.c:787: Make these configurable?
mod_log_sql-1.100/LICENSE 0000644 0001750 0001750 00000011605 10171046152 014761 0 ustar zigo zigo 0000000 0000000
Copyright (c) 2004 Edward M. Rudd. All rights reserved.
Copyright (c) 2002 Christopher B. Powell. All rights reserved.
Portions copyright (c) 2000 The Apache Software Foundation.
Preamble
The intent of this document is to state the conditions under which a
Package may be copied, such that the Copyright Holder maintains some
semblance of artistic control over the development of the package,
while giving the users of the package the right to use and distribute
the Package in a more-or-less customary fashion, plus the right to make
reasonable modifications.
Definitions:
* "Package" refers to the collection of files distributed by the
Copyright Holder, and derivatives of that collection of files created
through textual modification.
* "Standard Version" refers to such a Package if it has not been
modified, or has been modified in accordance with the wishes of the
Copyright Holder.
* "Copyright Holder" is Christopher B. Powell, .
* "You" is you, if you're thinking about copying or distributing this
Package.
* "Reasonable copying fee" is whatever you can justify on the basis of
media cost, duplication charges, time of people involved, and so on.
(You will not be required to justify it to the Copyright Holder, but
only to the computing community at large as a market that must bear the
fee.)
* "Freely Available" means that no fee is charged for the item itself,
though there may be fees involved in handling the item. It also means
that recipients of the item may redistribute it under the same
conditions they received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated
disclaimers.
2. You may apply bug fixes, portability fixes and other modifications
derived from the Public Domain or from the Copyright Holder. A Package
modified in such a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way,
provided that you insert a prominent notice in each changed file
stating how and when you changed that file, and provided that you do at
least ONE of the following:
a) place your modifications in the Public Domain or otherwise make
them Freely Available, such as by posting said modifications to
Usenet or an equivalent medium, or placing the modifications on a
major archive site such as ftp.uu.net, or by allowing the
Copyright Holder to include your modifications in the Standard
Version of the Package.
b) use the modified Package only within your corporation or
organization.
c) rename any non-standard executables so the names do not
conflict with standard executables, which must also be provided,
and provide a separate manual page for each non-standard
executable that clearly documents how it differs from the Standard
Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or
executable form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library
files, together with instructions (in the manual page or
equivalent) on where to get the Standard Version.
b) accompany the distribution with the machine-readable source of
the Package with your modifications.
c) accompany any non-standard executables with their corresponding
Standard Version executables, giving the non-standard executables
non-standard names, and clearly documenting the differences in
manual pages (or equivalent), together with instructions on where
to get the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this Package.
You may not charge a fee for this Package itself. However, you may
distribute this Package in aggregate with other (possibly commercial)
programs as part of a larger (possibly commercial) software
distribution provided that you do not advertise this Package as a
product of your own.
6. The scripts and library files supplied as input to or produced as
output from the programs of this Package do not automatically fall
under the copyright of this Package, but belong to whomever generated
them, and may be sold commercially, and may be aggregated with this
Package.
7. C or perl subroutines supplied by you and linked into this Package
shall not be considered part of this Package.
8. The name of the Copyright Holder may not be used to endorse or
promote products derived from this software without specific prior
written permission.
9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End
mod_log_sql-1.100/CHANGELOG 0000644 0001750 0001750 00000050353 10171047633 015176 0 ustar zigo zigo 0000000 0000000 1.100: 2005-01-11
* fixes for NULL fields (empty request_args)
* fixed a mysql reconnect bug
* wrong hostname was logged when using mass virtual hosting
Use, the new 'V' logformat
* formatted massvirutalhosting tables to swap - with _.
* included winconfig.h in makefile
* fixed quoting of unique_id
* converted documentation to OOO Docbook ( a subset of the full docbook DTD)
1.99: 2004-07-28
* Added DBI support (not completed yet)
* fixed segfault in the mysql driver escape_string function
* fixed segfault when forcepreserve is set on.
* switched escape_string driver function to include the string quotes.
* On Database connection failure Database errors are printed at ERR loglevel
instead of debug
* included build-apache(13|2).bat scripts in the distribution
1.98: 2004-05-12
* re-fixed apache.m4 to better detect APR and APU code
* fixed for win32 compilation under apache 2
* lowered minumum required apache 2 version to 2.0.40 (RH9)
* Added LogSQLDisablePreserve to disable the preserve file.
* Changed default preserve file location to logs/mod_log_sql-preserve
And made LogSQLPreserveFile root relative.
* fixed bug where preserve file wouldn't be created in apache 2
* finished TransferLog documentation
* changed strstr to ap_strstr calls and strchr to ap_strchr calls to
stop warning when compiling with AP_DEBUG enabled in apache 2
* Updated apache m4 to not pass for apache 1.3 if apache 2 is found
1.97: 2004-04-08
* fixed apache.m4 to work with apache 2 setups with different include
directories for APR and APU then core Apache
* cleaned up configuration documentation (updated due to deprecated commands)
* LogSQLLoginInfo updated to support a connection URI
* new module "registration" macros to clean up new driver modules
* mysql driver completely separted from core module
1.96: 2004-03-04
* fixed LogSQLPreserveFile config parameter
* reworked safe_create_tables and core SQL insert routine.
* renamed log_sql_* variables and typedefs to logsql_*
* separated all mysql specific code to separate code module (DB abstraction)
* separated TODO from Changelog
* fixed default value of socket file. it's really /var/lib/mysql/mysql.sock not
/tmp/mysql.sock
* Documentation completely converted to Docbook
* Documentation updated. (still needs more work done)
* LogSQLDelayedInserts config option removed
* Added DB generic LogSQLDBParam. Usage is LogSQLDBParam param value
example: LogSQLDBParam tcpport 12345
* notes, cookes, headersin, headersout tables are no longer created unless they
are used.
1.95: 2004-02-05
* audit and update of extract_* functions to acheive same output as
mod_log_config.
1.94: 2004-02-03
* ssl loggin back in as separate module under 1.3 and 2.0
* preparsing of format tags is now done to speed up main logging loop.
* fixed a nasty bug with pointer arithmetic (ick) that caused a segfault with
LogSQLWhichCookies
1.93: 2004-01-20
* Compiles for apache 1.3 AND 2.0
* split apache version specific functions to seperate header files
* split apache version specific includes to seperate header files
* added wrapper defines for apache 1.3
* updated configure m4 scripts to detect both apache versions at the same time
and assign defines as to which version was found.
* made install default to not activate module in configuration files.
use make activate instead
* split SSL logging to separate module (still needs to be finished)
1.92: 2004-01-05
* fixed compilation issue with mysql 4.x where mysql_error returns const char *
* Have SSL support compiling (though not really tested)
* updated configure macros to detect mod_ssl.h
* configure now uses --with-apxs instead of --with-apache
* Added documentation from 1.19b (needs to be update)
* Fixed an issue with dependencies in Makefile.in
1.91: 2003-12-23
* Added checks for MySQL to autoconf
* fixed merge code to work correctly.
* Merged in 1.19b1 changes
* Hostnames are now converted to lowercase in the mass-virtual naming section.
The loop that converts dots to underscores has been optimized as well.
* New directive LogSQLTableType allows one to specify the kind of table that
the module makes during table creation (e.g. InnoDB, MyISAM). Thanks to Jim
Turner for the suggestion and patch. If your MySQL server does not support
the specified type, it will create a MyISAM table instead.
* Directives can now be placed in the 'main' server config and will be
inherited by the virtual hosts. This means a LOT less repetition: you only
specify the item once to have it inherited, but it can still be overridden
on a virtualhost level. These can be specified in this manner:
LogSQLTransferLogTable
LogSQLTransferLogFormat
LogSQLPreserveFile
LogSQLNotesLogTable
LogSQLHeadersInLogTable
LogSQLHeadersOutLogTable
LogSQLCookieLogTable
LogSQLRemhostIgnore
LogSQLRequestIgnore
LogSQLRequestAccept
LogSQLWhichNotes
LogSQLWhichHeadersOut
LogSQLWhichHeadersIn
LogSQLWhichCookies
LogSQLWhichCookie
1.90: 2003-12-22
* updated code to compile under apache 2.0
* rewrote and consolidate configuration handler routines
* made all functions static.
* made delayed insert configurable, instead of compile time
* moved to my autoconfigure support
1.18:
* Delayed inserts (a MySQL extension) are now available at compile-time.
THIS IS UGLY because there seems to be a bug in the way MySQL returns
errors on failed INSERT DELAYED queries. See the FAQ.
* Reworked the Makefile a tad.
* Added stdlib.h to the includes, some systems need it for atoi(). Added
string.h to the includes just to be safe.
* Reworked table creation (again). Inserts are attempted and tables
are made only on ER_NO_SUCH_TABLE. This should solve all the multiple-
creation-attempt issues as well as reduce overhead.
* safe_mysql_query reworked; it now can be counted on to preserve_entry()
if the query doesn't succeed. [Before, preserve_entry() was called
separately.]
* Always reset SIGPIPE to handler before leaving safe_mysql_query().
* New directive LogSQLRequestAccept, another filter for excluding things
from being logged.
* Alphabetized the directives in the reference section of the docs.
* New format char 'a' lets one log the request arguments, i.e. the
part of a CGI request after the ? character. Also put a column for
this in the create_tables.sql file. Thanks to Dave Wilson for this.
* Reorganized the FAQ by section.
* Renamed global variables (e.g. tcp_port -> logsql_tcpport) throughout
the code in order to ensure against naming conflicts. tcp_port, in
particular, seemed to be causing problems / segfaults on certain systems.
* Renamed safe_mysql_query() to safe_sql_query().
* Now check for minimum configuration info to establish db link and
log an error if it's insufficient.
1.17:
* Renamed the module mod_log_sql to conform to the project goal of
database-inspecificity.
* Added capability of logging Notes field. This is useful for folks using
custom modules that provide loggable info in the notes, e.g. mod_gzip.
A new directive LogSQLWhichNotes configures which notes to log to the
notes_log table.
* Added capability of logging inbound and outbound headers. New directives
LogSQLWhichHeadersIn and LogSQLWhichHeadersOut configure which headers to
capture. Headers are stored in their own table or tables.
* Fixed potential segfault in preserve file function due to silly pfclose
placement. (Only affected user if the preserve file couldn't
be opened.)
* Changed default socket file to /tmp/mysql.sock because that's the
default on a compiled MySQL.
* Put back-quotes (`) around table name so that names with dashes are
legal.
* Took away the prepend of /tmp to the preserve filename. Now the
user can specify whatever local path they want. I figure that
filesystem permissions will prevent people from doing anything
really dumb, and people have requested this change.
* Better checking in the extract_cookie routine. Before, it could
segfault if a person specified "c" but didn't define MySQLWhichCookie.
* Some code reorg/renaming for clarity and to support the new direction
of database inspecificity. More to come.
* Simplified error messages.
* Table creation now uses safe_mysql_query and checks the result.
* Config directives used to begin with MySQL, now begin with LogSQL.
This is for database inspecificity. In your httpd.conf just do
a search-and-replace.
* More robust table-creation code with error checking. [The race condition
that several users have reported may still exist, but this will go a long
way toward debugging the condition.]
* Fixed bug whereby a MySQL connection was abandoned on reopen; the old
connection is now properly closed first.
* Minor: remind user not to set createtables when massvirtual is on.
* If Apache started but MySQL was unavailable, the module would do
everything it was supposed to (preserve entries, etc.) but not notify
the sysadmin. Added a log message to alert sysadmin if MySQL is
unreachable at startup.
* New config key 'I' to extract & log unique_id, provided by mod_unique_id.
unique_id is the key that links separate tables (access, notes, etc.)
* Migrated to the Artistic License (as used by Perl).
* Moved table creation into its own callable function
* Robustifying table creation
* In make_combined_log.pl, backtick-quoted the table name and added an
order-by clause within the select statement.
* TCP port number for db connection is now configurable using LogSqlTCPPort
* New directive LogSQLForcePreserve sends all log entries directly to the
preserve file and *entirely bypasses* the db. Useful for debugging, but
can be dangerous if you forget it's set!
* Table names are now quoted in all cases with backticks in order to permit
names containing dashes (since many hostnames contain dashes).
* The request_method field is now created as a varchar(10) instead of (6),
after it was pointed out to me that some methods can be longer than 6.
* New directive LogSQLMachineID sets a string identifier for the webserver
machine. This is useful if you have a cluster of many webservers and you
want to differentiate between them in the logs: you can tell which log
entries came from each machine and thereby analyze your loadbalacing
performance. Activate with the TransferLogFormat character 'M'. Much
faster than doing some sort of wacky IP addr lookup via local_addr().
* Added an alternative way of logging cookies. If you need to associate
multiple cookies with each request, the new way involves using
LogSQLWhichCookies (note the plural) and LogSQLCookieLogTable.
* Removed LogSQLRefererIgnore references, since it was never actually
activated anyway and the idea probably was of minimal value.
1.16:
* Moved all the user DEFINEs inside the .c file -- splitting them
between the C and the Makefile was getting just too cumbersome.
* A new MySQLPreserveFile runtime config directive. In the last
version the name of the preserve-file was hardcoded and therefore
global across all Apache virtual servers. Now the user can configure
this on a per-virthost basis. It defaults to a hardcoded value
if the user does not define it. The module *always* prepends /tmp/
to the user-supplied value for security reasons.
* A new MySQLSocketFile runtime config directive. In the last
version the name of the MySQL socket was hardcoded. Now the user
can configure this at Apache runtime. However, it is a global
setting (set once) just like the rest of the actual database info is.
It defaults to a hardcoded value if the user does not define it.
* A new MySQLCreateTables runtime config directive. Module can now
create the access table on-the-fly. Table creation takes place
during the virtual server's first request and is flagged after that to
avoid repetition.
* A new MySQLMassVirtualHosting runtime config directive. This flag
currently only activates a single feature: each virtual server gets
its very own dynamically-determined table prefixed 'access_' with the
server's name following. It also implies MySQLCreateTables On, and
obviates the need for MySQLTransferLogTable.
* escape_query (was mysql_escape_log) is now called on every item
rather than first checking to see if it needs to be called, which
was probably a big waste of time. Furthermore the routine now
uses a native MySQL API call to do the escaping instead of doing
this 'manually.' It attempts to use the charset-respectful MySQL
call first, but falls back on a more generic call if the MySQL
server is unavailable (e.g. if it goes offline).
* Open preserve file with pfopen instead of regular fopen to
take advantage of pool structure.
* As forewarned, I finally got rid of the code to support separate
Referer and Agent logs.
* Finally brought the make process up-to-date with the way Apache
likes modules to be done.
* MySQLWhichCookie is now configurable on a per-virtualserver basis.
Before it was single-shot global only.
* Reduced sleep time on a retry to 1/4 second from 1/2 second.
* Confirmed that this module will compile with -pedantic ... but not
with -ansi. :-)
1.15:
* Vastly improved error reporting is a lot clearer about lost db
connections, etc. Some unreachable code has been corrected.
* The way that query-retries and openlink-retries are handled has
been tweaked and improved.
* Missed database entries are now preserved for later inclusion. This
file is not held open but is closed after each use, so it's safe
to delete while Apache is running.
* Now each child instantiates its MySQL link upon birth rather than
waiting for its first request.
1.14:
* Improved the apxs instructions based on user feedback, including the
mysql.sock define issue.
* Corrected the INSTALL example directives to the new format.
* Some improvements to 'make distro'
1.13:
* Now use ap_get_server_name() in extract_virtual_host() to fix the
instances where mass-virtual-hosting sites were getting the wrong
server-name written to the log.
* Now use mysql_real_connect() instead of mysql_connect(). The
latter's use was deprecated and did not work in MySQL 4.
* There is now a DEFINE for the socket name. This is used by the
mysql_real_connect() function and is relevant only if the db resides
on localhost. It is irrelevant if the db resides on a networked
machine and is ignored in that case (although it still must be defined
for the connect to work).
1.12:
* Added a mysql_close() call to get rid of those annoying MySQL
complaints every time an httpd child process terminates. (Apache
1.3 or later.)
* Considerable code reorganization and cleanup.
1.11:
* Completely re-worked the cookie code. Now the user can instruct
mod_log_mysql which cookie (out of many available) to log. (See
the online directives documentation and FAQ.)
* New config capability: 'H' to log the request protocol
(e.g. HTTP/1.1)
* New config capability: 'm' to log the request method
(e.g. GET, PUT, etc.)
* New config capabilities: 'z' 'q' & 'Q' to log SSL_CIPHER,
SSL_CIPHER_USEKEYSIZE and SSL_CIPHER_ALGKEYSIZE. These require
openssl and glibc-devel to be installed. (See the online
directives documentation and FAQ.)
* Fixed a bug in make_combined_log.pl that caused it to generate
incorrect output on single-digit days.
* Fixed make_combined_log.pl to use the data logged by 'H' and 'm'.
* Migrated all log_error calls to the newer ap_log_error call.
* Added a DEBUG define to activate certain debugging/informational
error-log messages (for devel purposes).
* I apologize for the inconvenience this may cause: I decided to
rename the runtime configuration directives so that they would
make more sense and group together with a "MySQL" prefix. They
are now:
MySQLRefererLogTable
The MySQL table that holds the referer log
MySQLAgentLogTable
The MySQL table that holds the agent log
MySQLTransferLogTable
The MySQL table that holds the transfer log
MySQLTransferLogFormat
Instruct the module what information to log to the MySQL transfer log
MySQLRefererIgnore
List of referers to ignore, accesses that match will not be logged to
MySQL
MySQLRequestIgnore
List of URIs to ignore, accesses that match will not be logged to MySQL
MySQLRemhostIgnore
List of remote hosts to ignore, accesses that match will not be logged
to MySQL
MySQLDatabase
The name of the MySQL database for logging
MySQLWhichCookie
The CookieName that you want logged when using the 'c' config directive
MySQLLoginInfo
The MySQL host, user-id and password for logging
You'll need to just do a search-and-replace in your httpd.conf...
Again, I'm sorry, but it really is better this way.
* Cleaned up the summaries that get output on "httpd -L"
* Expanded the enclosed access_log.sql file to support every column type
that mod_log_mysql provides -- delete the ones that you don't need.
* Some cleanup of the Makefile - pay attention to the settings
* Made the MySQLTransferLogFormat default "AbHhmRSsTUuv" to incorporate the
new column types and sort the characters alphabetically for reading ease.
1.10:
* New config directive/capability: 'c' to log mod_usertrack cookies.
* Some code cleanup and commenting.
* Referer and User-Agent now set to want_orig=1 ( a very minor detail )
* Corrected mysql_escape_log to properly check for and escape strings
with `dangerous' characters. It appears that it was doing this
incorrectly before.
* Deleted log_mysql_child(), a function that was never called.
1.09:
* If the MySQL INSERT causes an error, we re-try that INSERT after
a short 1/2-second sleep just to make sure it wasn't due to a
network glitch or other gremlin.
* Made the default log format: huSUsbTvRA. This provides everything
required to reproduce Combined Log Format data.
1.08:
* Now log a single '-' (instead of a zero-length string) when
User-Agent is blank. This is similar to what Apache does in its own
logs. (Should have caught this when I did the same thing for
Referer.)
* Separated documentation into README, INSTALL, CHANGELOG, etc. as
appropriate.
1.07:
* Renamed TransferIgnore directive to RequestIgnore, since that's
really a more specific and accurate description of what that
directive means.
* Now log a single '-' (instead of a zero-length string) when Referer
is blank. This is similar to what Apache does in its own logs.
1.06:
* Added 'R' and 'A' options to TransferLogMySQLFormat so that we now
can log Referer and Agent respectively.
* Code cleanup: all compilation warnings are now gone, even with -Wall.
(They were mainly "const" issues that needed straightening up.)
* Added RemhostIgnore configuration directive to permit non-logging of
any request coming from a specific host, e.g. a local network
machine, etc.
* Now use the non-obsolete ap_compat.h headerfile instead of
compat.h. This simply gets rid of a compilation warning, nothing
more.
* Now include a headerfile (http_log.h) that was missing. Its
absence was giving us this warning message: "implicit declaration of
function `ap_log_error_old'."
* For numerics that Apache customarily logs as a "-" we now log a zero
instead of a -1. This seems to be more intuitive, e.g. in the
"bytes_sent" column.
* We now have a Makefile and a full "make" process that does all
the real work.
* New maintainer.
1.05:
* Removed some redundant code, after being noted by Vivek Khera that
this code doesn't even get called with the current apache code. It
can be done in apache 1.3, but it works ok without it anyway.
* Added the necessary include file to make the module compile under
Apache 1.3b6. I haven't actually tested that it works, though.
indent'd the code.
1.04:
* Rearranged some code to allow for a successful apache 1.3beta
compilation. Please note that this is *untested*, I only got it to
compile, I haven't actually tried to run apache 1.3.
1.03:
* Changed the check for 'mysql server has gone away' to be case
insensitive, so that it works with MySQL 3.21
* Changed the behavior so that a link isn't established until it's
necessary (e.g., if SQL logging is used for one virtual IP, a link
won't be opened until there's an access to that IP).
1.02:
* Managed to track down that segmentation fault that occured once, and
fixed it. No known bugs now exist.
1.01:
* Segmentation fault in case of certain parameters lacking fixed.
* Worked around the SIGPIPE signal that's sent in certain events from
* mysql_query(). Minor modifications
mod_log_sql-1.100/build-apache13.bat 0000644 0001750 0001750 00000003300 10044305635 017122 0 ustar zigo zigo 0000000 0000000 @echo off
cls
rem path to Microsoft SDK installation
SET DIR_MSSDK=C:\Program Files\Microsoft SDK
rem path to apache2 installation
SET DIR_APACHE=C:\Program Files\Apache Group\Apache
rem path to mysql 4.0 installation
SET DIR_MYSQL=C:\MySQL
rem Can be set to opt or debug
SET LIB_MYSQL=opt
copy /Y winconfig.h config.h
mkdir Release
cd Release
Rem Compile all the source code
echo /MD /W3 /Zi /Ze /O2 > RESP_c.txt
echo /DNDEBUG /D_WINDOWS /DWIN32 >> RESP_c.txt
echo /Fd"mod_log_sql" /FD >> RESP_c.txt
echo /DHAVE_CONFIG_H /DWITH_APACHE13 /DLOGSQL_DECLARE_EXPORT >> RESP_c.txt
echo /DSHARED_MODULE >> RESP_c.txt
echo /I.. >> RESP_c.txt
echo /I"%DIR_MSSDK%\Include" >> RESP_c.txt
echo /I"%DIR_APACHE%\Include" >> RESP_c.txt
echo /I"%DIR_MYSQL%\Include" >> RESP_c.txt
cl @RESP_c.txt /c ..\mod_log_sql.c ..\mod_log_sql_mysql.c
rem link main module
echo /MACHINE:I386 /SUBSYSTEM:windows > RESP_l.txt
echo /OUT:mod_log_sql.so /DLL /OPT:REF /DEBUG >> RESP_l.txt
echo /LIBPATH:"%DIR_APACHE%\lib" >> RESP_l.txt
echo /LIBPATH:"%DIR_APACHE%\libexec" >> RESP_l.txt
echo /LIBPATH:"%DIR_MSSDK%\lib" >> RESP_l.txt
echo ApacheCore.lib >> RESP_l.txt
link @RESP_l.txt mod_log_sql.obj
rem link mysql module
echo /MACHINE:I386 /SUBSYSTEM:windows > RESP_l.txt
echo /OUT:mod_log_sql_mysql.so /DLL /OPT:REF /DEBUG >> RESP_l.txt
echo /LIBPATH:"%DIR_APACHE%\lib" >> RESP_l.txt
echo /LIBPATH:"%DIR_APACHE%\libexec" >> RESP_l.txt
echo /LIBPATH:"%DIR_MYSQL%\lib\%LIB_MYSQL%" >> RESP_l.txt
echo /LIBPATH:"%DIR_MSSDK%\lib" >> RESP_l.txt
echo /NODEFAULTLIB:LIBCMT.lib >> RESP_l.txt
echo ApacheCore.lib >> RESP_l.txt
echo libmysql.lib mod_log_sql.lib >> RESP_l.txt
link @RESP_l.txt mod_log_sql_mysql.obj
cd ..
mod_log_sql-1.100/build-apache2.bat 0000644 0001750 0001750 00000004347 10123442622 017050 0 ustar zigo zigo 0000000 0000000 @echo off
rem path to Microsoft SDK installation
SET DIR_MSSDK=C:\Program Files\Microsoft SDK
rem path to apache2 installation
SET DIR_APACHE=C:\Program Files\Apache Group\Apache2
rem path to mysql 4.0 installation
SET DIR_MYSQL=C:\MySQL
rem Can be set to opt or debug
SET LIB_MYSQL=opt
rem path to OpenSSL installation
SET DIR_OPENSSL=C:\OpenSSL
rem Should be set to VC
SET LIB_OPENSSL=VC
copy /Y winconfig.h config.h
mkdir Release
cd Release
Rem Compile all the source code
echo /MD /W3 /Zi /O2 /DNDEBUG /D_WINDOWS /DWIN32 > RESP_c.txt
echo /Fd"mod_log_sql" /FD >> RESP_c.txt
echo /DHAVE_CONFIG_H /DWITH_APACHE20 /DLOGSQL_DECLARE_EXPORT >> RESP_c.txt
echo /I.. >> RESP_c.txt
echo /I"%DIR_MSSDK%\Include" >> RESP_c.txt
echo /I"%DIR_APACHE%\Include" >> RESP_c.txt
echo /I"%DIR_MYSQL%\Include" >> RESP_c.txt
echo /I"%DIR_OPENSSL%\Include" >> RESP_c.txt
echo /I"%DIR_OPENSSL%\Include\openssl" >> RESP_c.txt
cl @RESP_c.txt /c ..\mod_log_sql.c ..\mod_log_sql_mysql.c
if not exist "%DIR_APACHE%\Include\mod_ssl.h" goto nossl
cl @RESP_C.txt /c ..\mod_log_sql_ssl.c
:nossl
rem link main module
echo /MACHINE:I386 /SUBSYSTEM:windows > RESP_l.txt
echo /OUT:mod_log_sql.so /DLL /OPT:REF /DEBUG >> RESP_l.txt
echo /LIBPATH:"%DIR_APACHE%\lib" >> RESP_l.txt
echo libapr.lib libaprutil.lib libhttpd.lib >> RESP_l.txt
link @RESP_l.txt mod_log_sql.obj
rem link mysql module
echo /MACHINE:I386 /SUBSYSTEM:windows > RESP_l.txt
echo /OUT:mod_log_sql_mysql.so /DLL /OPT:REF /DEBUG >> RESP_l.txt
echo /LIBPATH:"%DIR_APACHE%\lib" >> RESP_l.txt
echo /LIBPATH:"%DIR_MYSQL%\lib\%LIB_MYSQL%" >> RESP_l.txt
echo /NODEFAULTLIB:LIBCMT.lib >> RESP_l.txt
echo libapr.lib libaprutil.lib libhttpd.lib >> RESP_l.txt
echo libmysql.lib mod_log_sql.lib >> RESP_l.txt
link @RESP_l.txt mod_log_sql_mysql.obj
if not exist "%DIR_APACHE%\Include\mod_ssl.h" goto done
rem link ssl module
echo /MACHINE:I386 /SUBSYSTEM:windows > RESP_l.txt
echo /OUT:mod_log_sql_ssl.so /DLL /OPT:REF /DEBUG >> RESP_l.txt
echo /LIBPATH:"%DIR_APACHE%\lib" >> RESP_l.txt
echo /LIBPATH:"%DIR_OPENSSL%\lib\%LIB_OPENSSL%" >> RESP_l.txt
echo libapr.lib libaprutil.lib libhttpd.lib >> RESP_l.txt
echo mod_log_sql.lib >> RESP_l.txt
link @RESP_l.txt mod_log_sql_ssl.obj
:done
cd ..
mod_log_sql-1.100/mod_log_sql.c 0000644 0001750 0001750 00000132074 10171046475 016433 0 ustar zigo zigo 0000000 0000000 /* $Id: mod_log_sql.c 158 2005-01-11 21:05:34Z urkle@drip.ws $ */
#if defined(WITH_APACHE20)
# include "apache20.h"
#elif defined(WITH_APACHE13)
# include "apache13.h"
#else
# error Unsupported Apache version
#endif
#ifdef HAVE_CONFIG_H
/* Undefine these to prevent conflicts between Apache ap_config_auto.h and
* my config.h. Only really needed for Apache < 2.0.48, but it can't hurt.
*/
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include "config.h"
#endif
#if APR_HAVE_UNISTD_H
#include
#endif
#ifdef HAVE_LIMITS_H
#include
#endif
#include "mod_log_sql.h"
/* Configuratino Defaults */
#define DEFAULT_TRANSFER_LOG_FMT "AbHhmRSsTUuv"
#define DEFAULT_NOTES_TABLE_NAME "notes"
#define DEFAULT_HIN_TABLE_NAME "headers_in"
#define DEFAULT_HOUT_TABLE_NAME "headers_out"
#define DEFAULT_COOKIE_TABLE_NAME "cookies"
#define DEFAULT_PRESERVE_FILE "logs/mod_log_sql-preserve"
/* -------------*
* DECLARATIONS *
* -------------*/
/* Declare ourselves so the configuration routines can find and know us. */
module AP_MODULE_DECLARE_DATA log_sql_module;
/* The contents of these are known 'Apache wide' and are not variable
* on a per-virtual-server basis. Every virtual server 'knows' the
* same versions of these variables.
*/
typedef struct {
int massvirtual;
int createtables;
int forcepreserve;
int disablepreserve;
char *machid;
int announce;
logsql_dbconnection db;
logsql_dbdriver *driver;
} global_config_t;
static global_config_t global_config;
/* structure to hold helper function info */
typedef struct {
char key; /* item letter character */
logsql_item_func *func; /* its extraction function */
const char *sql_field_name; /* its column in SQL */
int want_orig_default; /* if it requires the original request prior to internal redirection */
int string_contents; /* if it returns a string */
} logsql_item;
/* But the contents of this structure will vary by virtual server.
* This permits each virtual server to vary its configuration slightly
* for per-server customization.
*
* Each child process has its own segregated copy of this structure.
*/
typedef struct {
apr_array_header_t *transfer_ignore_list;
apr_array_header_t *transfer_accept_list;
apr_array_header_t *remhost_ignore_list;
apr_array_header_t *notes_list;
apr_array_header_t *hout_list;
apr_array_header_t *hin_list;
apr_array_header_t *cookie_list;
const char *notes_table_name;
const char *hout_table_name;
const char *hin_table_name;
const char *cookie_table_name;
const char *transfer_table_name;
const char *transfer_log_format;
apr_pool_t *parsed_pool;
logsql_item **parsed_log_format;
const char *preserve_file;
const char *cookie_name;
} logsql_state;
/* list of "handlers" for log types */
static apr_array_header_t *logsql_item_list;
/* Registration function for extract functions *
* and update parse cache for transfer_log_format *
* this is exported from the module */
LOGSQL_DECLARE(void) log_sql_register_item(server_rec *s, apr_pool_t *p,
char key, logsql_item_func *func, const char *sql_field_name,
int want_orig_default, int string_contents)
{
server_rec *ts;
logsql_item *item;
if (!logsql_item_list)
logsql_item_list = apr_array_make(p,10, sizeof(logsql_item));
item= apr_array_push(logsql_item_list);
item->key = key;
item->func = func;
item->sql_field_name = sql_field_name;
item->want_orig_default = want_orig_default;
item->string_contents = string_contents;
/* some voodoo here to post parse logitems in all servers *
* so a "cached" list is used in the main logging loop for speed */
for (ts = s; ts; ts = ts->next) {
logsql_state *cfg = ap_get_module_config(ts->module_config,
&log_sql_module);
char *pos;
if (cfg->transfer_log_format) {
if ( (pos = ap_strchr_c(cfg->transfer_log_format,key))!=NULL) {
cfg->parsed_log_format[pos - cfg->transfer_log_format] = item;
}
}
}
}
/* Registration function for database drivers */
LOGSQL_DECLARE(void) log_sql_register_driver(apr_pool_t *p,
logsql_dbdriver *driver)
{
global_config.driver = driver;
}
/* Include all the core extract functions */
#include "functions.h"
#if defined(WITH_APACHE13)
# include "functions13.h"
#elif defined(WITH_APACHE20)
# include "functions20.h"
#endif
static logsql_opendb_ret log_sql_opendb_link(server_rec* s)
{
logsql_opendb_ret result;
if (global_config.forcepreserve) {
//global_config.db.connected = 1;
return LOGSQL_OPENDB_PRESERVE;
}
if (global_config.db.connected) {
return LOGSQL_OPENDB_ALREADY;
}
/* database
host
user
passwd
*/
if (global_config.db.parms) {
result = global_config.driver->connect(s, &global_config.db);
if (result==LOGSQL_OPENDB_FAIL) {
global_config.db.connected = 0;
} else {
global_config.db.connected = 1;
}
return result;
} else {
log_error(APLOG_MARK, APLOG_ERR, 0, s,
"mod_log_sql: insufficient configuration info to establish database link");
return LOGSQL_OPENDB_FAIL;
}
}
static void preserve_entry(request_rec *r, const char *query)
{
logsql_state *cls = ap_get_module_config(r->server->module_config,
&log_sql_module);
#if defined(WITH_APACHE20)
apr_file_t *fp;
apr_status_t result;
#elif defined(WITH_APACHE13)
FILE *fp;
int result;
#endif
/* If preserve file is disabled bail out */
if (global_config.disablepreserve)
return;
#if defined(WITH_APACHE20)
result = apr_file_open(&fp, cls->preserve_file,APR_APPEND | APR_WRITE | APR_CREATE, APR_OS_DEFAULT, r->pool);
#elif defined(WITH_APACHE13)
fp = ap_pfopen(r->pool, cls->preserve_file, "a");
result = (fp)?0:errno;
#endif
if (result != APR_SUCCESS) {
log_error(APLOG_MARK, APLOG_ERR, result, r->server,
"attempted append of local preserve file '%s' but failed.",cls->preserve_file);
} else {
#if defined(WITH_APACHE20)
apr_file_printf(fp,"%s;\n", query);
apr_file_close(fp);
#elif defined(WITH_APACHE13)
fprintf(fp,"%s;\n", query);
ap_pfclose(r->pool, fp);
#endif
log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"mod_log_sql: entry preserved in %s", cls->preserve_file);
}
}
/* ------------------------------------------------*
* Command handlers that are called according *
* to the directives found at Apache runtime. *
* ------------------------------------------------*/
static const char *set_global_flag_slot(cmd_parms *cmd,
void *struct_ptr,
int flag)
{
void *ptr = &global_config;
int offset = (int)(long)cmd->info;
*(int *)((char *)ptr + offset) = flag ? 1 : 0;
return NULL;
}
static const char *set_global_nmv_flag_slot(cmd_parms *cmd,
void *struct_ptr,
int flag)
{
if (global_config.massvirtual) {
return apr_psprintf(cmd->pool,
"mod_log_sql: do not set %s when LogSQLMassVirtualHosting(%d) is On.%d:%d",
cmd->cmd->name, global_config.massvirtual,
(int)(long)&global_config, (int)(long)struct_ptr);
} else {
return set_global_flag_slot(cmd,struct_ptr,flag);
}
}
static const char *set_global_string_slot(cmd_parms *cmd,
void *struct_ptr,
const char *arg)
{
void *ptr = &global_config;
int offset = (int)(long)cmd->info;
*(const char **)((char *)ptr + offset) = apr_pstrdup(cmd->pool,arg);
return NULL;
}
static const char *set_server_string_slot(cmd_parms *cmd,
void *struct_ptr,
const char *arg)
{
void *ptr = ap_get_module_config(cmd->server->module_config,
&log_sql_module);
int offset = (int)(long)cmd->info;
*(const char **)((char *)ptr + offset) = arg;
return NULL;
}
static const char *set_server_file_slot(cmd_parms *cmd,
void *struct_ptr,
const char *arg)
{
void *ptr = ap_get_module_config(cmd->server->module_config,
&log_sql_module);
int offset = (int)(long)cmd->info;
const char *path;
path = ap_server_root_relative(cmd->pool, (char *)arg);
if (!path) {
return apr_pstrcat(cmd->pool, "Invalid file path ",
arg, NULL);
}
*(const char **)((char*)ptr + offset) = path;
return NULL;
}
static const char *set_logformat_slot(cmd_parms *cmd,
void *struct_ptr,
const char *arg)
{
logsql_state *cfg = ap_get_module_config(cmd->server->module_config,
&log_sql_module);
cfg->transfer_log_format = arg;
/* apr_pool_clear(cfg->parsed_pool);*/
cfg->parsed_log_format = apr_pcalloc(cfg->parsed_pool,
strlen(arg) * sizeof(logsql_item *));
return NULL;
}
static const char *set_server_nmv_string_slot(cmd_parms *parms,
void *struct_ptr,
const char *arg)
{
if (global_config.massvirtual)
return apr_psprintf(parms->pool,
"mod_log_sql: do not set %s when LogSQLMassVirtualHosting is On.",
parms->cmd->name);
else
return set_server_string_slot(parms,struct_ptr,arg);
}
/* Set a DB connection parameter */
static const char *set_dbparam(cmd_parms *cmd,
void *struct_ptr,
const char *key,
const char *val)
{
if (!global_config.db.parms) {
global_config.db.parms = apr_table_make(cmd->pool,5);
}
apr_table_set(global_config.db.parms,key,val);
return NULL;
}
static const char *set_dbparam_slot(cmd_parms *cmd,
void *struct_ptr,
const char *arg)
{
const char *param = (char *)cmd->info;
set_dbparam(cmd,NULL,param,arg);
return NULL;
}
/* Sets basic connection info */
static const char *set_log_sql_info(cmd_parms *cmd, void *dummy,
const char *host, const char *user, const char *pwd)
{
if (!user) { /* user is null, so only one arg passed */
/* TODO: to more error checking/force all params to be set */
apr_uri_t uri;
apr_uri_parse(cmd->pool, host, &uri);
if (uri.scheme) {
set_dbparam(cmd, NULL, "driver", uri.scheme);
}
if (uri.hostname) {
set_dbparam(cmd, NULL, "hostname", uri.hostname);
}
if (uri.user) {
set_dbparam(cmd, NULL, "username", uri.user);
}
if (uri.password) {
set_dbparam(cmd, NULL, "password", uri.password);
}
if (uri.port_str) {
set_dbparam(cmd, NULL, "port", uri.port_str);
}
if (uri.path) {
/* extract Database name */
char *off = ap_strchr(++uri.path,'/');
if (off)
*off='\0';
set_dbparam(cmd, NULL, "database", uri.path);
}
} else {
if (*host != '.') {
set_dbparam(cmd, NULL, "hostname", host);
}
if (*user != '.') {
set_dbparam(cmd, NULL, "username", user);
}
if (*pwd != '.') {
set_dbparam(cmd, NULL, "password", pwd);
}
}
return NULL;
}
static const char *add_server_string_slot(cmd_parms *cmd,
void *struct_ptr,
const char *arg)
{
char **addme;
void *ptr = ap_get_module_config(cmd->server->module_config,
&log_sql_module);
int offset = (int)(long)cmd->info;
apr_array_header_t *ary = *(apr_array_header_t **)((char *)ptr + offset);
addme = apr_array_push(ary);
*addme = apr_pstrdup(ary->pool, arg);
return NULL;
}
/*------------------------------------------------------------*
* Apache-specific hooks into the module code *
* that are defined in the array 'mysql_lgog_module' (at EOF) *
*------------------------------------------------------------*/
/* Closing mysql link: child_exit(1.3), pool registration(2.0) */
#if defined(WITH_APACHE20)
static apr_status_t log_sql_close_link(void *data)
{
global_config.driver->disconnect(&global_config.db);
return APR_SUCCESS;
}
#elif defined(WITH_APACHE13)
static void log_sql_child_exit(server_rec *s, apr_pool_t *p)
{
global_config.driver->disconnect(&global_config.db);
}
#endif
/* Child Init */
#if defined(WITH_APACHE20)
static void log_sql_child_init(apr_pool_t *p, server_rec *s)
#elif defined(WITH_APACHE13)
static void log_sql_child_init(server_rec *s, apr_pool_t *p)
#endif
{
logsql_opendb_ret retval;
# if defined(WITH_APACHE20)
/* Register cleanup hook to close DDB connection (apache 2 doesn't have child_exit) */
apr_pool_cleanup_register(p, NULL, log_sql_close_link, log_sql_close_link);
# endif
/* Open a link to the database */
retval = log_sql_opendb_link(s);
switch (retval) {
case LOGSQL_OPENDB_FAIL:
log_error(APLOG_MARK, APLOG_ERR, 0, s,
"mod_log_sql: child spawned but unable to open database link");
break;
case LOGSQL_OPENDB_SUCCESS:
case LOGSQL_OPENDB_ALREADY:
log_error(APLOG_MARK,APLOG_DEBUG,0, s,
"mod_log_sql: open_logdb_link successful");
break;
case LOGSQL_OPENDB_PRESERVE:
log_error(APLOG_MARK,APLOG_DEBUG, 0, s,
"mod_log_sql: open_logdb_link said that preservation is forced");
break;
}
}
/* post_config / module_init */
#if defined(WITH_APACHE20)
static int log_sql_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
#elif defined(WITH_APACHE13)
static void log_sql_module_init(server_rec *s, apr_pool_t *p)
#endif
{
/* TODO: Add local_address, remote_address, server_name, connection_status */
/* Register handlers */
log_sql_register_item(s,p,'A', extract_agent, "agent", 1, 1);
log_sql_register_item(s,p,'a', extract_request_query, "request_args", 1, 1);
log_sql_register_item(s,p,'b', extract_bytes_sent, "bytes_sent", 0, 0);
log_sql_register_item(s,p,'c', extract_cookie, "cookie", 0, 1);
/* TODO: Document */
log_sql_register_item(s,p,'f', extract_request_file, "request_file", 0, 1);
log_sql_register_item(s,p,'H', extract_request_protocol, "request_protocol", 0, 1);
log_sql_register_item(s,p,'h', extract_remote_host, "remote_host", 0, 1);
log_sql_register_item(s,p,'I', extract_unique_id, "id", 0, 1);
log_sql_register_item(s,p,'l', extract_remote_logname, "remote_logname", 0, 1);
log_sql_register_item(s,p,'m', extract_request_method, "request_method", 0, 1);
log_sql_register_item(s,p,'M', extract_machine_id, "machine_id", 0, 1);
log_sql_register_item(s,p,'P', extract_child_pid, "child_pid", 0, 0);
log_sql_register_item(s,p,'p', extract_server_port, "server_port", 0, 0);
log_sql_register_item(s,p,'R', extract_referer, "referer", 1, 1);
log_sql_register_item(s,p,'r', extract_request_line, "request_line", 1, 1);
log_sql_register_item(s,p,'S', extract_request_timestamp, "time_stamp", 0, 0);
log_sql_register_item(s,p,'s', extract_status, "status", 1, 0);
log_sql_register_item(s,p,'T', extract_request_duration, "request_duration", 1, 0);
log_sql_register_item(s,p,'t', extract_request_time, "request_time", 0, 1);
log_sql_register_item(s,p,'u', extract_remote_user, "remote_user", 0, 1);
log_sql_register_item(s,p,'U', extract_request_uri, "request_uri", 1, 1);
log_sql_register_item(s,p,'v', extract_virtual_host, "virtual_host", 0, 1);
log_sql_register_item(s,p,'V', extract_server_name, "virtual_host", 0, 1);
if (global_config.announce) {
ap_add_version_component(p, PACKAGE_NAME"/"PACKAGE_VERSION);
}
/* ap_server_root_relative any default preserve file locations */
{
server_rec *cur_s;
const char *default_p = ap_server_root_relative(p, DEFAULT_PRESERVE_FILE);
for (cur_s = s; cur_s != NULL; cur_s= cur_s->next) {
logsql_state *cls = ap_get_module_config(cur_s->module_config,
&log_sql_module);
if (cls->preserve_file == DEFAULT_PRESERVE_FILE)
cls->preserve_file = default_p;
}
}
global_config.db.p = p;
#if defined(WITH_APACHE20)
return OK;
#endif
}
/* This function handles calling the DB module, handling errors
* of missing tables and lost DB connections, and falling back to
* preserving the DB query.
*
* Parms: request record, table type, table name, and the full SQL command
*/
static logsql_query_ret safe_sql_insert(request_rec *r, logsql_tabletype table_type,
const char *table_name, const char *query) {
logsql_query_ret result;
logsql_state *cls = ap_get_module_config(r->server->module_config,
&log_sql_module);
if (!global_config.db.connected) {
/* preserve query */
return LOGSQL_QUERY_NOLINK;
}
result = global_config.driver->insert(r,&global_config.db,query);
/* If we ran the query and it returned an error, try to be robust.
* (After all, the module thought it had a valid mysql_log connection but the query
* could have failed for a number of reasons, so we have to be extra-safe and check.) */
switch (result) {
case LOGSQL_QUERY_SUCCESS:
return LOGSQL_QUERY_SUCCESS;
case LOGSQL_QUERY_NOLINK:
return LOGSQL_QUERY_FAIL;
/* TODO: What do we do here */
case LOGSQL_QUERY_FAIL:
global_config.driver->disconnect(&global_config.db);
global_config.db.connected = 0;
/* re-open the connection and try again */
if (log_sql_opendb_link(r->server) != LOGSQL_OPENDB_FAIL) {
log_error(APLOG_MARK,APLOG_NOTICE,0, r->server,"db reconnect successful");
# if defined(WITH_APACHE20)
apr_sleep(apr_time_from_sec(0.25)); /* pause for a quarter second */
# elif defined(WITH_APACHE13)
# if defined(WIN32)
Sleep((DWORD)0.25);
# else
{
struct timespec delay, remainder;
int nanoret;
delay.tv_sec = 0;
delay.tv_nsec = 250000000; /* pause for a quarter second */
nanoret = nanosleep(&delay, &remainder);
if (nanoret && errno != EINTR) {
log_error(APLOG_MARK,APLOG_ERR, errno, r->server,"nanosleep unsuccessful");
}
}
# endif /* win32 */
# endif
result = global_config.driver->insert(r,&global_config.db,query);
if (result == LOGSQL_QUERY_SUCCESS) {
return LOGSQL_QUERY_SUCCESS;
} else {
log_error(APLOG_MARK,APLOG_ERR,0,r->server,"second attempt failed");
preserve_entry(r, query);
return LOGSQL_QUERY_PRESERVED;
}
} else {
log_error(APLOG_MARK,APLOG_ERR,0,r->server,
"reconnect failed, unable to reach database. SQL logging stopped until child regains a db connection.");
log_error(APLOG_MARK,APLOG_ERR,0,r->server,
"log entries are being preserved in %s",cls->preserve_file);
preserve_entry(r, query);
return LOGSQL_QUERY_PRESERVED;
}
break;
case LOGSQL_QUERY_NOTABLE:
if (global_config.createtables) {
log_error(APLOG_MARK,APLOG_ERR,0,r->server,
"table doesn't exist...creating now");
if ((result = global_config.driver->create_table(r, &global_config.db, table_type,
table_name))!=LOGSQL_TABLE_SUCCESS) {
log_error(APLOG_MARK,APLOG_ERR,result,r->server,
"child attempted but failed to create one or more tables for %s, preserving query", ap_get_server_name(r));
preserve_entry(r, query);
return LOGSQL_QUERY_PRESERVED;
} else {
log_error(APLOG_MARK,APLOG_ERR,result, r->server,
"tables successfully created - retrying query");
if ((result = global_config.driver->insert(r,&global_config.db,query))!=LOGSQL_QUERY_SUCCESS) {
log_error(APLOG_MARK,APLOG_ERR,result, r->server,
"giving up, preserving query");
preserve_entry(r, query);
return LOGSQL_QUERY_PRESERVED;
} else {
log_error(APLOG_MARK,APLOG_NOTICE,0, r->server,
"query successful after table creation");
return LOGSQL_QUERY_SUCCESS;
}
}
} else {
log_error(APLOG_MARK,APLOG_ERR,0,r->server,
"table doesn't exist, creation denied by configuration, preserving query");
preserve_entry(r, query);
return LOGSQL_QUERY_PRESERVED;
}
break;
default:
log_error(APLOG_MARK,APLOG_ERR,0, r->server,
"Invalid return code from mog_log_query");
return LOGSQL_QUERY_FAIL;
break;
}
return LOGSQL_QUERY_FAIL;
}
/* This function gets called to create a per-server configuration
* record. It will always be called for the main server and
* for each virtual server that is established. Each server maintains
* its own state that is separate from the others' states.
*
* The return value is a pointer to the created module-specific
* structure.
*/
static void *log_sql_make_state(apr_pool_t *p, server_rec *s)
{
logsql_state *cls = (logsql_state *) apr_pcalloc(p, sizeof(logsql_state));
/* These defaults are overridable in the httpd.conf file. */
cls->transfer_log_format = DEFAULT_TRANSFER_LOG_FMT;
apr_pool_create(&cls->parsed_pool, p);
cls->parsed_log_format = apr_pcalloc(cls->parsed_pool,
strlen(cls->transfer_log_format) * sizeof(logsql_item *));
cls->notes_table_name = DEFAULT_NOTES_TABLE_NAME;
cls->hin_table_name = DEFAULT_HIN_TABLE_NAME;
cls->hout_table_name = DEFAULT_HOUT_TABLE_NAME;
cls->cookie_table_name = DEFAULT_COOKIE_TABLE_NAME;
cls->preserve_file = DEFAULT_PRESERVE_FILE;
cls->transfer_ignore_list = apr_array_make(p, 1, sizeof(char *));
cls->transfer_accept_list = apr_array_make(p, 1, sizeof(char *));
cls->remhost_ignore_list = apr_array_make(p, 1, sizeof(char *));
cls->notes_list = apr_array_make(p, 1, sizeof(char *));
cls->hin_list = apr_array_make(p, 1, sizeof(char *));
cls->hout_list = apr_array_make(p, 1, sizeof(char *));
cls->cookie_list = apr_array_make(p, 1, sizeof(char *));
return (void *) cls;
}
/* Iterates through an array of char* and searches for a matching element
* Returns 0 if not found, 1 if found */
static int in_array(apr_array_header_t *ary, const char *elem)
{
int itr;
for (itr = 0; itr < ary->nelts; itr++) {
if (!strcmp(elem,((char **)ary->elts)[itr])) {
return 1;
}
}
return 0;
}
/* Parse through cookie lists and merge based on +/- prefixes */
#define DO_MERGE_ARRAY(parent,child,pool) \
if (apr_is_empty_array(child)) { \
apr_array_cat(child, parent); \
} else { \
apr_array_header_t *addlist, *dellist; \
char **elem, **ptr = (char **)(child->elts); \
int itr, overwrite = 0; \
addlist = apr_array_make(pool,5,sizeof(char *)); \
dellist = apr_array_make(subp,5,sizeof(char *)); \
\
for (itr=0; itrnelts; itr++) { \
if (*ptr[itr] == '+') { \
elem = (char **)apr_array_push(addlist); \
*elem = (ptr[itr]+1); \
} else if (*ptr[itr] == '-') { \
elem = (char **)apr_array_push(dellist); \
*elem = (ptr[itr]+1); \
} else { \
overwrite = 1; \
elem = (char **)apr_array_push(addlist); \
*elem = ptr[itr]; \
} \
} \
child = apr_array_make(p,1,sizeof(char *)); \
ptr = (char **)(parent->elts); \
if (overwrite==0) { \
/* if we are not overwriting the existing then prepare for merge */ \
for (itr=0; itrnelts; itr++) { \
if (!in_array(addlist, ptr[itr]) && !in_array(dellist,ptr[itr])) { \
elem = apr_array_push(child); \
*elem = apr_pstrdup(p, ptr[itr]); \
} \
} \
} \
apr_array_cat(child, addlist); \
}
static void *log_sql_merge_state(apr_pool_t *p, void *basev, void *addv)
{
/* Fetch the two states to merge */
logsql_state *parent = (logsql_state *) basev;
logsql_state *child = (logsql_state *) addv;
apr_pool_t *subp;
apr_pool_create(&subp,p);
/* Child can override these, otherwise they default to parent's choice.
* If the parent didn't set them, create reasonable defaults for the
* ones that should have such default settings. Leave the others null. */
/* No default for transfer_table_name because we want its absence
* to disable logging. */
if (!child->transfer_table_name) {
child->transfer_table_name = parent->transfer_table_name;
}
if (child->transfer_log_format == DEFAULT_TRANSFER_LOG_FMT) {
child->transfer_log_format = parent->transfer_log_format;
/*apr_pool_clear(child->parsed_pool);*/
child->parsed_log_format = apr_pcalloc(child->parsed_pool,
strlen(child->transfer_log_format) * sizeof(logsql_item *));
}
if (child->preserve_file == DEFAULT_PRESERVE_FILE)
child->preserve_file = parent->preserve_file;
/* server_root_relative the preserve file location */
if (child->preserve_file == DEFAULT_PRESERVE_FILE)
child->preserve_file = ap_server_root_relative(p, DEFAULT_PRESERVE_FILE);
if (child->notes_table_name == DEFAULT_NOTES_TABLE_NAME)
child->notes_table_name = parent->notes_table_name;
if (child->hin_table_name == DEFAULT_HIN_TABLE_NAME)
child->hin_table_name = parent->hin_table_name;
if (child->hout_table_name == DEFAULT_HOUT_TABLE_NAME)
child->hout_table_name = parent->hout_table_name;
if (child->cookie_table_name == DEFAULT_COOKIE_TABLE_NAME)
child->cookie_table_name = parent->cookie_table_name;
DO_MERGE_ARRAY(parent->transfer_ignore_list, child->transfer_ignore_list, subp);
DO_MERGE_ARRAY(parent->transfer_accept_list, child->transfer_accept_list, subp);
DO_MERGE_ARRAY(parent->remhost_ignore_list, child->remhost_ignore_list, subp);
DO_MERGE_ARRAY(parent->notes_list, child->notes_list, subp);
DO_MERGE_ARRAY(parent->hin_list, child->hin_list, subp);
DO_MERGE_ARRAY(parent->hout_list, child->hout_list, subp);
DO_MERGE_ARRAY(parent->cookie_list,child->cookie_list, subp);
apr_pool_destroy(subp);
if (!child->cookie_name)
child->cookie_name = parent->cookie_name;
return (void*) child;
}
/* Routine to perform the actual construction and execution of the relevant
* INSERT statements.
*/
static int log_sql_transaction(request_rec *orig)
{
char **ptrptr, **ptrptr2;
logsql_state *cls = ap_get_module_config(orig->server->module_config, &log_sql_module);
const char *access_query;
request_rec *r;
const char *transfer_tablename = cls->transfer_table_name;
const char *notes_tablename = cls->notes_table_name;
const char *hout_tablename = cls->hout_table_name;
const char *hin_tablename = cls->hin_table_name;
const char *cookie_tablename = cls->cookie_table_name;
/* We handle mass virtual hosting differently. Dynamically determine the name
* of the table from the virtual server's name, and flag it for creation.
*/
if (global_config.massvirtual) {
/* TODO: Make these configurable? */
char *access_base = "access_";
char *notes_base = "notes_";
char *hout_base = "headout_";
char *hin_base = "headin_";
char *cookie_base = "cookies_";
/* Determine the hostname and convert it to all lower-case; */
char *servername = apr_pstrdup(orig->pool,(char *)ap_get_server_name(orig));
char *p=servername;
while (*p) {
*p = apr_tolower(*p);
if (*p == '.') *p = '_';
if (*p == '-') *p = '_';
++p;
}
/* Find memory long enough to hold the table name + \0. */
transfer_tablename = apr_pstrcat(orig->pool, access_base, servername, NULL);
notes_tablename = apr_pstrcat(orig->pool, notes_base, servername, NULL);
hin_tablename = apr_pstrcat(orig->pool, hin_base, servername, NULL);
hout_tablename = apr_pstrcat(orig->pool, hout_base, servername, NULL);
cookie_tablename = apr_pstrcat(orig->pool, cookie_base, servername, NULL);
/* Tell this virtual server its transfer table name, and
* turn on create_tables, which is implied by massvirtual.
*/
global_config.createtables = 1;
}
/* Do we have enough info to log? */
if (!transfer_tablename) {
return DECLINED;
} else {
const char *thehost;
const char *theitem;
char *fields = "", *values = "";
char *itemsets = "";
char *note_query = NULL;
char *hin_query = NULL;
char *hout_query = NULL;
char *cookie_query = NULL;
const char *unique_id;
const char *formatted_item;
int i,length;
int proceed;
for (r = orig; r->next; r = r->next) {
continue;
}
/* The following is a stolen upsetting mess of pointers, I'm sorry.
* Anyone with the motiviation and/or the time should feel free
* to make this cleaner. :) */
ptrptr2 = (char **) (cls->transfer_accept_list->elts + (cls->transfer_accept_list->nelts * cls->transfer_accept_list->elt_size));
/* Go through each element of the accept list and compare it to the
* request_uri. If we don't get a match, return without logging */
if ((r->uri) && (cls->transfer_accept_list->nelts)) {
proceed = 0;
for (ptrptr = (char **) cls->transfer_accept_list->elts; ptrptr < ptrptr2; ptrptr = (char **) ((char *) ptrptr + cls->transfer_accept_list->elt_size))
if (ap_strstr(r->uri, *ptrptr)) {
proceed = 1;
break;
}
if (!proceed)
return OK;
}
/* Go through each element of the ignore list and compare it to the
* request_uri. If we get a match, return without logging */
ptrptr2 = (char **) (cls->transfer_ignore_list->elts + (cls->transfer_ignore_list->nelts * cls->transfer_ignore_list->elt_size));
if (r->uri) {
for (ptrptr = (char **) cls->transfer_ignore_list->elts; ptrptr < ptrptr2; ptrptr = (char **) ((char *) ptrptr + cls->transfer_ignore_list->elt_size))
if (ap_strstr(r->uri, *ptrptr)) {
return OK;
}
}
/* Go through each element of the ignore list and compare it to the
* remote host. If we get a match, return without logging */
ptrptr2 = (char **) (cls->remhost_ignore_list->elts + (cls->remhost_ignore_list->nelts * cls->remhost_ignore_list->elt_size));
thehost = ap_get_remote_host(r->connection, r->per_dir_config, REMOTE_NAME, NULL);
if (thehost) {
for (ptrptr = (char **) cls->remhost_ignore_list->elts; ptrptr < ptrptr2; ptrptr = (char **) ((char *) ptrptr + cls->remhost_ignore_list->elt_size))
if (ap_strstr(thehost, *ptrptr)) {
return OK;
}
}
/* Iterate through the format characters and set up the INSERT string according to
* what the user has configured. */
length = strlen(cls->transfer_log_format);
for (i = 0; iparsed_log_format[i];
if (item==NULL) {
log_error(APLOG_MARK, APLOG_ERR, 0, orig->server,
"Log Format '%c' unknown",cls->transfer_log_format[i]);
continue;
}
/* Yes, this key is one of the configured keys.
* Call the key's function and put the returned value into 'formatted_item' */
formatted_item = item->func(item->want_orig_default ? orig : r, "");
/* Massage 'formatted_item' for proper SQL eligibility... */
if (!formatted_item) {
formatted_item = "";
} else if (formatted_item[0] == '-' && formatted_item[1] == '\0' && !item->string_contents) {
/* If apache tried to log a '-' character for a numeric field, convert that to a zero
* because the database expects a numeral and will reject the '-' character. */
formatted_item = "0";
}
/* Append the fieldname and value-to-insert to the appropriate strings, quoting stringvals with ' as appropriate */
fields = apr_pstrcat(r->pool, fields, (i ? "," : ""),
item->sql_field_name, NULL);
values = apr_pstrcat(r->pool, values, (i ? "," : ""),
global_config.driver->escape(formatted_item, r->pool,&global_config.db), NULL);
}
/* Work through the list of notes defined by LogSQLWhichNotes */
i = 0;
unique_id = extract_unique_id(r, "");
ptrptr2 = (char **) (cls->notes_list->elts + (cls->notes_list->nelts * cls->notes_list->elt_size));
for (ptrptr = (char **) cls->notes_list->elts; ptrptr < ptrptr2; ptrptr = (char **) ((char *) ptrptr + cls->notes_list->elt_size)) {
/* If the specified note (*ptrptr) exists for the current request... */
if ((theitem = apr_table_get(r->notes, *ptrptr))) {
itemsets = apr_pstrcat(r->pool, itemsets,
(i > 0 ? "," : ""),
"(",
global_config.driver->escape(unique_id, r->pool, &global_config.db),
",",
global_config.driver->escape(*ptrptr, r->pool,&global_config.db),
",",
global_config.driver->escape(theitem, r->pool,&global_config.db),
")",
NULL);
i++;
}
}
if ( itemsets != "" ) {
note_query = apr_psprintf(r->pool, "insert %s into %s (id, item, val) values %s",
/*global_config.insertdelayed?"delayed":*/"", notes_tablename, itemsets);
log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: note string: %s", note_query);
}
/* Work through the list of headers-out defined by LogSQLWhichHeadersOut*/
i = 0;
itemsets = "";
ptrptr2 = (char **) (cls->hout_list->elts + (cls->hout_list->nelts * cls->hout_list->elt_size));
for (ptrptr = (char **) cls->hout_list->elts; ptrptr < ptrptr2; ptrptr = (char **) ((char *) ptrptr + cls->hout_list->elt_size)) {
/* If the specified header (*ptrptr) exists for the current request... */
if ((theitem = apr_table_get(r->headers_out, *ptrptr))) {
itemsets = apr_pstrcat(r->pool, itemsets,
(i > 0 ? "," : ""),
"(",
global_config.driver->escape(unique_id, r->pool, &global_config.db),
",",
global_config.driver->escape(*ptrptr, r->pool,&global_config.db),
",",
global_config.driver->escape(theitem, r->pool,&global_config.db),
")",
NULL);
i++;
}
}
if ( itemsets != "" ) {
hout_query = apr_psprintf(r->pool, "insert %s into %s (id, item, val) values %s",
/*global_config.insertdelayed?"delayed":*/"", hout_tablename, itemsets);
log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: header_out string: %s", hout_query);
}
/* Work through the list of headers-in defined by LogSQLWhichHeadersIn */
i = 0;
itemsets = "";
ptrptr2 = (char **) (cls->hin_list->elts + (cls->hin_list->nelts * cls->hin_list->elt_size));
for (ptrptr = (char **) cls->hin_list->elts; ptrptr < ptrptr2; ptrptr = (char **) ((char *) ptrptr + cls->hin_list->elt_size)) {
/* If the specified header (*ptrptr) exists for the current request... */
if ((theitem = apr_table_get(r->headers_in, *ptrptr))) {
itemsets = apr_pstrcat(r->pool, itemsets,
(i > 0 ? "," : ""),
"(",
global_config.driver->escape(unique_id, r->pool, &global_config.db),
",",
global_config.driver->escape(*ptrptr, r->pool,&global_config.db),
",",
global_config.driver->escape(theitem, r->pool,&global_config.db),
")",
NULL);
i++;
}
}
if ( itemsets != "" ) {
hin_query = apr_psprintf(r->pool, "insert %s into %s (id, item, val) values %s",
/*global_config.insertdelayed?"delayed":*/"", hin_tablename, itemsets);
log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: header_in string: %s", hin_query);
}
/* Work through the list of cookies defined by LogSQLWhichCookies */
i = 0;
itemsets = "";
ptrptr2 = (char **) (cls->cookie_list->elts + (cls->cookie_list->nelts * cls->cookie_list->elt_size));
for (ptrptr = (char **) cls->cookie_list->elts; ptrptr < ptrptr2; ptrptr = (char **) ((char *) ptrptr + cls->cookie_list->elt_size)) {
/* If the specified cookie (*ptrptr) exists for the current request... */
if ( strncmp((theitem = extract_specific_cookie(r, *ptrptr)), "-", 1) ) {
itemsets = apr_pstrcat(r->pool, itemsets,
(i > 0 ? "," : ""),
"(",
global_config.driver->escape(unique_id, r->pool, &global_config.db),
",",
global_config.driver->escape(*ptrptr, r->pool,&global_config.db),
",",
global_config.driver->escape(theitem, r->pool,&global_config.db),
")",
NULL);
i++;
}
}
if ( itemsets != "" ) {
cookie_query = apr_psprintf(r->pool, "insert %s into %s (id, item, val) values %s",
/*global_config.insertdelayed?"delayed":*/"", cookie_tablename, itemsets);
log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: cookie string: %s", cookie_query);
}
/* Set up the actual INSERT statement */
access_query = apr_psprintf(r->pool, "insert %s into %s (%s) values (%s)",
/*global_config.insertdelayed?"delayed":*/"", transfer_tablename, fields, values);
log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"mod_log_sql: access string: %s", access_query);
/* If the person activated force-preserve, go ahead and push all the entries
* into the preserve file, then return.
*/
if (global_config.forcepreserve) {
log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: preservation forced");
preserve_entry(orig, access_query);
if ( note_query != NULL )
preserve_entry(orig, note_query);
if ( hin_query != NULL )
preserve_entry(orig, hin_query);
if ( hout_query != NULL )
preserve_entry(orig, hout_query);
if ( cookie_query != NULL )
preserve_entry(orig, cookie_query);
return OK;
}
/* How's our mysql link integrity? */
if (!global_config.db.connected) {
if (!global_config.forcepreserve) {
/* Make a try to establish the link */
log_sql_opendb_link(r->server);
}
if (!global_config.db.connected) {
/* Unable to re-establish a DB link, so assume that it's really
* gone and send the entry to the preserve file instead.
* This short-circuits safe_sql_query() during a db outage and therefore
* we don't keep logging the db error over and over.
*/
preserve_entry(orig, access_query);
if ( note_query != NULL )
preserve_entry(orig, note_query);
if ( hin_query != NULL )
preserve_entry(orig, hin_query);
if ( hout_query != NULL )
preserve_entry(orig, hout_query);
if ( cookie_query != NULL )
preserve_entry(orig, cookie_query);
return OK;
} else {
/* Whew, we got the DB link back */
log_error(APLOG_MARK,APLOG_NOTICE,0, orig->server,"mod_log_sql: child established database connection");
}
}
/* ---> So as of here we have a non-null value of mysql_log. <--- */
/* ---> i.e. we have a good MySQL connection. <--- */
/* Make the access-table insert */
safe_sql_insert(orig,LOGSQL_TABLE_ACCESS,transfer_tablename,access_query);
/* Log the optional notes, headers, etc. */
if (note_query)
safe_sql_insert(orig, LOGSQL_TABLE_NOTES,notes_tablename,note_query);
if (hout_query)
safe_sql_insert(orig, LOGSQL_TABLE_HEADERSOUT,hout_tablename,hout_query);
if (hin_query)
safe_sql_insert(orig, LOGSQL_TABLE_HEADERSIN,hin_tablename,hin_query);
if (cookie_query)
safe_sql_insert(orig, LOGSQL_TABLE_COOKIES,cookie_tablename,cookie_query);
return OK;
}
}
/* Setup of the available httpd.conf configuration commands.
* Structure: command, function called, NULL, where available, how many arguments, verbose description
*/
static const command_rec log_sql_cmds[] = {
AP_INIT_FLAG("LogSQLAnnounce", set_global_flag_slot,
(void *)APR_OFFSETOF(global_config_t, announce), RSRC_CONF,
"Whether to announce that mod_log_sql is loaded in the server header")
,
/* DB connection parameters */
AP_INIT_TAKE13("LogSQLLoginInfo", set_log_sql_info, NULL, RSRC_CONF,
"The database connection URI in the form "driver://user:password@hostname:port/database"")
,
AP_INIT_TAKE2("LogSQLDBParam", set_dbparam, NULL, RSRC_CONF,
"First argument is the DB parameter, second is the value to assign")
,
AP_INIT_FLAG("LogSQLForcePreserve", set_global_flag_slot,
(void *)APR_OFFSETOF(global_config_t, forcepreserve), RSRC_CONF,
"Forces logging to preserve file and bypasses database")
,
AP_INIT_FLAG("LogSQLDisablePreserve", set_global_flag_slot,
(void *)APR_OFFSETOF(global_config_t, disablepreserve), RSRC_CONF,
"Completely disables use of the preserve file")
,
AP_INIT_TAKE1("LogSQLPreserveFile", set_server_file_slot,
(void *)APR_OFFSETOF(logsql_state,preserve_file), RSRC_CONF,
"Name of the file to use for data preservation during database downtime")
,
AP_INIT_FLAG("LogSQLCreateTables", set_global_nmv_flag_slot,
(void *)APR_OFFSETOF(global_config_t, createtables), RSRC_CONF,
"Turn on module's capability to create its SQL tables on the fly")
,
/* Table names */
AP_INIT_FLAG("LogSQLMassVirtualHosting", set_global_flag_slot,
(void *)APR_OFFSETOF(global_config_t, massvirtual), RSRC_CONF,
"Activates option(s) useful for ISPs performing mass virutal hosting")
,
AP_INIT_TAKE1("LogSQLTransferLogTable", set_server_nmv_string_slot,
(void *)APR_OFFSETOF(logsql_state, transfer_table_name), RSRC_CONF,
"The database table that holds the transfer log")
,
AP_INIT_TAKE1("LogSQLNotesLogTable", set_server_nmv_string_slot,
(void *)APR_OFFSETOF(logsql_state, notes_table_name), RSRC_CONF,
"The database table that holds the notes")
,
AP_INIT_TAKE1("LogSQLHeadersOutLogTable", set_server_nmv_string_slot,
(void *)APR_OFFSETOF(logsql_state, hout_table_name), RSRC_CONF,
"The database table that holds the outbound headers")
,
AP_INIT_TAKE1("LogSQLHeadersInLogTable", set_server_nmv_string_slot,
(void *)APR_OFFSETOF(logsql_state, hin_table_name), RSRC_CONF,
"The database table that holds the inbound headers")
,
AP_INIT_TAKE1("LogSQLCookieLogTable", set_server_nmv_string_slot,
(void *)APR_OFFSETOF(logsql_state, cookie_table_name), RSRC_CONF,
"The database table that holds the cookie info")
,
/* Log format */
AP_INIT_TAKE1("LogSQLTransferLogFormat", set_logformat_slot,
NULL, RSRC_CONF,
"Instruct the module what information to log to the database transfer log")
,
/* Machine ID */
AP_INIT_TAKE1("LogSQLMachineID", set_global_string_slot,
(void *)APR_OFFSETOF(global_config_t, machid), RSRC_CONF,
"Machine ID that the module will log, useful in web clusters to differentiate machines")
,
/* Limits on logging */
AP_INIT_ITERATE("LogSQLRequestAccept", add_server_string_slot,
(void *)APR_OFFSETOF(logsql_state, transfer_accept_list), RSRC_CONF,
"List of URIs to accept for logging. Accesses that don't match will not be logged")
,
AP_INIT_ITERATE("LogSQLRequestIgnore", add_server_string_slot,
(void *)APR_OFFSETOF(logsql_state, transfer_ignore_list), RSRC_CONF,
"List of URIs to ignore. Accesses that match will not be logged to database")
,
AP_INIT_ITERATE("LogSQLRemhostIgnore", add_server_string_slot,
(void *)APR_OFFSETOF(logsql_state, remhost_ignore_list), RSRC_CONF,
"List of remote hosts to ignore. Accesses that match will not be logged to database")
,
/* Special loggin table configuration */
AP_INIT_TAKE1("LogSQLWhichCookie", set_server_string_slot,
(void *)APR_OFFSETOF(logsql_state, cookie_name), RSRC_CONF,
"The single cookie that you want logged in the access_log when using the 'c' config directive")
,
AP_INIT_ITERATE("LogSQLWhichNotes", add_server_string_slot,
(void *)APR_OFFSETOF(logsql_state, notes_list), RSRC_CONF,
"Notes that you would like to log in a separate table")
,
AP_INIT_ITERATE("LogSQLWhichHeadersOut", add_server_string_slot,
(void *)APR_OFFSETOF(logsql_state, hout_list), RSRC_CONF,
"Outbound headers that you would like to log in a separate table")
,
AP_INIT_ITERATE("LogSQLWhichHeadersIn", add_server_string_slot,
(void *)APR_OFFSETOF(logsql_state, hin_list), RSRC_CONF,
"Inbound headers that you would like to log in a separate table")
,
AP_INIT_ITERATE("LogSQLWhichCookies", add_server_string_slot,
(void *)APR_OFFSETOF(logsql_state, cookie_list), RSRC_CONF,
"The cookie(s) that you would like to log in a separate table")
,
AP_INIT_RAW_ARGS("LogSQLDeprecated", ap_set_deprecated, NULL, RSRC_CONF,
"
Deprecated
The following Commands are deprecated and should not be used..
Read the documentation for more information
Deprecated")
,
/* Deprecated commands */
AP_INIT_TAKE1("LogSQLDatabase", set_dbparam_slot,
(void *)"database", RSRC_CONF,
"(Deprecated) Use LogSQLDBParam database dbname. The name of the database database for logging")
,
AP_INIT_TAKE1("LogSQLTableType", set_dbparam_slot,
(void *)"tabletype", RSRC_CONF,
"(Deprecated) Use LogSQLDBParam tabletype type. What kind of table to create (MyISAM, InnoDB,...) when creating tables")
,
AP_INIT_TAKE1("LogSQLSocketFile", set_dbparam_slot,
(void *)"socketfile", RSRC_CONF,
"(Deprecated) Use LogSQLDBParam socketfile socket. Name of the file to employ for socket connections to database")
,
AP_INIT_TAKE1("LogSQLTCPPort", set_dbparam_slot,
(void *)"port", RSRC_CONF,
"(Deprecated) Use LogSQLDBParam port port. Port number to use for TCP connections to database, defaults to 3306 if not set")
,
{NULL}
};
/* The configuration array that sets up the hooks into the module. */
#if defined(WITH_APACHE20)
static void register_hooks(apr_pool_t *p) {
ap_hook_post_config(log_sql_post_config, NULL, NULL, APR_HOOK_REALLY_FIRST);
ap_hook_child_init(log_sql_child_init, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_log_transaction(log_sql_transaction, NULL, NULL, APR_HOOK_MIDDLE);
}
module AP_MODULE_DECLARE_DATA log_sql_module = {
STANDARD20_MODULE_STUFF,
NULL, /* create per-directory config structures */
NULL, /* merge per-directory config structures */
log_sql_make_state, /* create per-server config structures */
log_sql_merge_state, /* merge per-server config structures */
log_sql_cmds, /* command handlers */
register_hooks /* register hooks */
};
#elif defined(WITH_APACHE13)
module MODULE_VAR_EXPORT log_sql_module = {
STANDARD_MODULE_STUFF,
log_sql_module_init, /* module initializer */
NULL, /* create per-dir config */
NULL, /* merge per-dir config */
log_sql_make_state, /* create server config */
log_sql_merge_state, /* merge server config */
log_sql_cmds, /* config directive table */
NULL, /* [9] content handlers */
NULL, /* [2] URI-to-filename translation */
NULL, /* [5] check/validate user_id */
NULL, /* [6] check authorization */
NULL, /* [4] check access by host */
NULL, /* [7] MIME type checker/setter */
NULL, /* [8] fixups */
log_sql_transaction, /* [10] logger */
NULL /* [3] header parser */
#if MODULE_MAGIC_NUMBER >= 19970728 /* 1.3-dev or later support these additionals... */
,log_sql_child_init, /* child process initializer */
log_sql_child_exit, /* process exit/cleanup */
NULL /* [1] post read-request */
#endif
};
#endif
mod_log_sql-1.100/mod_log_sql.h 0000644 0001750 0001750 00000010635 10075630207 016431 0 ustar zigo zigo 0000000 0000000 /* $Id: mod_log_sql.h 142 2004-07-16 01:33:59Z urkle@drip.ws $ */
#ifndef MOD_LOG_SQL_H
#define MOD_LOG_SQL_H
/* Create a set of LOGSQL_DECLARE(type), LOGSQL_DECLARE_NONSTD(type) and
* LOGSQL_DECLARE_DATA with appropriate export and import tags for the platform
*/
#if !defined(WIN32)
#define LOGSQL_DECLARE(type) type
#define LOGSQL_DECLARE_NONSTD(type) type
#define LOGSQL_DECLARE_DATA
#elif defined(LOGSQL_DECLARE_STATIC)
#define LOGSQL_DECLARE(type) type __stdcall
#define LOGSQL_DECLARE_NONSTD(type) type
#define LOGSQL_DECLARE_DATA
#elif defined(LOGSQL_DECLARE_EXPORT)
#define LOGSQL_DECLARE(type) __declspec(dllexport) type __stdcall
#define LOGSQL_DECLARE_NONSTD(type) __declspec(dllexport) type
#define LOGSQL_DECLARE_DATA __declspec(dllexport)
#else
#define LOGSQL_DECLARE(type) __declspec(dllimport) type __stdcall
#define LOGSQL_DECLARE_NONSTD(type) __declspec(dllimport) type
#define LOGSQL_DECLARE_DATA __declspec(dllimport)
#endif
/* Registration function for extract functions */
typedef const char *logsql_item_func(request_rec *r, char *a);
LOGSQL_DECLARE(void) log_sql_register_item(server_rec *s, apr_pool_t *p,
char key, logsql_item_func *func, const char *sql_field_name,
int want_orig_default, int string_contents);
/* DB Connection structure holds connection handle */
typedef struct {
int connected; /* Are we connected to the DB */
void *handle; /* DB specific connection pointer */
apr_pool_t *p; /* Pool to allocate handle off of */
apr_table_t *parms; /* DB connection parameters */
} logsql_dbconnection;
/* open db handle return values*/
typedef enum {
LOGSQL_OPENDB_FAIL = 0,
LOGSQL_OPENDB_SUCCESS,
LOGSQL_OPENDB_ALREADY,
LOGSQL_OPENDB_PRESERVE
} logsql_opendb_ret;
typedef enum {
LOGSQL_QUERY_SUCCESS = 0,
LOGSQL_QUERY_FAIL,
LOGSQL_QUERY_NOLINK,
LOGSQL_QUERY_NOTABLE,
LOGSQL_QUERY_PRESERVED
} logsql_query_ret;
typedef enum {
LOGSQL_TABLE_SUCCESS = 0,
LOGSQL_TABLE_FAIL
} logsql_table_ret;
/* Table type to create/log to */
typedef enum {
LOGSQL_TABLE_ACCESS = 0,
LOGSQL_TABLE_NOTES,
LOGSQL_TABLE_HEADERSOUT,
LOGSQL_TABLE_HEADERSIN,
LOGSQL_TABLE_COOKIES
} logsql_tabletype;
/* All Tables */
#define LOGSQL_TABLE_ALL LOGSQL_TABLE_ACCESS | LOGSQL_TABLE_NOTES | \
LOGSQL_TABLE_HEADERSIN | LOGSQL_TABLE_HEADERSOUT | LOGSQL_TABLE_COOKIES
/* MySQL module calls */
/* Registration function for database drivers */
typedef struct {
/* name of the provider */
const char *providername;
/* NULL terminated list of drivers strings */
const char **provided_drivers;
/* create a connection to the underlying database layer */
logsql_opendb_ret (*connect)(server_rec *s, logsql_dbconnection *db);
/* disconnect from the underlying database layer */
void (*disconnect)(logsql_dbconnection *db);
/* escape the SQL statement according to database rules */
const char *(*escape)(const char *from_str, apr_pool_t *p,
logsql_dbconnection *db);
/* insert a SQL query statement */
logsql_query_ret (*insert)(request_rec *r,logsql_dbconnection *db,
const char *query);
/* create a SQL table named table_name of table_type */
logsql_table_ret (*create_table)(request_rec *r, logsql_dbconnection *db,
logsql_tabletype table_type, const char *table_name);
} logsql_dbdriver;
LOGSQL_DECLARE(void) log_sql_register_driver(apr_pool_t *p,
logsql_dbdriver *driver);
/* Module initialization Macros */
#if defined(WITH_APACHE20)
# define LOGSQL_REGISTER(driver) \
static int post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s); \
static void register_hooks(apr_pool_t *p) { \
ap_hook_post_config(post_config, NULL, NULL, APR_HOOK_REALLY_FIRST); \
} \
\
module AP_MODULE_DECLARE_DATA log_sql_##driver##_module = { \
STANDARD20_MODULE_STUFF, \
NULL, NULL, NULL, NULL, NULL, register_hooks }; \
static int post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
#elif defined(WITH_APACHE13)
# define LOGSQL_REGISTER(driver) \
static void module_init(server_rec *s, apr_pool_t *p); \
module MODULE_VAR_EXPORT log_sql_##driver##_module = { \
STANDARD_MODULE_STUFF, module_init }; \
static void module_init(server_rec *s, apr_pool_t *p)
#endif
#if defined(WITH_APACHE20)
# define LOGSQL_SHUTDOWN \
static
#endif
#if defined(WITH_APACHE20)
#define LOGSQL_REGISTER_RETURN return OK;
#elif defined(WITH_APACHE13)
#define LOGSQL_REGISTER_RETURN
#endif
#endif /* MOD_LOG_SQL_H */
mod_log_sql-1.100/functions.h 0000644 0001750 0001750 00000014764 10123442606 016147 0 ustar zigo zigo 0000000 0000000 /* $Id: functions.h 151 2004-09-20 02:51:50Z urkle@drip.ws $ */
/* Begin the individual functions that, given a request r,
* extract the needed information from it and return the
* value to the calling entity.
*/
static const char *extract_remote_host(request_rec *r, char *a)
{
return (char *) ap_get_remote_host(r->connection, r->per_dir_config, REMOTE_NAME, NULL);
}
static const char *extract_remote_address(request_rec *r, char *a) __attribute__((unused));
static const char *extract_remote_address(request_rec *r, char *a)
{
return r->connection->remote_ip;
}
static const char *extract_local_address(request_rec *r, char *a) __attribute__((unused));
static const char *extract_local_address(request_rec *r, char *a)
{
return r->connection->local_ip;
}
static const char *extract_remote_logname(request_rec *r, char *a)
{
return (char *) ap_get_remote_logname(r);
}
static const char *extract_remote_user(request_rec *r, char *a)
{
#ifdef WITH_APACHE13
char *rvalue = r->connection->user;
#else
char *rvalue = r->user;
#endif
if (rvalue == NULL) {
rvalue = "-";
} else if (strlen(rvalue) == 0) {
rvalue = "\"\"";
}
return rvalue;
}
static const char *extract_request_line(request_rec *r, char *a)
{
/* Upddated to mod_log_config logic */
/* NOTE: If the original request contained a password, we
* re-write the request line here to contain XXXXXX instead:
* (note the truncation before the protocol string for HTTP/0.9 requests)
* (note also that r->the_request contains the unmodified request)
*/
return (r->parsed_uri.password)
? apr_pstrcat(r->pool, r->method, " ",
apr_uri_unparse(r->pool,
&r->parsed_uri, 0),
r->assbackwards ? NULL : " ",
r->protocol, NULL)
: r->the_request;
}
static const char *extract_request_file(request_rec *r, char *a)
{
return r->filename;
}
static const char *extract_request_uri(request_rec *r, char *a)
{
return r->uri;
}
static const char *extract_request_method(request_rec *r, char *a)
{
return r->method;
}
static const char *extract_request_protocol(request_rec *r, char *a)
{
return r->protocol;
}
static const char *extract_request_query(request_rec *r, char *a)
{
return (r->args) ? apr_pstrcat(r->pool, "?",
r->args, NULL)
: "";
}
static const char *extract_status(request_rec *r, char *a)
{
if (r->status <= 0) {
return "-";
} else {
return apr_psprintf(r->pool, "%d", r->status);
}
}
static const char *extract_virtual_host(request_rec *r, char *a)
{
return r->server->server_hostname;
}
static const char *extract_server_name(request_rec *r, char *a)
{
return ap_get_server_name(r);
}
static const char *extract_machine_id(request_rec *r, char *a)
{
if (!global_config.machid)
return "-";
else
return global_config.machid;
}
static const char *extract_server_port(request_rec *r, char *a)
{
return apr_psprintf(r->pool, "%u",
r->server->port ? r->server->port : ap_default_port(r));
}
/* This respects the setting of UseCanonicalName so that
* the dynamic mass virtual hosting trick works better.
*/
static const char *log_server_name(request_rec *r, char *a) __attribute__((unused));
static const char *log_server_name(request_rec *r, char *a)
{
return ap_get_server_name(r);
}
static const char *extract_child_pid(request_rec *r, char *a)
{
if (*a == '\0' || !strcmp(a, "pid")) {
return apr_psprintf(r->pool, "%" APR_PID_T_FMT, getpid());
}
else if (!strcmp(a, "tid")) {
#if APR_HAS_THREADS
apr_os_thread_t tid = apr_os_thread_current();
#else
int tid = 0; /* APR will format "0" anyway but an arg is needed */
#endif
return apr_psprintf(r->pool, "%pT", &tid);
}
/* bogus format */
return a;
}
static const char *extract_referer(request_rec *r, char *a)
{
const char *tempref;
tempref = apr_table_get(r->headers_in, "Referer");
if (!tempref)
{
return "-";
} else {
return tempref;
}
}
static const char *extract_agent(request_rec *r, char *a)
{
const char *tempag;
tempag = apr_table_get(r->headers_in, "User-Agent");
if (!tempag)
{
return "-";
} else {
return tempag;
}
}
static const char *extract_specific_cookie(request_rec *r, char *a)
{
const char *cookiestr;
char *cookieend;
char *isvalid;
char *cookiebuf;
if (a != NULL) {
log_error(APLOG_MARK,APLOG_DEBUG, 0, r->server,
"watching for cookie '%s'", a);
/* Fetch out the cookie header */
cookiestr = (char *)apr_table_get(r->headers_in, "cookie2");
if (cookiestr != NULL) {
log_error(APLOG_MARK,APLOG_DEBUG, 0, r->server,
"Cookie2: [%s]", cookiestr);
/* Does the cookie string contain one with our name? */
isvalid = ap_strstr_c(cookiestr, a);
if (isvalid != NULL) {
/* Move past the cookie name and equal sign */
isvalid += strlen(a) + 1;
/* Duplicate it into the pool */
cookiebuf = apr_pstrdup(r->pool, isvalid);
/* Segregate just this cookie out of the string
* with a terminating nul at the first semicolon */
cookieend = ap_strchr(cookiebuf, ';');
if (cookieend != NULL)
*cookieend = '\0';
return cookiebuf;
}
}
cookiestr = (char *)apr_table_get(r->headers_in, "cookie");
if (cookiestr != NULL) {
log_error(APLOG_MARK,APLOG_DEBUG, 0, r->server,
"Cookie: [%s]", cookiestr);
isvalid = ap_strstr_c(cookiestr, a);
if (isvalid != NULL) {
isvalid += strlen(a) + 1;
cookiebuf = apr_pstrdup(r->pool, isvalid);
cookieend = ap_strchr(cookiebuf, ';');
if (cookieend != NULL)
*cookieend = '\0';
return cookiebuf;
}
}
cookiestr = apr_table_get(r->headers_out, "set-cookie");
if (cookiestr != NULL) {
log_error(APLOG_MARK,APLOG_DEBUG, 0, r->server,
"Set-Cookie: [%s]", cookiestr);
isvalid = ap_strstr_c(cookiestr, a);
if (isvalid != NULL) {
isvalid += strlen(a) + 1;
cookiebuf = apr_pstrdup(r->pool, isvalid);
cookieend = ap_strchr(cookiebuf, ';');
if (cookieend != NULL)
*cookieend = '\0';
return cookiebuf;
}
}
}
return "-";
}
static const char *extract_cookie(request_rec *r, char *a)
{
logsql_state *cls = ap_get_module_config(r->server->module_config,
&log_sql_module);
return extract_specific_cookie(r, (char *)cls->cookie_name);
}
static const char *extract_unique_id(request_rec *r, char *a)
{
const char *tempid;
tempid = apr_table_get(r->subprocess_env, "UNIQUE_ID");
if (!tempid)
return "-";
else
return tempid;
}
/* End declarations of various extract_ functions */
mod_log_sql-1.100/functions13.h 0000644 0001750 0001750 00000002762 10044241744 016310 0 ustar zigo zigo 0000000 0000000 /* $Id: functions13.h 125 2004-04-29 18:05:25Z urkle@drip.ws $ */
static const char *extract_bytes_sent(request_rec *r, char *a)
{
if (!r->sent_bodyct) {
return "-";
}
else {
long int bs;
ap_bgetopt(r->connection->client, BO_BYTECT, &bs);
return ap_psprintf(r->pool, "%ld", bs);
}
}
static const char *extract_request_time(request_rec *r, char *a)
{
int timz;
struct tm *t;
char tstr[MAX_STRING_LEN];
t = ap_get_gmtoff(&timz);
if (a && *a) { /* Custom format */
strftime(tstr, MAX_STRING_LEN, a, t);
} else { /* CLF format */
char sign = (timz < 0 ? '-' : '+');
if (timz < 0) {
timz = -timz;
}
strftime(tstr, MAX_STRING_LEN, "[%d/%b/%Y:%H:%M:%S ", t);
ap_snprintf(tstr + strlen(tstr), sizeof(tstr) - strlen(tstr), "%c%.2d%.2d]", sign, timz / 60, timz % 60);
}
return ap_pstrdup(r->pool, tstr);
}
static const char *extract_request_duration(request_rec *r, char *a)
{
return ap_psprintf(r->pool, "%ld", time(NULL) - r->request_time);
}
static const char *extract_request_timestamp(request_rec *r, char *a)
{
return ap_psprintf(r->pool, "%ld", (long) time(NULL));
}
static const char *extract_connection_status(request_rec *r, char *a) __attribute__((unused));
static const char *extract_connection_status(request_rec *r, char *a)
{
if (r->connection->aborted)
return "X";
if ((r->connection->keepalive) &&
((r->server->keep_alive_max - r->connection->keepalives) > 0)) {
return "+";
}
return "-";
}
mod_log_sql-1.100/functions20.h 0000644 0001750 0001750 00000007627 10044241744 016313 0 ustar zigo zigo 0000000 0000000 /* $Id: functions20.h 125 2004-04-29 18:05:25Z urkle@drip.ws $ */
static const char *extract_bytes_sent(request_rec *r, char *a)
{
if (!r->sent_bodyct || !r->bytes_sent) {
return "-";
} else {
return apr_psprintf(r->pool, "%" APR_OFF_T_FMT, r->bytes_sent);
}
}
static const char *extract_request_time_custom(request_rec *r, char *a,
apr_time_exp_t *xt)
{
apr_size_t retcode;
char tstr[MAX_STRING_LEN];
apr_strftime(tstr, &retcode, sizeof(tstr), a, xt);
return apr_pstrdup(r->pool, tstr);
}
#define DEFAULT_REQUEST_TIME_SIZE 32
typedef struct {
unsigned t;
char timestr[DEFAULT_REQUEST_TIME_SIZE];
unsigned t_validate;
} cached_request_time;
#define TIME_CACHE_SIZE 4
#define TIME_CACHE_MASK 3
static cached_request_time request_time_cache[TIME_CACHE_SIZE];
static const char *extract_request_time(request_rec *r, char *a)
{
apr_time_exp_t xt;
/* Please read comments in mod_log_config.h for more info about
* the I_INSIST....COMPLIANCE define
*/
if (a && *a) { /* Custom format */
#ifdef I_INSIST_ON_EXTRA_CYCLES_FOR_CLF_COMPLIANCE
ap_explode_recent_localtime(&xt, apr_time_now());
#else
ap_explode_recent_localtime(&xt, r->request_time);
#endif
return extract_request_time_custom(r, a, &xt);
} else { /* CLF format */
/* This code uses the same technique as ap_explode_recent_localtime():
* optimistic caching with logic to detect and correct race conditions.
* See the comments in server/util_time.c for more information.
*/
cached_request_time* cached_time = apr_palloc(r->pool,
sizeof(*cached_time));
#ifdef I_INSIST_ON_EXTRA_CYCLES_FOR_CLF_COMPLIANCE
apr_time_t request_time = apr_time_now();
#else
apr_time_t request_time = r->request_time;
#endif
unsigned t_seconds = (unsigned)apr_time_sec(request_time);
unsigned i = t_seconds & TIME_CACHE_MASK;
memcpy(cached_time, &(request_time_cache[i]), sizeof(*cached_time));
if ((t_seconds != cached_time->t) ||
(t_seconds != cached_time->t_validate)) {
/* Invalid or old snapshot, so compute the proper time string
* and store it in the cache
*/
char sign;
int timz;
ap_explode_recent_localtime(&xt, r->request_time);
timz = xt.tm_gmtoff;
if (timz < 0) {
timz = -timz;
sign = '-';
}
else {
sign = '+';
}
cached_time->t = t_seconds;
apr_snprintf(cached_time->timestr, DEFAULT_REQUEST_TIME_SIZE,
"[%02d/%s/%d:%02d:%02d:%02d %c%.2d%.2d]",
xt.tm_mday, apr_month_snames[xt.tm_mon],
xt.tm_year+1900, xt.tm_hour, xt.tm_min, xt.tm_sec,
sign, timz / (60*60), timz % (60*60));
cached_time->t_validate = t_seconds;
memcpy(&(request_time_cache[i]), cached_time,
sizeof(*cached_time));
}
return cached_time->timestr;
}
}
static const char *extract_request_duration(request_rec *r, char *a)
{
apr_time_t duration = apr_time_now() - r->request_time;
return apr_psprintf(r->pool, "%" APR_TIME_T_FMT, apr_time_sec(duration));
}
static const char *extract_request_timestamp(request_rec *r, char *a)
{
return apr_psprintf(r->pool, "%"APR_TIME_T_FMT, apr_time_sec(apr_time_now()));
}
static const char *extract_connection_status(request_rec *r, char *a) __attribute__((unused));
static const char *extract_connection_status(request_rec *r, char *a)
{
if (r->connection->aborted)
return "X";
if (r->connection->keepalive == AP_CONN_KEEPALIVE &&
(!r->server->keep_alive_max ||
(r->server->keep_alive_max - r->connection->keepalives) > 0)) {
return "+";
}
return "-";
}
mod_log_sql-1.100/apache13.h 0000644 0001750 0001750 00000006466 10057524710 015527 0 ustar zigo zigo 0000000 0000000 /* $Id: apache13.h 141 2004-06-03 04:32:08Z urkle@drip.ws $ */
#ifndef APACHE13_H
#define APACHE13_H
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
#include "http_core.h"
/* Defines */
#define AP_MODULE_DECLARE_DATA MODULE_VAR_EXPORT
#define APR_OFF_T_FMT "ld"
#define APR_PID_T_FMT "d"
#define APR_SUCCESS 0
#define APR_OFFSETOF XtOffsetOf
/** method of declaring a directive with raw argument parsing */
# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, RAW_ARGS, help }
/** method of declaring a directive which takes 1 argument */
# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, TAKE1, help }
/** method of declaring a directive which takes 2 argument */
# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, TAKE2, help }
/** method of declaring a directive which takes multiple arguments */
# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, ITERATE, help }
/** method of declaring a directive which takes 1 or 3 arguments */
# define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, TAKE13, help }
/** method of declaring a directive which takes 3 arguments */
# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, TAKE3, help }
/** method of declaring a directive which takes a flag (on/off) as an argument */
# define AP_INIT_FLAG(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, FLAG, help }
/* Types */
#define apr_pool_t pool
#define apr_array_header_t array_header
#define apr_table_t table
#define apr_status_t int
#define apr_uri_t uri_components
/* Functions */
#define ap_get_remote_host(a,b,c,d) ap_get_remote_host(a,b,c)
#define ap_set_deprecated NULL
#define apr_uri_unparse ap_unparse_uri_components
#define apr_uri_parse ap_parse_uri_components
#define ap_add_version_component(p,s) ap_add_version_component(s)
#define apr_pool_create(a,b) *(a) = ap_make_sub_pool(b)
#define apr_pool_destroy ap_destroy_pool
#define apr_pool_cleanup_register ap_register_cleanup
#define apr_palloc ap_palloc
#define apr_pcalloc ap_pcalloc
#define apr_pstrdup ap_pstrdup
#define apr_pstrcat ap_pstrcat
#define apr_psprintf ap_psprintf
#define apr_snprintf ap_snprintf
#define ap_strchr strchr
#define ap_strchr_c strchr
#define ap_strstr strstr
#define ap_strstr_c strstr
#define apr_table_set ap_table_set
#define apr_table_get ap_table_get
#define apr_table_make ap_make_table
#define apr_array_push ap_push_array
#define apr_array_make ap_make_array
#define apr_array_cat ap_array_cat
#define apr_is_empty_array(t) (((t) == NULL)||((t)->nelts == 0))
#define apr_tolower ap_tolower
void log_error(char *file, int line, int level, apr_status_t status,
const server_rec *s, const char *fmt, ...) __attribute__ ((format (printf, 6,7)));
#ifndef WIN32
inline
#endif
void log_error(char *file, int line, int level,
apr_status_t status, const server_rec *s, const char *fmt, ...)
{
static char buff[MAX_STRING_LEN];
va_list args;
va_start(args, fmt);
ap_vsnprintf(buff,MAX_STRING_LEN, fmt,args);
ap_log_error(file,line,level | APLOG_NOERRNO ,s,"%s",buff);
va_end(args);
}
#endif /* APACHE13_H */
mod_log_sql-1.100/apache20.h 0000644 0001750 0001750 00000000751 10044241744 015513 0 ustar zigo zigo 0000000 0000000 /* $Id: apache20.h 125 2004-04-29 18:05:25Z urkle@drip.ws $ */
#ifndef APACHE20_H
#define APACHE20_H
#include "apr_strings.h"
#include "apr_lib.h"
#include "apr_hash.h"
#include "apr_optional.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
#include "apr_tables.h"
#include "ap_config.h"
#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_log.h"
#include "http_protocol.h"
#include "util_time.h"
#define log_error ap_log_error
#endif /* APACHE20_H */
mod_log_sql-1.100/winconfig.h 0000644 0001750 0001750 00000004404 10171046153 016110 0 ustar zigo zigo 0000000 0000000 /* config.h. Generated by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the header file. */
/* #undef HAVE_INTTYPES_H */
/* Define to 1 if you have the `m' library (-lm). */
/* #undef HAVE_LIBM */
/* Define to 1 if you have the `mysqlclient' library (-lmysqlclient). */
#define HAVE_LIBMYSQLCLIENT 1
/* Define to 1 if you have the `z' library (-lz). */
/* #undef HAVE_LIBZ */
/* Define to 1 if you have the header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the header file. */
/* #undef HAVE_MOD_SSL_H */
/* Define to 1 if you have the `mysql_real_escape_string' function. */
#define HAVE_MYSQL_REAL_ESCAPE_STRING 1
/* Define to 1 if you have the header file. */
/* #undef HAVE_STDINT_H */
/* Define to 1 if you have the header file. */
/* #undef HAVE_STDLIB_H 1
/* Define to 1 if you have the header file. */
/* #undef HAVE_STRINGS_H */
/* Define to 1 if you have the header file. */
/* #undef HAVE_STRING_H */
/* Define to 1 if you have the header file. */
/* #undef HAVE_SYS_STAT_H */
/* Define to 1 if you have the header file. */
/* #undef HAVE_SYS_TYPES_H */
/* Define to 1 if you have the header file. */
/* #undef HAVE_UNISTD_H */
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME "mod_log_sql"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "mod_log_sql 1.100"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "mod-log-sql"
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.100"
/* Define to 1 if you have the ANSI C header files. */
/* #undef STDC_HEADERS */
/* Define if we want to compile in SSL support. */
/* #undef WANT_SSL_LOGGING */
/* Define to 1 if we are compiling with Apache 1.3.x */
/* #undef WITH_APACHE13 */
/* Define to 1 if we are compiling with Apache 2.0.x */
/* #undef WITH_APACHE20 */
/* Define to 1 if we are compiling with mysql */
#define WITH_MYSQL 1
mod_log_sql-1.100/mod_log_sql_ssl.c 0000644 0001750 0001750 00000004712 10051041027 017272 0 ustar zigo zigo 0000000 0000000 /* $Id: mod_log_sql_ssl.c 140 2004-05-14 03:50:47Z urkle@drip.ws $ */
#if defined(WITH_APACHE20)
# include "apache20.h"
#elif defined(WITH_APACHE13)
# include "apache13.h"
#else
# error Unsupported Apache version
#endif
#ifdef HAVE_CONFIG_H
/* Undefine these to prevent conflicts between Apache ap_config_auto.h and
* my config.h. Only really needed for Apache < 2.0.48, but it can't hurt.
*/
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include "config.h"
#endif
#include "mod_log_sql.h"
#include "mod_ssl.h"
#if defined(WITH_APACHE20)
static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *header_ssl_lookup = NULL;
# define TEST_SSL(r) header_ssl_lookup
#elif defined(WITH_APACHE13)
# define TEST_SSL(r) ap_ctx_get(r->connection->client->ctx, "ssl")
# define header_ssl_lookup ssl_var_lookup
#endif
static const char *extract_ssl_keysize(request_rec *r, char *a)
{
char *result = NULL;
if (TEST_SSL(r) != NULL)
{
result = header_ssl_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER_USEKEYSIZE");
log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_KEYSIZE: %s", result);
if (result && result[0])
return result;
else
return "0";
} else {
return "0";
}
}
static const char *extract_ssl_maxkeysize(request_rec *r, char *a)
{
char *result = NULL;
if (TEST_SSL(r) != NULL)
{
result = header_ssl_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER_ALGKEYSIZE");
log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_ALGKEYSIZE: %s", result);
if (result && result[0])
return result;
else
return "0";
} else {
return "0";
}
}
static const char *extract_ssl_cipher(request_rec *r, char *a)
{
char *result = NULL;
if (TEST_SSL(r) != NULL)
{
result = header_ssl_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER");
log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_CIPHER: %s", result);
if (result && result[0])
return result;
else
return "0";
} else {
return "-";
}
}
LOGSQL_REGISTER(ssl)
{
log_sql_register_item(s,p,'q', extract_ssl_keysize, "ssl_keysize", 0, 1);
log_sql_register_item(s,p,'Q', extract_ssl_maxkeysize, "ssl_maxkeysize", 0, 1);
log_sql_register_item(s,p,'z', extract_ssl_cipher, "ssl_cipher", 0, 1);
#if defined(WITH_APACHE20)
header_ssl_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup);
#endif
LOGSQL_REGISTER_RETURN;
}
mod_log_sql-1.100/mod_log_sql_mysql.c 0000644 0001750 0001750 00000017266 10171044754 017663 0 ustar zigo zigo 0000000 0000000 /* $Id: mod_log_sql_mysql.c 155 2005-01-11 20:51:25Z urkle@drip.ws $ */
#if defined(WITH_APACHE20)
# include "apache20.h"
#elif defined(WITH_APACHE13)
# include "apache13.h"
#else
# error Unsupported Apache version
#endif
#ifdef HAVE_CONFIG_H
/* Undefine these to prevent conflicts between Apache ap_config_auto.h and
* my config.h. Only really needed for Apache < 2.0.48, but it can't hurt.
*/
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include "config.h"
#endif
#include "mod_log_sql.h"
#include "mysql.h"
#include "mysqld_error.h"
/* The enduser won't modify these */
#define MYSQL_ERROR(mysql) ((mysql)?(mysql_error(mysql)):"MySQL server has gone away")
/* Connect to the MYSQL database */
static logsql_opendb_ret log_sql_mysql_connect(server_rec *s, logsql_dbconnection *db)
{
const char *host = apr_table_get(db->parms,"hostname");
const char *user = apr_table_get(db->parms,"username");
const char *passwd = apr_table_get(db->parms,"password");
const char *database = apr_table_get(db->parms,"database");
const char *s_tcpport = apr_table_get(db->parms,"port");
unsigned int tcpport = (s_tcpport)?atoi(s_tcpport):3306;
const char *socketfile = apr_table_get(db->parms,"socketfile");
MYSQL *dblink = db->handle;
dblink = mysql_init(dblink);
db->handle = (void *)dblink;
if (!socketfile) {
socketfile = "/var/lib/mysql/mysql.sock";
}
if (mysql_real_connect(dblink, host, user, passwd, database, tcpport,
socketfile, 0)) {
log_error(APLOG_MARK,APLOG_DEBUG,0, s,"HOST: '%s' PORT: '%d' DB: '%s' USER: '%s' SOCKET: '%s'",
host, tcpport, database, user, socketfile);
return LOGSQL_OPENDB_SUCCESS;
} else {
log_error(APLOG_MARK,APLOG_ERR,0, s,"mod_log_sql_mysql: database connection error: mysql error: %s",
MYSQL_ERROR(dblink));
log_error(APLOG_MARK,APLOG_DEBUG, 0, s,"HOST: '%s' PORT: '%d' DB: '%s' USER: '%s' SOCKET: '%s'",
host, tcpport, database, user, socketfile);
return LOGSQL_OPENDB_FAIL;
}
}
/* Close the DB link */
static void log_sql_mysql_close(logsql_dbconnection *db)
{
mysql_close((MYSQL *)db->handle);
/* mysql_close frees this data so NULL it out incase we reconnect later */
db->handle=NULL;
}
/* Routine to escape the 'dangerous' characters that would otherwise
* corrupt the INSERT string: ', \, and "
*/
static const char *log_sql_mysql_escape(const char *from_str, apr_pool_t *p,
logsql_dbconnection *db)
{
/* Return "NULL" for empty strings */
if (!from_str || strlen(from_str) == 0)
return "NULL";
else {
char *to_str;
unsigned long length = strlen(from_str);
unsigned long retval;
/* Pre-allocate a new string that could hold twice the original, which would only
* happen if the whole original string was 'dangerous' characters.
*/
to_str = (char *) apr_palloc(p, length * 2 + 3);
if (!to_str) {
return from_str;
}
strcpy(to_str, "'");
if (!db->connected) {
/* Well, I would have liked to use the current database charset. mysql is
* unavailable, however, so I fall back to the slightly less respectful
* mysql_escape_string() function that uses the default charset.
*/
retval = mysql_escape_string(to_str+1, from_str, length);
} else {
/* MySQL is available, so I'll go ahead and respect the current charset when
* I perform the escape.
*/
retval = mysql_real_escape_string((MYSQL *)db->handle, to_str+1, from_str, length);
}
strcat(to_str,"'");
if (retval)
return to_str;
else
return from_str;
}
}
#if defined(WIN32)
#define SIGNAL_GRAB
#define SIGNAL_RELEASE
#define SIGNAL_VAR
#else
#define SIGNAL_VAR void (*handler) (int);
#define SIGNAL_GRAB handler = signal(SIGPIPE, SIG_IGN);
#define SIGNAL_RELEASE signal(SIGPIPE, handler);
#endif
/* Run a mysql insert query and return a categorized error or success */
static logsql_query_ret log_sql_mysql_query(request_rec *r,logsql_dbconnection *db,
const char *query)
{
int retval;
SIGNAL_VAR
unsigned int real_error = 0;
/*const char *real_error_str = NULL;*/
MYSQL *dblink = (MYSQL *)db->handle;
if (!dblink) {
return LOGSQL_QUERY_NOLINK;
}
/* A failed mysql_query() may send a SIGPIPE, so we ignore that signal momentarily. */
SIGNAL_GRAB
/* Run the query */
if (!(retval = mysql_query(dblink, query))) {
SIGNAL_RELEASE
return LOGSQL_QUERY_SUCCESS;
}
log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
"mysql_query returned (%d)", retval);
/* Check to see if the error is "nonexistent table" */
real_error = mysql_errno(dblink);
if (real_error == ER_NO_SUCH_TABLE) {
log_error(APLOG_MARK,APLOG_ERR,0, r->server,"table does not exist, preserving query");
/* Restore SIGPIPE to its original handler function */
SIGNAL_RELEASE
return LOGSQL_QUERY_NOTABLE;
}
/* Restore SIGPIPE to its original handler function */
SIGNAL_RELEASE
return LOGSQL_QUERY_FAIL;
}
/* Create table table_name of type table_type. */
static logsql_table_ret log_sql_mysql_create(request_rec *r, logsql_dbconnection *db,
logsql_tabletype table_type, const char *table_name)
{
int retval;
const char *tabletype = apr_table_get(db->parms,"tabletype");
SIGNAL_VAR
char *type_suffix = NULL;
char *create_prefix = "create table if not exists `";
char *create_suffix = NULL;
char *create_sql;
MYSQL *dblink = (MYSQL *)db->handle;
/* if (!global_config.createtables) {
return APR_SUCCESS;
}*/
switch (table_type) {
case LOGSQL_TABLE_ACCESS:
create_suffix =
"` (id char(19),\
agent varchar(255),\
bytes_sent int unsigned,\
child_pid smallint unsigned,\
cookie varchar(255),\
machine_id varchar(25),\
request_file varchar(255),\
referer varchar(255),\
remote_host varchar(50),\
remote_logname varchar(50),\
remote_user varchar(50),\
request_duration smallint unsigned,\
request_line varchar(255),\
request_method varchar(10),\
request_protocol varchar(10),\
request_time char(28),\
request_uri varchar(255),\
request_args varchar(255),\
server_port smallint unsigned,\
ssl_cipher varchar(25),\
ssl_keysize smallint unsigned,\
ssl_maxkeysize smallint unsigned,\
status smallint unsigned,\
time_stamp int unsigned,\
virtual_host varchar(255))";
break;
case LOGSQL_TABLE_COOKIES:
case LOGSQL_TABLE_HEADERSIN:
case LOGSQL_TABLE_HEADERSOUT:
case LOGSQL_TABLE_NOTES:
create_suffix =
"` (id char(19),\
item varchar(80),\
val varchar(80))";
break;
}
if (tabletype) {
type_suffix = apr_pstrcat(r->pool, " TYPE=",
tabletype, NULL);
}
/* Find memory long enough to hold the whole CREATE string + \0 */
create_sql = apr_pstrcat(r->pool, create_prefix, table_name, create_suffix,
type_suffix, NULL);
log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"create string: %s", create_sql);
if (!dblink) {
return LOGSQL_QUERY_NOLINK;
}
/* A failed mysql_query() may send a SIGPIPE, so we ignore that signal momentarily. */
SIGNAL_GRAB
/* Run the create query */
if ((retval = mysql_query(dblink, create_sql))) {
log_error(APLOG_MARK,APLOG_ERR,0, r->server,"failed to create table: %s",
table_name);
SIGNAL_RELEASE
return LOGSQL_TABLE_FAIL;
}
SIGNAL_RELEASE
return LOGSQL_TABLE_SUCCESS;
}
static const char *supported_drivers[] = {"mysql",NULL};
static logsql_dbdriver mysql_driver = {
"mysql",
supported_drivers,
log_sql_mysql_connect, /* open DB connection */
log_sql_mysql_close, /* close DB connection */
log_sql_mysql_escape, /* escape query */
log_sql_mysql_query, /* insert query */
log_sql_mysql_create /* create table */
};
LOGSQL_REGISTER(mysql) {
log_sql_register_driver(p,&mysql_driver);
LOGSQL_REGISTER_RETURN;
}
mod_log_sql-1.100/mod_log_sql_pgsql.c 0000644 0001750 0001750 00000016145 10040244704 017627 0 ustar zigo zigo 0000000 0000000 /* $Id: mod_log_sql_pgsql.c 120 2004-04-17 15:14:12Z urkle@drip.ws $ */
#if defined(WITH_APACHE20)
# include "apache20.h"
#elif defined(WITH_APACHE13)
# include "apache13.h"
#else
# error Unsupported Apache version
#endif
#ifdef HAVE_CONFIG_H
/* Undefine these to prevent conflicts between Apache ap_config_auto.h and
* my config.h. Only really needed for Apache < 2.0.48, but it can't hurt.
*/
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include "config.h"
#endif
#include "mod_log_sql.h"
#include "libpq-fe.h"
typedef struct {
PGconn *PG;
char *connectioninfo;
} pg_conn_rec;
/* Connect to the MYSQL database */
static logsql_opendb_ret log_sql_pgsql_connect(server_rec *s, logsql_dbconnection *db)
{
const char *host = apr_table_get(db->parms,"hostname");
const char *user = apr_table_get(db->parms,"username");
const char *passwd = apr_table_get(db->parms,"password");
const char *database = apr_table_get(db->parms,"database");
const char *s_tcpport = apr_table_get(db->parms,"port");
unsigned int tcpport = (s_tcpport)?atoi(s_tcpport):3306;
const char *socketfile = apr_table_get(db->parms,"socketfile");
pg_conn_rec *dblink = db->handle;
dblink = mysql_init(dblink);
db->handle = (void *)dblink;
if (!socketfile) {
socketfile = "/var/lib/mysql/mysql.sock";
}
if (PQconnectdb(dblink, host, user, passwd, database, tcpport,
socketfile, 0)) {
log_error(APLOG_MARK,APLOG_DEBUG,0, s,"HOST: '%s' PORT: '%d' DB: '%s' USER: '%s' SOCKET: '%s'",
host, tcpport, database, user, socketfile);
return LOGSQL_OPENDB_SUCCESS;
} else {
log_error(APLOG_MARK,APLOG_DEBUG,0, s,"mod_log_sql: database connection error: %s",
MYSQL_ERROR(dblink));
log_error(APLOG_MARK,APLOG_DEBUG, 0, s,"HOST: '%s' PORT: '%d' DB: '%s' USER: '%s' SOCKET: '%s'",
host, tcpport, database, user, socketfile);
return LOGSQL_OPENDB_FAIL;
}
}
/* Close the DB link */
static void log_sql_pgsql_close(logsql_dbconnection *db)
{
PQfinish(((pg_conn_rec *)db->handle)->PG);
}
/* Routine to escape the 'dangerous' characters that would otherwise
* corrupt the INSERT string: ', \, and "
*/
static const char *log_sql_pgsql_escape(const char *from_str, apr_pool_t *p,
logsql_dbconnection *db)
{
if (!from_str)
return NULL;
else {
char *to_str;
unsigned long length = strlen(from_str);
unsigned long retval;
/* Pre-allocate a new string that could hold twice the original, which would only
* happen if the whole original string was 'dangerous' characters.
*/
to_str = (char *) apr_palloc(p, length * 2 + 1);
if (!to_str) {
return from_str;
}
if (!db->connected) {
/* Well, I would have liked to use the current database charset. mysql is
* unavailable, however, so I fall back to the slightly less respectful
* mysql_escape_string() function that uses the default charset.
*/
retval = mysql_escape_string(to_str, from_str, length);
} else {
/* MySQL is available, so I'll go ahead and respect the current charset when
* I perform the escape.
*/
retval = mysql_real_escape_string((MYSQL *)db->handle, to_str, from_str, length);
}
if (retval)
return to_str;
else
return from_str;
}
}
/* Run a mysql insert query and return a categorized error or success */
static logsql_query_ret log_sql_pgsql_query(request_rec *r,logsql_dbconnection *db,
const char *query)
{
int retval;
void (*handler) (int);
unsigned int real_error = 0;
/*const char *real_error_str = NULL;*/
pg_conn_rec *dblink = db->handle;
if (!dblink) {
return LOGSQL_QUERY_NOLINK;
}
/* A failed mysql_query() may send a SIGPIPE, so we ignore that signal momentarily. */
handler = signal(SIGPIPE, SIG_IGN);
/* Run the query */
if (!(retval = mysql_query(dblink, query))) {
signal(SIGPIPE, handler);
return LOGSQL_QUERY_SUCCESS;
}
/* Check to see if the error is "nonexistent table" */
real_error = mysql_errno(dblink);
if (real_error == ER_NO_SUCH_TABLE) {
log_error(APLOG_MARK,APLOG_ERR,0, r->server,"table does not exist, preserving query");
/* Restore SIGPIPE to its original handler function */
signal(SIGPIPE, handler);
return LOGSQL_QUERY_NOTABLE;
}
/* Restore SIGPIPE to its original handler function */
signal(SIGPIPE, handler);
return LOGSQL_QUERY_FAIL;
}
/* Create table table_name of type table_type. */
static logsql_table_ret log_sql_pgsql_create(request_rec *r, logsql_dbconnection *db,
logsql_tabletype table_type, const char *table_name)
{
int retval;
const char *tabletype = apr_table_get(db->parms,"tabletype");
void (*handler) (int);
char *type_suffix = NULL;
char *create_prefix = "create table if not exists `";
char *create_suffix = NULL;
char *create_sql;
pg_conn_rec *dblink = db->handle;
/* if (!global_config.createtables) {
return APR_SUCCESS;
}*/
switch (table_type) {
case LOGSQL_TABLE_ACCESS:
create_suffix =
"` (id char(19),\
agent varchar(255),\
bytes_sent int unsigned,\
child_pid smallint unsigned,\
cookie varchar(255),\
machine_id varchar(25),\
request_file varchar(255),\
referer varchar(255),\
remote_host varchar(50),\
remote_logname varchar(50),\
remote_user varchar(50),\
request_duration smallint unsigned,\
request_line varchar(255),\
request_method varchar(10),\
request_protocol varchar(10),\
request_time char(28),\
request_uri varchar(255),\
request_args varchar(255),\
server_port smallint unsigned,\
ssl_cipher varchar(25),\
ssl_keysize smallint unsigned,\
ssl_maxkeysize smallint unsigned,\
status smallint unsigned,\
time_stamp int unsigned,\
virtual_host varchar(255))";
break;
case LOGSQL_TABLE_COOKIES:
case LOGSQL_TABLE_HEADERSIN:
case LOGSQL_TABLE_HEADERSOUT:
case LOGSQL_TABLE_NOTES:
create_suffix =
"` (id char(19),\
item varchar(80),\
val varchar(80))";
break;
}
if (tabletype) {
type_suffix = apr_pstrcat(r->pool, " TYPE=",
tabletype, NULL);
}
/* Find memory long enough to hold the whole CREATE string + \0 */
create_sql = apr_pstrcat(r->pool, create_prefix, table_name, create_suffix,
type_suffix, NULL);
log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"create string: %s", create_sql);
if (!dblink) {
return LOGSQL_QUERY_NOLINK;
}
/* A failed mysql_query() may send a SIGPIPE, so we ignore that signal momentarily. */
handler = signal(SIGPIPE, SIG_IGN);
/* Run the create query */
if ((retval = mysql_query(dblink, create_sql))) {
log_error(APLOG_MARK,APLOG_ERR,0, r->server,"failed to create table: %s",
table_name);
signal(SIGPIPE, handler);
return LOGSQL_TABLE_FAIL;
}
signal(SIGPIPE, handler);
return LOGSQL_TABLE_SUCCESS;
}
static char *supported_drivers[] = {"pgsql",NULL};
static logsql_dbdriver pgsql_driver = {
supported_drivers,
log_sql_pgsql_connect, /* open DB connection */
log_sql_pgsql_close, /* close DB connection */
log_sql_pgsql_escape, /* escape query */
log_sql_pgsql_query, /* insert query */
log_sql_pgsql_create /* create table */
};
LOGSQL_REGISTER(pgsql) {
log_sql_register_driver(p,&pgsql_driver);
LOGSQL_REGISTER_RETURN;
}
mod_log_sql-1.100/mod_log_sql_dbi.c 0000644 0001750 0001750 00000016631 10075333036 017244 0 ustar zigo zigo 0000000 0000000 /* $Id: mod_log_sql_dbi.c 120 2004-04-17 15:14:12Z urkle@drip.ws $ */
#if defined(WITH_APACHE20)
# include "apache20.h"
#elif defined(WITH_APACHE13)
# include "apache13.h"
#else
# error Unsupported Apache version
#endif
#ifdef HAVE_CONFIG_H
/* Undefine these to prevent conflicts between Apache ap_config_auto.h and
* my config.h. Only really needed for Apache < 2.0.48, but it can't hurt.
*/
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include "config.h"
#endif
#include "mod_log_sql.h"
#include "dbi/dbi.h"
typedef struct {
dbi_conn conn;
} dbi_conn_rec;
/* Connect to the MYSQL database */
static logsql_opendb_ret log_sql_dbi_connect(server_rec *s, logsql_dbconnection *db)
{
const char *driver = apr_table_get(db->parms,"driver");
const char *host = apr_table_get(db->parms,"hostname");
const char *user = apr_table_get(db->parms,"username");
const char *passwd = apr_table_get(db->parms,"password");
const char *database = apr_table_get(db->parms,"database");
const char *s_tcpport = apr_table_get(db->parms,"port");
unsigned int tcpport = (s_tcpport)?atoi(s_tcpport):0;
const char *socketfile = apr_table_get(db->parms,"socketfile");
//dbi_result result;
dbi_conn_rec *dblink = db->handle;
if (!dblink) {
dblink = apr_pcalloc(db->p, sizeof(*dblink));
db->handle = (void *)dblink;
}
dblink->conn = dbi_conn_new(driver);
dbi_conn_set_option(dblink->conn, "host", host);
dbi_conn_set_option(dblink->conn, "username", user);
dbi_conn_set_option(dblink->conn, "password", passwd);
dbi_conn_set_option(dblink->conn, "dbname", database);
if (tcpport) {
dbi_conn_set_option_numeric(dblink->conn, "port", tcpport);
}
if (socketfile && !strcmp(driver,"mysql")) {
dbi_conn_set_option(dblink->conn, "mysql_unix_socket", socketfile);
}
if (!dbi_conn_connect(dblink->conn)) {
log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
"HOST: '%s' PORT: '%d' DB: '%s' USER: '%s' SOCKET: '%s'",
host, tcpport, database, user, socketfile);
return LOGSQL_OPENDB_SUCCESS;
} else {
const char *error;
dbi_conn_error(dblink->conn, &error);
log_error(APLOG_MARK, APLOG_ERR, 0, s,
"DBI Error: %s", error);
log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
"HOST: '%s' PORT: '%d' DB: '%s' USER: '%s' SOCKET: '%s'",
host, tcpport, database, user, socketfile);
return LOGSQL_OPENDB_FAIL;
}
}
/* Close the DB link */
static void log_sql_dbi_close(logsql_dbconnection *db)
{
dbi_conn_rec *dblink = db->handle;
dbi_conn_close(dblink->conn);
dblink->conn = NULL;
}
/* Routine to escape the 'dangerous' characters that would otherwise
* corrupt the INSERT string: ', \, and "
*/
static const char *log_sql_dbi_escape(const char *from_str, apr_pool_t *p,
logsql_dbconnection *db)
{
dbi_conn_rec *dblink = db->handle;
if (!from_str)
return NULL;
else {
char *to_str = strdup(from_str);
char *retval;
dbi_driver_quote_string(dbi_conn_get_driver(dblink->conn), &to_str);
retval = apr_pstrdup(p, to_str);
free(to_str);
return retval;
}
}
/* Run a mysql insert query and return a categorized error or success */
static logsql_query_ret log_sql_dbi_query(request_rec *r,logsql_dbconnection *db,
const char *query)
{
const char *error;
dbi_result result;
dbi_conn_rec *dblink = db->handle;
if (!dblink->conn) {
return LOGSQL_QUERY_NOLINK;
}
/* Run the query */
if ((result = dbi_conn_query(dblink->conn, query))) {
return LOGSQL_QUERY_SUCCESS;
}
/* Check to see if the error is "nonexistent table" */
dbi_conn_error(dblink->conn, &error);
log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
"DBI Error: %s", error);
/* if (real_error == ER_NO_SUCH_TABLE) {
log_error(APLOG_MARK,APLOG_ERR,0, r->server,"table does not exist, preserving query");
return LOGSQL_QUERY_NOTABLE;
}*/
return LOGSQL_QUERY_FAIL;
}
/* Create table table_name of type table_type. */
static logsql_table_ret log_sql_dbi_create(request_rec *r, logsql_dbconnection *db,
logsql_tabletype table_type, const char *table_name)
{
dbi_result result;
const char *driver = apr_table_get(db->parms,"driver");
const char *tabletype = apr_table_get(db->parms,"tabletype");
char *type_suffix = NULL;
char *create_prefix = "create table if not exists `";
char *create_suffix = NULL;
char *create_sql;
dbi_conn_rec *dblink = db->handle;
/* if (!global_config.createtables) {
return APR_SUCCESS;
}*/
switch (table_type) {
case LOGSQL_TABLE_ACCESS:
create_suffix =
"` (id char(19),\
agent varchar(255),\
bytes_sent int unsigned,\
child_pid smallint unsigned,\
cookie varchar(255),\
machine_id varchar(25),\
request_file varchar(255),\
referer varchar(255),\
remote_host varchar(50),\
remote_logname varchar(50),\
remote_user varchar(50),\
request_duration smallint unsigned,\
request_line varchar(255),\
request_method varchar(10),\
request_protocol varchar(10),\
request_time char(28),\
request_uri varchar(255),\
request_args varchar(255),\
server_port smallint unsigned,\
ssl_cipher varchar(25),\
ssl_keysize smallint unsigned,\
ssl_maxkeysize smallint unsigned,\
status smallint unsigned,\
time_stamp int unsigned,\
virtual_host varchar(255))";
break;
case LOGSQL_TABLE_COOKIES:
case LOGSQL_TABLE_HEADERSIN:
case LOGSQL_TABLE_HEADERSOUT:
case LOGSQL_TABLE_NOTES:
create_suffix =
"` (id char(19),\
item varchar(80),\
val varchar(80))";
break;
}
if (tabletype && !strcmp(driver,"mysql")) {
type_suffix = apr_pstrcat(r->pool, " TYPE=",
tabletype, NULL);
}
/* Find memory long enough to hold the whole CREATE string + \0 */
create_sql = apr_pstrcat(r->pool, create_prefix, table_name, create_suffix,
type_suffix, NULL);
log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"create string: %s", create_sql);
if (!dblink) {
return LOGSQL_QUERY_NOLINK;
}
/* Run the create query */
if (!(result = dbi_conn_query(dblink, create_sql))) {
const char *error;
dbi_conn_error(dblink->conn, &error);
log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
"DBI Error: %s", error);
return LOGSQL_TABLE_FAIL;
}
return LOGSQL_TABLE_SUCCESS;
}
static logsql_dbdriver log_sql_dbi_driver = {
"dbi",
NULL,
log_sql_dbi_connect, /* open DB connection */
log_sql_dbi_close, /* close DB connection */
log_sql_dbi_escape, /* escape query */
log_sql_dbi_query, /* insert query */
log_sql_dbi_create /* create table */
};
static apr_status_t log_sql_dbi_cleanup(void *data)
{
dbi_shutdown();
#if defined(WITH_APACHE20)
return APR_SUCCESS;
#endif
}
LOGSQL_REGISTER(dbi) {
dbi_driver driver;
const char **driver_list;
int count = 1;
dbi_initialize(NULL);
for (driver = dbi_driver_list(NULL);
driver;
driver = dbi_driver_list(driver)) {
count++;
}
driver_list = apr_pcalloc(p, sizeof(char *) * (count));
count = 0;
for (driver = dbi_driver_list(NULL);
driver;
driver = dbi_driver_list(driver)) {
driver_list[count++] = dbi_driver_get_name(driver);
}
log_sql_dbi_driver.provided_drivers = driver_list;
log_sql_register_driver(p,&log_sql_dbi_driver);
apr_pool_cleanup_register(p, NULL, log_sql_dbi_cleanup, NULL);
LOGSQL_REGISTER_RETURN;
}