configure: set a compiler search option
authorJon Trulson <jon@radscan.com>
Sun, 15 Dec 2019 19:47:57 +0000 (12:47 -0700)
committerJon Trulson <jon@radscan.com>
Sun, 15 Dec 2019 19:47:57 +0000 (12:47 -0700)
... and move the PROG_CC and PROG_CXX checks toward the beginning.
Without the move the compiler search arguments are ignored.  We search
for 'cc gcc clang' and 'c++ g++ clang++', in that order for CC and CXX
respectively.

This means there should be no need to override the CC
and CXX variables on the configure command line for BSD systems.

On OpenBSD for example, cc links to clang.  On Linux, cc links to
gcc.  You can still override these if you like with CC=... and
CXX=... on the configure command line.

gmake (MAKE=gmake) still needs to be used on the BSD's though.

With these and previous changes, CDE builds, installs, and runs
correctly on OpenBSD 6.5 now.

cde/configure.ac

index fd5b94fdd306d7adeebae9cb7b4dbb43257500c5..f327e100da8459cf063798c9a7fd5ff4139eb317 100644 (file)
@@ -2,6 +2,11 @@ AC_INIT([cde-desktop], [2.3.1], [jon@radscan.com])
 AC_CONFIG_HEADERS([include/autotools_config.h])
 AC_CONFIG_MACRO_DIRS([m4])
 AM_INIT_AUTOMAKE([foreign subdir-objects])
+
+dnl These must be up here for the compiler search list to actually work
+AC_PROG_CC([cc gcc clang])
+AC_PROG_CXX([c++ g++ clang++])
+
 LT_INIT
 AC_PREFIX_DEFAULT(/usr/dt)
 
@@ -218,9 +223,6 @@ AC_SUBST(CDE_CONFIGURATION_TOP)
 AC_SUBST(CDE_LOGFILES_TOP)
 AC_SUBST(CDE_USER_TOP)
 
-AC_PROG_CC
-AC_PROG_CXX
-
 AC_PROG_CPP
 
 dnl we need a real preprocessor, not gcc -E.  We will call it GENCPP.
@@ -320,7 +322,7 @@ dnl deal, or modify them here directly.
 CPPFLAGS="${CPPFLAGS} ${SOURCE_CPP_DEFINES} ${CPP_COMPILER_FLAGS} ${OSVERSION}"
 CFLAGS="${CFLAGS} ${C_COMPILER_FLAGS} ${X_CFLAGS} ${MOTIF_INC} ${PTHREAD_CFLAGS}"
 CXXFLAGS="${CXXFLAGS} ${CXX_COMPILER_FLAGS} ${X_CFLAGS} ${MOTIF_INC} ${PTHREAD_CFLAGS}"
-LIBS="${LIBS} ${PTHREAD_LIBS}"
+LIBS="${X_LIBS} ${LIBS} ${PTHREAD_LIBS}"
 
 dnl All of the makefiles we need to generate go here...
 AC_CONFIG_FILES([