# automake, and friends, how to modify --prefix?



## Chris_H (Aug 5, 2013)

Greetings,

I'm attempting to create another port for dns/. It currently speaks DNSSEC, handles primary, and secondary zones. Is authoritative, and configuration files are very similar to BIND. I intend to add the tools that dns/bind-tools currently offers, but without the need to have BIND installed -- either by building static versions, or better; creating my own.

The server currently builds perfectly on RELENG_8 (8.4-STABLE). I have zero reason to think it won't build, and run flawlessly on newer versions. The problem I am experiencing, is placing the files in locations suitable for a typical FreeBSD DNS server install. My first version intends to mimic the layout that BIND, as it comes with base -- /usr/sbin /usr/lib, and /var. The current option(s) available, are the standard --prefix=. Which is fine/expected, but the layout is odd -- at least by FreeBSD's understanding. Not fully knowing what to expect, I chose --prefix=/usr/local. I ran `script` to capture the results of `make install`. The results of which follow:

```
Script started on Sat Aug  3 19:44:24 2013
make install
Making install in lib/dnscore
 ./install-sh -c -d '/usr/local/lib'
 /usr/local/bin/bash ./libtool   --mode=install /usr/bin/install -c   libdnscore.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libdnscore.lai /usr/local/lib/libdnscore.la
libtool: install: /usr/bin/install -c .libs/libdnscore.a /usr/local/lib/libdnscore.a
libtool: install: chmod 644 /usr/local/lib/libdnscore.a
libtool: install: ranlib /usr/local/lib/libdnscore.a
 ./install-sh -c -d '/usr/local/include/dnscore'
 /usr/bin/install -c -m 644 include/dnscore/base16.h include/dnscore/base32.h include/dnscore/base32hex.h include/dnscore/base64.h include/dnscore/dnscore-config.h include/dnscore/buffer_input_stream.h include/dnscore/buffer_output_stream.h include/dnscore/bytearray_output_stream.h include/dnscore/mt_output_stream.h include/dnscore/clone_input_output_stream.h include/dnscore/host_address.h include/dnscore/network.h include/dnscore/counter_output_stream.h include/dnscore/debug_config.h include/dnscore/debug.h include/dnscore/dnscore.h include/dnscore/dnsformat.h include/dnscore/dnsname.h include/dnscore/dnsname_set.h include/dnscore/u32_set.h include/dnscore/treeset.h include/dnscore/file_input_stream.h include/dnscore/file_output_stream.h include/dnscore/filter_input_stream.h include/dnscore/fingerprint.h include/dnscore/format.h include/dnscore/input_stream.h include/dnscore/logger_channel.h include/dnscore/logger_channel_stream.h include/dnscore/logger_channel_syslog.h include/dnscore/logger.h include/dnscore/logger_handle.h include/dnscore/logger_channel_file.h include/dnscore/message.h include/dnscore/mutex.h include/dnscore/output_stream.h include/dnscore/packet_reader.h include/dnscore/packet_writer.h include/dnscore/parsing.h include/dnscore/print_stream.h '/usr/local/include/dnscore'
 /usr/bin/install -c -m 644 include/dnscore/ptr_vector.h include/dnscore/random.h include/dnscore/rdtsc.h include/dnscore/rfc.h include/dnscore/scheduler.h include/dnscore/serial.h include/dnscore/string_set.h include/dnscore/sys_error.h include/dnscore/sys_get_cpu_count.h include/dnscore/sys_types.h include/dnscore/threaded_queue.h include/dnscore/threaded_ringbuffer.h include/dnscore/threaded_ringbuffer_cw.h include/dnscore/threaded_ringlist.h include/dnscore/threaded_nbrb.h include/dnscore/thread_pool.h include/dnscore/threaded_nb_mm.h include/dnscore/timems.h include/dnscore/typebitmap.h include/dnscore/zonefile_reader.h include/dnscore/avl.h.inc include/dnscore/avl.c.inc include/dnscore/fdtools.h include/dnscore/tcp_io_stream.h include/dnscore/io_stream.h include/dnscore/xfr_copy.h include/dnscore/alarm.h include/dnscore/ctrl-rfc.h include/dnscore/tsig.h '/usr/local/include/dnscore'
Making install in lib/dnsdb
 ./install-sh -c -d '/usr/local/lib'
 /usr/local/bin/bash ./libtool   --mode=install /usr/bin/install -c   libdnsdb.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libdnsdb.lai /usr/local/lib/libdnsdb.la
libtool: install: /usr/bin/install -c .libs/libdnsdb.a /usr/local/lib/libdnsdb.a
libtool: install: chmod 644 /usr/local/lib/libdnsdb.a
libtool: install: ranlib /usr/local/lib/libdnsdb.a
 ./install-sh -c -d '/usr/local/include/dnsdb'
 /usr/bin/install -c -m 644 include/dnsdb/dnsdb-config.h include/dnsdb/avl.h include/dnsdb/btree.h include/dnsdb/dictionary.h include/dnsdb/dnskey.h include/dnsdb/dnsrdata.h include/dnsdb/dnssec_config.h include/dnsdb/dnssec_dsa.h include/dnsdb/dnssec.h include/dnsdb/dnssec_keystore.h include/dnsdb/dnssec_rsa.h include/dnsdb/dnssec_scheduler.h include/dnsdb/dnssec_task.h include/dnsdb/dynupdate.h include/dnsdb/hash.h include/dnsdb/htable.h include/dnsdb/htbt.h include/dnsdb/icmtl_input_stream.h include/dnsdb/nsec3_collection.h include/dnsdb/nsec3.h include/dnsdb/nsec3_hash.h include/dnsdb/nsec3_item.h include/dnsdb/nsec3_icmtl.h include/dnsdb/nsec3_load.h include/dnsdb/nsec3_name_error.h include/dnsdb/nsec3_nodata_error.h include/dnsdb/nsec3_owner.h include/dnsdb/nsec3_types.h include/dnsdb/nsec3_update.h include/dnsdb/nsec3_zone.h include/dnsdb/nsec_common.h include/dnsdb/nsec.h include/dnsdb/nsec_collection.h include/dnsdb/rrsig.h include/dnsdb/zdb_alloc.h include/dnsdb/zdb_config.h include/dnsdb/zdb_dnsname.h include/dnsdb/zdb_error.h include/dnsdb/zdb.h include/dnsdb/zdb_icmtl.h '/usr/local/include/dnsdb'
 /usr/bin/install -c -m 644 include/dnsdb/zdb_listener.h include/dnsdb/zdb_record.h include/dnsdb/zdb_rr_label.h include/dnsdb/zdb_store.h include/dnsdb/zdb_types.h include/dnsdb/zdb_utils.h include/dnsdb/zdb_zone.h include/dnsdb/zdb_zone_label.h include/dnsdb/zdb_zone_label_iterator.h include/dnsdb/zdb_zone_write.h include/dnsdb/zonefile.h include/dnsdb/zdb_sanitize.h include/dnsdb/zdb_zone_load.h include/dnsdb/zdb_zone_load_interface.h '/usr/local/include/dnsdb'
Making install in lib/dnszone
 ./install-sh -c -d '/usr/local/lib'
 /usr/local/bin/bash ./libtool   --mode=install /usr/bin/install -c   libdnszone.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libdnszone.lai /usr/local/lib/libdnszone.la
libtool: install: /usr/bin/install -c .libs/libdnszone.a /usr/local/lib/libdnszone.a
libtool: install: chmod 644 /usr/local/lib/libdnszone.a
libtool: install: ranlib /usr/local/lib/libdnszone.a
 ./install-sh -c -d '/usr/local/include/dnszone'
 /usr/bin/install -c -m 644 include/dnszone/output_stream_write_rdata.h include/dnszone/dnszone.h include/dnszone/dnszone-config.h include/dnszone/zone_axfr_reader.h include/dnszone/zone_file_reader.h include/dnszone/resourcerecord.h '/usr/local/include/dnszone'
Making install in sbin/yadifad
 ./install-sh -c -d '/usr/local/sbin'
  /usr/local/bin/bash ./libtool   --mode=install /usr/bin/install -c yadifad '/usr/local/sbin'
libtool: install: /usr/bin/install -c yadifad /usr/local/sbin/yadifad
Making install in etc
 .././install-sh -c -d '/usr/local/share/doc/yadifa'
 /usr/bin/install -c -m 644 yadifad.conf.example yadifad-master.conf.example yadifad-slave.conf.example '/usr/local/share/doc/yadifa'
Making install in doc
 .././install-sh -c -d '/usr/local/share/man/man1'
 /usr/bin/install -c -m 644 'yadifad.man' '/usr/local/share/man/man1/yadifad.1'
 .././install-sh -c -d '/usr/local/share/man/man5'
 /usr/bin/install -c -m 644 'yadifad.conf.man' '/usr/local/share/man/man5/yadifad.conf.5'
Making install in var
 .././install-sh -c -d '/usr/local/var/zones/masters'
 /usr/bin/install -c -m 644 zones/masters/0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa.zone zones/masters/0.0.127.in-addr.arpa.zone zones/masters/localhost6.zone zones/masters/localhost.zone zones/masters/somedomain.eu.zone '/usr/local/var/zones/masters'
make  install-data-hook

Script done on Sat Aug  3 19:44:27 2013
```
As you can see from the output, the man(1) pages aren't placed appropriately, nor does /var. Of course choosing --prefix=/usr would help in some areas. It won't solve the problem. I haven't a good understanding of GNU's autoconf, configure, and friends. So I have zero idea where to turn, in order to modify macros/tags.

Here is the contents of Makefile.am:

```
srcdir =        @srcdir@
top_srcdir =    @top_srcdir@

VPATH =         @srcdir@

ACLOCAL_AMFLAGS = -I m4

dist_noinst_DATA = VERSION

SUBDIRS = lib/dnscore lib/dnsdb lib/dnszone sbin/yadifad etc doc var

release:
	for m in $(SUBDIRS); do $(MAKE) -C $$m release;done

profile:
	for m in $(SUBDIRS); do $(MAKE) -C $$m profile;done

debug:
	for m in $(SUBDIRS); do $(MAKE) -C $$m debug;done
```
I can also provide the contents of Makefile.in, but I think it's too big to dump the output here. So I'll place a link, if needed/wanted.

Thank you for all your time, and consideration.

--chris

@@DutchDaemon _the_ BIND _is_ the proper context.
As it is _the_ "Berkeley Internet Name Domain".

[ http://www.isc.org/downloads/BIND/ - ISC does not speak of *the* BIND anywhere. -- Mod. ]


----------



## Chris_H (Aug 5, 2013)

In my quest to overcome this issue, and in the absence of man(1) pages for autoconf, automake, and configure, I discovered the autobook port. In the end, all of this may be overkill. As it occurs to me, that simply performing:

```
./configure
make --prefix=/usr
```
Then creating the port by simply _copying_/_moving_ the files to their intended destinations.

--chris


----------



## wblock@ (Aug 5, 2013)

Don't mess with PREFIX, any port should install to whatever PREFIX has been set by the user.  There are some ports that install files in the base system, but that should be avoided unless necessary.

As far as "BIND", common usage--including ISC--is without "the": http://www.isc.org/downloads/bind/.


----------



## Chris_H (Aug 5, 2013)

Greetings @wblock@, and thank you for your reply.


			
				wblock@ said:
			
		

> Don't mess with PREFIX, any port should install to whatever PREFIX has been set by the user.  There are some ports that install files in the base system, but that should be avoided unless necessary.


Indeed. But in this case. Should I want it to work on a FreeBSD system. Several changes need to be made, as to the installed (target) location(s) of some of the files. Specifically; the man(1) pages, and *.conf files. For example; placing the man pages in /usr/local/share/man/man1/, and /usr/local/share/man/man5/, shouldn't happen. Placing it in a chroot(8)/jail(8) environment, should best use /var, not /usr/local/var, or /usr/var.


			
				wblock@ said:
			
		

> As far as "BIND", common usage--including ISC--is without "the": http://www.isc.org/downloads/bind/.


Fair enough. But given that it is an acronym, using it without pre-pending "the" seemed like inproper english. Sorry.

Thanks again, for taking the time to respond.

--chris


----------



## wblock@ (Aug 5, 2013)

Usually the easiest way is to search for a port to use as an example.  Someone on the freebsd-ports mailing list, or on IRC (bsdports on EFnet) could probably recommend a port that does similar things.  I would do a basic port first, then worry about putting it in chroot(8).


----------



## Chris_H (Aug 5, 2013)

Greetings @wblock@, and thank you for the reply.

I've been looking at src/contrib/bind, and other similar ports in ports/dns. Thus far, experimenting with re-defining a couple of the variables/macros within the src of this application, might do the trick. If not, I guess I should probably take your advice, and subscribe to ports@.

Thanks again, for taking the time to respond.

--chris


----------

