Kaynağa Gözat

Defininng CFLAGS in configure.ac; adding --enable-debug option.

Uniforming makefiles by studying some autoconf macros and how variables are
inherited. Using also clang as default compiler.
Michele Orrù 11 yıl önce
ebeveyn
işleme
4dce81fa59

+ 10 - 1
configure.ac

@@ -8,7 +8,8 @@ AC_CONFIG_SRCDIR([src/qa.c])
 AC_CONFIG_HEADERS([config.h])
 
 # Checks for programs.
-AC_PROG_CC
+AC_PROG_CC([clang gcc cc])
+AC_PROG_CC_C99
 AC_PROG_RANLIB
 
 # Checks for libraries.
@@ -25,6 +26,14 @@ AC_FUNC_ERROR_AT_LINE
 AC_FUNC_MALLOC
 #AC_CHECK_FUNCS([dup2 setlocale strdup])
 
+# Add compiler flags
+CFLAGS="$CFLAGS --std=c99 -I$(pwd)/src/include -Wall"
+
+# Adding package options
+AC_ARG_ENABLE(debug,
+   AS_HELP_STRING([--enable-debug], [enable debugging, default: no]),
+   CFLAGS+=" -DDEBUG -ggdb")
+
 AC_OUTPUT([Makefile
            src/Makefile src/questions/Makefile
            src/apps/Makefile

+ 0 - 3
src/Makefile.am

@@ -1,9 +1,6 @@
 SUBDIRS = questions/ apps/ tests/
 
-CC = clang
-
 AM_LDFLAGS = -lcrypto -lm -lssl
-AM_CFLAGS = --std=c99 -ggdb -I include/
 
 bin_PROGRAMS = qa
 qa_SOURCES = qa.c qa_sock.c cmdline.c

+ 0 - 1
src/apps/Makefile.am

@@ -1,5 +1,4 @@
 bin_PROGRAMS = gen
-AM_CFLAGS = --std=c99 -Wall
 
 gen_SOURCES = gen.c
 gen_LDFLAGS = -lcrypto -lssl

+ 0 - 1
src/questions/Makefile.am

@@ -1,6 +1,5 @@
 SUBDIRS = tests/
 
-AM_CFLAGS = -I ../include/ -Wall
 AM_LDFLAGS = -lssl -lcrypto
 
 lib_LIBRARIES = libquestions.a

+ 0 - 1
src/questions/tests/Makefile.am

@@ -1,5 +1,4 @@
 # unittesting my ass
-AM_CFLAGS = -I ../../include/ -ggdb -Wall
 AM_LDFLAGS = -lcrypto -lssl
 LDADD = ../libquestions.a