ext/extconf.rb
author Michael Granger <ged@FaerieMUD.org>
Thu, 20 Nov 2008 17:12:39 +0000
changeset 5 41a1542b3b10
parent 3 7f6da371e2ce
child 7 4460fc10c6a3
permissions -rwxr-xr-x
Cleaned up bsdjail extension code a bit more and made the extconf check for the actual headers being included.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     1
#!/usr/bin/env ruby
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     2
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     3
require 'mkmf'
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     4
require 'fileutils'
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     5
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     6
ADDITIONAL_LIBRARY_DIRS = %w[
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     7
	/usr/local/lib
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     8
	/opt/lib
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     9
	/opt/local/lib
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    10
]
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    11
ADDITIONAL_INCLUDE_DIRS = %w[
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    12
	/usr/local/include
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    13
	/opt/include
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    14
	/opt/local/include
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    15
]
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    16
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    17
$CFLAGS << ' -Wall' << ' -ggdb' << ' -DDEBUG'
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    18
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    19
def fail( *messages )
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    20
	$stderr.puts( *messages )
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    21
	exit( 1 )
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    22
end
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    23
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    24
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    25
dir_config( 'bsdjail' )
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    26
5
41a1542b3b10 Cleaned up bsdjail extension code a bit more and made the extconf check for
Michael Granger <ged@FaerieMUD.org>
parents: 3
diff changeset
    27
have_header( 'stdio.h' ) 		or fail "Can't find the stdio.h header."
41a1542b3b10 Cleaned up bsdjail extension code a bit more and made the extconf check for
Michael Granger <ged@FaerieMUD.org>
parents: 3
diff changeset
    28
have_header( 'sys/param.h' ) 	or fail "Can't find the sys/param.h header."
41a1542b3b10 Cleaned up bsdjail extension code a bit more and made the extconf check for
Michael Granger <ged@FaerieMUD.org>
parents: 3
diff changeset
    29
have_header( 'sys/jail.h' ) 	or fail "Can't find the sys/jail.h header."
41a1542b3b10 Cleaned up bsdjail extension code a bit more and made the extconf check for
Michael Granger <ged@FaerieMUD.org>
parents: 3
diff changeset
    30
have_header( 'sys/types.h' ) 	or fail "Can't find the sys/types.h header."
41a1542b3b10 Cleaned up bsdjail extension code a bit more and made the extconf check for
Michael Granger <ged@FaerieMUD.org>
parents: 3
diff changeset
    31
have_header( 'unistd.h' ) 		or fail "Can't find the unistd.h header."
3
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    32
5
41a1542b3b10 Cleaned up bsdjail extension code a bit more and made the extconf check for
Michael Granger <ged@FaerieMUD.org>
parents: 3
diff changeset
    33
have_func( "jail_attach" )		or fail "Can't find jail_attach in the stdlib."
3
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    34
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    35
create_makefile( 'bsdjail' )
7f6da371e2ce * Converted from Mkrf-based build back to mkmf.
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    36