]> git.cworth.org Git - glaze/blobdiff - configure
Add egl definitions and related buildsupport.
[glaze] / configure
index d115790d56296b6d99f9d732b525f226cf6c04fa..d281ecf5a3d22270fce85f4c7ba62227b53865d7 100755 (executable)
--- a/configure
+++ b/configure
@@ -176,6 +176,21 @@ have_m32=Yes
 if ${CC} -m32 -o arch-minimal arch-minimal.c > /dev/null 2>&1
 then
     printf "Yes.\n"
+
+    printf "   Target directory for 32-bit targets... "
+
+    lib32_dir=$(gcc -m32 --print-multiarch)
+
+    if [ "$lib32_dir" = "" ]; then
+       lib32_dir="i386-linux-gnu"
+       printf "\n\n"
+       printf "\t\t*** Warning: Failed to query target directory.\n"
+       printf "\t\tHard-coding to $lib32_dir\n"
+       printf "\t\tFix  LIB32_DIR in Makefile.config as needed.\n\n"
+    else
+       printf "${lib32_dir}\n"
+    fi
+
 else
     printf "No.\n"
     have_m32=No
@@ -186,6 +201,21 @@ have_m64=Yes
 if ${CC} -m64 -o arch-minimal arch-minimal.c > /dev/null 2>&1
 then
     printf "Yes.\n"
+
+    printf "   Target directory for 64-bit targets... "
+
+    lib64_dir=$(gcc -m64 --print-multiarch)
+
+    if [ "$lib64_dir" = "" ]; then
+       lib64_dir="x86_64-linux-gnu"
+       printf "\n\n"
+       printf "\t\t*** Warning: Failed to query target directory.\n"
+       printf "\t\tHard-coding to $lib64_dir\n"
+       printf "\t\tFix LIB64_DIR in Makefile.config as needed.\n\n"
+    else
+       printf "${lib64_dir}\n"
+    fi
+
 else
     printf "No.\n"
     have_m64=No
@@ -261,7 +291,9 @@ INCLUDEDIR = ${INCLUDEDIR:-\$(PREFIX)/include}
 
 # Whether compiler can create 32 or 64-bit binaries
 COMPILER_SUPPORTS_32 = ${have_m32}
+LIB32_DIR = lib/${lib32_dir}
 COMPILER_SUPPORTS_64 = ${have_m64}
+LIB64_DIR = lib/${lib64_dir}
 
 # Version information for glaze library
 MAJOR   = ${MAJOR}
@@ -271,8 +303,25 @@ VERSION = ${VERSION}
 
 EOF
 
-# construct the glaze.pc file
-cat > glaze.pc <<EOF
+# construct config.h
+QQ='"'
+cat > config.h <<EOF
+/* Generated by configure */
+
+/* The prefix to which ${PROJECT} should be installed */
+#define CONFIG_PREFIX "${PREFIX}"
+
+/* The directory to which libraries should be installed */
+#define CONFIG_LIBDIR "${LIBDIR:-${QQ} CONFIG_PREFIX ${QQ}/lib}"
+
+/* The directory to which executables should be installed */
+#define CONFIG_BINDIR "${BINDIR:-${QQ} CONFIG_PREFIX ${QQ}/bin}"
+
+EOF
+
+# construct the glaze.pc and glaze-32.pc files
+if [ "$have_m64" = "Yes" ]; then
+    cat > glaze.pc <<EOF
 prefix=${PREFIX}
 exec_prefix=\${prefix}
 libdir=${LIBDIR:-\${exec_prefix\}/lib}
@@ -285,3 +334,21 @@ Version: ${VERSION}
 Libs: -L\${libdir} -lglaze
 Cflags: -I\${includedir}/glaze
 EOF
+fi
+
+if [ "$have_m32" = "Yes" ]; then
+    cat > glaze-32.pc <<EOF
+prefix=${PREFIX}
+exec_prefix=\${prefix}
+libdir=${LIBDIR:-\${exec_prefix\}/lib}
+includedir=${INCLUDEDIR:-\${prefix\}/include}
+
+Name: ${PROJECT}
+Description: ${PROJECT_BLURB}
+Version: ${VERSION}
+
+Libs: -L\${libdir} -lglaze-32
+Cflags: -I\${includedir}/glaze
+EOF
+fi
+