# the make problem



## milo (Nov 27, 2009)

hi all, i'm need to write crossplatform configure scripts. there is tree of source code:

```
root +
     +--Makefile.am
     +--Makefile.in
     +--configure.ac
     +--src +
            +--dir1 +
                    +--Makefile.am
                    +--Makefile.in
                    +--configure.ac
            +--dir2 +
```
and so on...
it works fine with make in linux and gmake in FreeBSD, but it doesn't work with make in FreeBSD, it seems like:

```
[milo@office-gw ~/make_test]$ make
cd . && /bin/sh /home/milo/make_test/missing --run aclocal-1.10 
aclocal-1.10: `configure.ac' or `configure.in' is required
*** Error code 1

Stop in /home/milo/make_test.
```
but there id configure.ac in the directory and it works fine with gmake instead of make. i have to make it work with make utility. it makes me cry). i tried to find solvation in google, but i didn't find anything suitable.
this is source of the root configure.ac script:

```
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.61])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE
AC_PROG_MAKE_SET
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC

# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h memory.h netinet/in.h stdint.h stdlib.h string.h strings.h sys/param.h sys/socket.h syslog.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([atexit inet_ntoa memmove memset setlocale socket strcasecmp strchr strerror strncasecmp strrchr])

AC_CONFIG_FILES([Makefile
		 src/Makefile
		 src/search_retriever/Makefile
		 src/parser/Makefile
		 src/crawler_master/Makefile
		 src/surfer_master/Makefile
		 src/surfer_slave/Makefile
		 src/crawler_slave/Makefile
		 src/index_builder/Makefile
		 src/updater_master/Makefile
		 src/updater_slave/Makefile
		 src/doc_manager/Makefile])
AC_CONFIG_SUBDIRS([src/search_retriever
		   src/parser
		   src/crawler_master
		   src/crawler_slave
		   src/surfer_master
		   src/surfer_slave
		   src/index_builder
		   src/updater_master/
		   src/updater_slave/
		   src/doc_manager])
AC_OUTPUT
```


----------



## SirDice (Nov 27, 2009)

milo said:
			
		

> it works fine with make in linux and gmake in FreeBSD,


And the problem is? A lot of ports in the ports tree use gmake.


----------



## expl (Nov 28, 2009)

BSD make and GNU(Linux) make are quite different under the hood and in functions/syntax, its very difficult (if not impossible) to write scripts that both can execute for larger more complicated projects. 

Also both of tools are quite old and are not very efficient at building large chunks of code considering almost every computer has two or more CPU cores. If you are developer/maintainer of a large open-source project take a look at SCons it can do parallel compiling (great for speeding up long builds on multi-core systems) and a lot of other stuff that automake+autoconf can and can not perform.

Edit:
Just to be clear more recent versions of make do support parallelism but there are quite a few problems with it that I am not going to go deep in to in this post.


----------



## Oko (Nov 28, 2009)

milo said:
			
		

> it works fine with make in linux and gmake in FreeBSD, but it doesn't work with make in FreeBSD


That is because Linux uses broken GNU make not the real Unix make. To use real make on Linux you have to use *bmake*. I would refrain from using GNU make if you want your code to be used on anything else except Linux.


----------



## milo (Nov 28, 2009)

thank you all for answering my question.


----------

