|
| 1 | +# |
| 2 | +# |
| 3 | +# |
| 4 | + |
| 5 | +###################### |
| 6 | +# Project Information |
| 7 | +###################### |
| 8 | +AC_INIT([HWLOC Tools], |
| 9 | + [0.1]) |
| 10 | +AC_PREREQ(2.63) |
| 11 | + |
| 12 | + |
| 13 | +###################### |
| 14 | +# Utilities |
| 15 | +###################### |
| 16 | +_show_title() { |
| 17 | + cat <<EOF |
| 18 | + |
| 19 | +============================================================================ |
| 20 | +== ${1} |
| 21 | +============================================================================ |
| 22 | +EOF |
| 23 | +} |
| 24 | + |
| 25 | + |
| 26 | +###################### |
| 27 | +# Setup Makefile |
| 28 | +###################### |
| 29 | +_show_title "Setup Basic Information" |
| 30 | + |
| 31 | +# Initialize automake |
| 32 | +AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects no-define 1.10.1 -Wall -Werror]) |
| 33 | + |
| 34 | +# Make becomes a bit more quiet |
| 35 | +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 36 | + |
| 37 | +# Set the language |
| 38 | +CFLAGS_save="$CFLAGS" |
| 39 | +AC_LANG([C]) |
| 40 | +CFLAGS="$CFLAGS_save" |
| 41 | + |
| 42 | + |
| 43 | +###################### |
| 44 | +# Create a configure header file |
| 45 | +###################### |
| 46 | +AH_TOP([/* |
| 47 | + * This file is automatically generated by configure. Edits will be lost |
| 48 | + * the next time you run configure! |
| 49 | + */ |
| 50 | +#ifndef HWLOC_TOOLS_H |
| 51 | +#define HWLOC_TOOLS_H |
| 52 | +
|
| 53 | +#include <autogen/hwloc_tools_config_top.h> |
| 54 | +
|
| 55 | +]) |
| 56 | +AH_BOTTOM([ |
| 57 | +
|
| 58 | +#include <autogen/hwloc_tools_config_bottom.h> |
| 59 | +#endif /* HWLOC_TOOLS_CONFIG_H */ |
| 60 | +]) |
| 61 | + |
| 62 | +AC_CONFIG_HEADERS([src/include/autogen/config.h]) |
| 63 | + |
| 64 | + |
| 65 | +###################### |
| 66 | +# Make automake clean emacs ~ files for "make clean" |
| 67 | +###################### |
| 68 | +CLEANFILES="*~ .\#*" |
| 69 | +AC_SUBST(CLEANFILES) |
| 70 | + |
| 71 | + |
| 72 | +###################### |
| 73 | +# C Compiler |
| 74 | +###################### |
| 75 | +_show_title "Setup C Compiler" |
| 76 | + |
| 77 | +CFLAGS_save="$CFLAGS" |
| 78 | +AC_PROG_CC |
| 79 | +CFLAGS="$CFLAGS_save" |
| 80 | + |
| 81 | +AC_SUBST(CFLAGS) |
| 82 | +AC_SUBST(CXXFLAGS) |
| 83 | +AC_SUBST(CPPFLAGS) |
| 84 | +AC_SUBST(LDFLAGS) |
| 85 | +AC_SUBST(LIBS) |
| 86 | + |
| 87 | + |
| 88 | +###################### |
| 89 | +# HWLOC Install |
| 90 | +###################### |
| 91 | +_show_title "Setup HWLOC" |
| 92 | + |
| 93 | +# |
| 94 | +# --with-hwloc=DIR |
| 95 | +# --with-hwloc-libdir=DIR |
| 96 | +# |
| 97 | +AC_ARG_WITH([hwloc], |
| 98 | + [AC_HELP_STRING([--with-hwloc=DIR], |
| 99 | + [Search for hwloc headers and libraries in DIR ])]) |
| 100 | + |
| 101 | +AC_ARG_WITH([hwloc-libdir], |
| 102 | + [AC_HELP_STRING([--with-hwloc-libdir=DIR], |
| 103 | + [Search for hwloc libraries in DIR ])]) |
| 104 | +# HWLOC is required |
| 105 | +AS_IF([test "$with_hwloc" = "no"], |
| 106 | + [AC_MSG_WARN([HWLOC is required. --without-hwloc is not supported.]) |
| 107 | + AC_MSG_ERROR([Cannot continue])]) |
| 108 | +AS_IF([test -z "$with_hwloc" || test "$with_hwloc" == "yes"], |
| 109 | + [AC_MSG_WARN([HWLOC is required. Default search functionality not supported.]) |
| 110 | + AC_MSG_ERROR([Cannot continue])]) |
| 111 | + |
| 112 | +AC_MSG_CHECKING([HWLOC Location]) |
| 113 | +AC_MSG_RESULT([$with_hwloc]) |
| 114 | + |
| 115 | +CFLAGS="-I$with_hwloc/include $CFLAGS" |
| 116 | + |
| 117 | +# Do we really need '-ludev'? |
| 118 | +#LDFLAGS="-ludev $LDFLAGS" |
| 119 | + |
| 120 | +AC_MSG_CHECKING([If static HWLOC library is available]) |
| 121 | +AS_IF([test -f "$with_hwloc/lib/libhwloc.a" ], |
| 122 | + [AC_MSG_RESULT([yes]) |
| 123 | + LIBS="$with_hwloc/lib/libhwloc.a $LIBS"], |
| 124 | + [LDFLAGS="-L$with_hwloc/lib $LDFLAGS" |
| 125 | + LIBS="-lhwloc $LIBS"]) |
| 126 | + |
| 127 | +AC_MSG_CHECKING([Final CFLAGS]) |
| 128 | +AC_MSG_RESULT([$CFLAGS]) |
| 129 | + |
| 130 | +AC_MSG_CHECKING([Final LDFLAGS]) |
| 131 | +AC_MSG_RESULT([$LDFLAGS]) |
| 132 | + |
| 133 | +AC_MSG_CHECKING([Final LIBS]) |
| 134 | +AC_MSG_RESULT([$LIBS]) |
| 135 | + |
| 136 | +###################### |
| 137 | +# Makefile |
| 138 | +###################### |
| 139 | +AC_CONFIG_FILES([Makefile src/Makefile]) |
| 140 | + |
| 141 | +###################### |
| 142 | +# Done |
| 143 | +###################### |
| 144 | +_show_title "All Done" |
| 145 | +AC_OUTPUT |
| 146 | + |
0 commit comments