Skip to content
This repository was archived by the owner on Jan 21, 2019. It is now read-only.

Conversation

hamidreza-s
Copy link

I've added a simple case expression to rebar.config.script to find the OS type and add essential CFLAGS and LDFLAGS to compiler for building.
For example it can solve the problem of building in FreeBSD, because of the different locations of C's include and lib directory compared to Linux's paths.

Also this is the error which I encountered before the patch:

hamidreza@freebsd: xml % ./configure 
checking for gcc... no
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking whether make sets $(MAKE)... yes
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... cc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for ANSI C header files... (cached) yes
checking for erl... /usr/local/bin/erl
checking for erlc... /usr/local/bin/erlc
checking for XML_ParserCreate in -lexpat... no
checking expat.h usability... no
checking expat.h presence... no
checking for expat.h... no
configure: error: Expat library was not found

@zinid
Copy link
Contributor

zinid commented Sep 7, 2015

It is better to detect expat via ax_lib_expat: http://www.gnu.org/software/autoconf-archive/ax_lib_expat.html
It will detect location and substitute flags automatically (via AC_SUBST()).

@zinid
Copy link
Contributor

zinid commented Sep 9, 2015

@hamidreza-s I have added checks via the MACRO, please confirm if it works for you

@hamidreza-s
Copy link
Author

@zinid Yes it works in my FreeBSD machine. Thanks.

shell result:

hamidreza@freebsd: xml % ./configure
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking whether make sets $(MAKE)... yes
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... cc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for ANSI C header files... (cached) yes
checking for erl... /usr/local/bin/erl
checking for erlc... /usr/local/bin/erlc
checking for g++... no
checking for c++... c++
checking whether we are using the GNU C++ compiler... yes
checking whether c++ accepts -g... yes
checking for Expat XML Parser headers in /usr/local/include... found
checking for Expat XML Parser libraries... found
checking for Expat XML Parser... yes
checking if Expat XML Parser version is >= 2.0.0... yes
configure: creating ./config.status
config.status: creating rebar.config.script

@zinid
Copy link
Contributor

zinid commented Sep 9, 2015

Great

@mremond
Copy link
Member

mremond commented Oct 1, 2015

Reopening as the m4 macro has been rollback. It was causing other sort of troubles. See #14 for details.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants